Tableau that allows the selection of one active child but displays all children. More...
#include <vgui_selector_tableau.h>
Public Member Functions | |
vgui_selector_tableau () | |
Constructor - don't use this, use vgui_selector_tableau_new. | |
vgui_selector_tableau (vcl_vector< vgui_tableau_sptr > const &children) | |
Constructor - don't use this, use vgui_selector_tableau_new. | |
virtual bool | handle (const vgui_event &) |
Handle all events sent to this tableau. | |
vcl_string | type_name () const |
Returns the type of this tableau ('vgui_selector_tableau'). | |
vcl_string | file_name () const |
There is no obvious filename, so this just returns the type. | |
vcl_string | pretty_name () const |
Returns a nice version of the name, including info on the children. | |
virtual void | get_popup (const vgui_popup_params &, vgui_menu &m) |
Builds a popup menu for the user to select the active child and set visibility. | |
void | add (vgui_tableau_sptr const &tab, vcl_string name="") |
Add a tableau to the list of child tableaux. | |
void | remove (vgui_tableau_sptr const &tab) |
Remove a tableau from the list of child tableaux. | |
bool | remove (const vcl_string name) |
Remove a tableau from the list of child tableaux by name. | |
void | clear () |
Clear the list of child tableaux. | |
vgui_tableau_sptr | active_tableau () const |
Returns a smart pointer to the active tableau. | |
const vcl_string & | active_name () const |
Returns the name of the active tableau. | |
vgui_tableau_sptr | get_tableau (const vcl_string &name) const |
Returns a smart pointer to the tableau with the given name. | |
void | set_active (const vcl_string &name) |
Make the child tableau with the given name the active child. | |
bool | toggle (const vcl_string &name) |
Toggle the child tableau with the given name between visible/invisible. | |
bool | is_visible (const vcl_string &name) const |
Returns true if the child tableau with the given name is active. | |
void | active_to_top () |
Move the active tableau to the top of the display list. | |
void | active_raise () |
Move the active tableau up one position in the display list. | |
void | active_lower () |
Move the active tableau down one position in the display list. | |
void | active_to_bottom () |
Move the active tableau to the bottom of the display list. | |
int | num_children () const |
Returns the number of children. | |
const vcl_vector< vcl_string > & | child_names () const |
Returns a vector containing the names of all children (in rendering order). | |
virtual void | add_to_menu (vgui_menu &) |
for subclasses to add additional menus. | |
virtual vcl_string | name () const |
Return the name of the tableau. | |
void | get_parents (vcl_vector< vgui_tableau_sptr > *out) const |
Get the parent tableaux for this tableau. | |
void | get_children (vcl_vector< vgui_tableau_sptr > *out) const |
Get the child tableaux for this tableau. | |
vgui_tableau_sptr | get_child (unsigned i) const |
Get the ith child or return 0. | |
virtual bool | notify_replaced_child (vgui_tableau_sptr const &old_child, vgui_tableau_sptr const &new_child) |
Called whenever a child of this tableau is about to be forcibly replaced. | |
virtual void | add_popup (vgui_menu &) |
Add the given menu to the popup menu for the tableau. | |
virtual void | post_message (char const *, void const *) |
Post a message event. | |
virtual void | post_redraw () |
Post a draw event. | |
virtual void | post_overlay_redraw () |
Post an overlay-redraw event. | |
virtual void | post_idle_request () |
Post an idle request event. | |
virtual bool | draw () |
Called by default handle when it receives a draw event. | |
virtual bool | mouse_down (int x, int y, vgui_button, vgui_modifier) |
Called by default handle when it receives a mouse down event. | |
virtual bool | mouse_up (int x, int y, vgui_button, vgui_modifier) |
Called by default handle when it receives a mouse up event. | |
virtual bool | motion (int x, int y) |
Called by handle when it receives a mouse motion event. | |
virtual bool | key_press (int x, int y, vgui_key, vgui_modifier) |
Called by default handle when it receives a key-press event. | |
virtual bool | help () |
Called by default handle when it receives a '?' pressed event. | |
virtual bool | idle () |
Called when the application is otherwise idle. | |
void | ref () const |
Increase the reference count by one (for smart pointers). | |
void | unref () const |
Decrease the reference count by one (for smart pointers). | |
Static Public Member Functions | |
static void | get_all (vcl_vector< vgui_tableau_sptr > *out) |
Push all tableaux onto the given vector. | |
static bool | exists (vgui_tableau_sptr const &) |
Returns true if the given address points to a valid tableau. | |
Protected Member Functions | |
virtual | ~vgui_selector_tableau () |
Destructor - called by vgui_selector_tableau_sptr. | |
bool | get_bounding_box (float low[3], float high[3]) const |
Returns a bounding box large enough to contain all child bounding boxes. | |
bool | add_child (vgui_tableau_sptr const &t) |
Add to list of child tableaux. | |
bool | remove_child (vgui_tableau_sptr const &) |
Remove given tableau from list of child tableaux. | |
Protected Attributes | |
vcl_map< vcl_string, bool > | visible_ |
Whether each child is visible or not (ie. using events). | |
vcl_vector< vcl_string > | render_order_ |
The unique child names sorted in rendering order. | |
vcl_map< vcl_string, vgui_parent_child_link > | child_map_ |
A map from unique names to children. | |
vcl_string | active_child_ |
The name of the active tableau. |
Tableau that allows the selection of one active child but displays all children.
The vgui_selector_tableau class can have any number of children, indexed from 0 upwards. The draw action of vgui_selector_tableau is to draw each of its children, in order, into the current context if they are marked visible. Events reaching the vgui_selector_tableau are passed on to the active child only.
The exceptions to this rule are : [a] the DRAW, DRAW_OVERLAY events which are sent to all children.
Definition at line 33 of file vgui_selector_tableau.h.
vgui_selector_tableau::vgui_selector_tableau | ( | ) |
Constructor - don't use this, use vgui_selector_tableau_new.
Creates an empty composite tableau.
Definition at line 26 of file vgui_selector_tableau.cxx.
vgui_selector_tableau::vgui_selector_tableau | ( | vcl_vector< vgui_tableau_sptr > const & | the_children | ) |
Constructor - don't use this, use vgui_selector_tableau_new.
Takes a vector of child tableaux.
Many children, top to bottom.
Definition at line 34 of file vgui_selector_tableau.cxx.
vgui_selector_tableau::~vgui_selector_tableau | ( | ) | [protected, virtual] |
Destructor - called by vgui_selector_tableau_sptr.
Definition at line 43 of file vgui_selector_tableau.cxx.
void vgui_selector_tableau::active_lower | ( | ) |
Move the active tableau down one position in the display list.
Definition at line 290 of file vgui_selector_tableau.cxx.
const vcl_string& vgui_selector_tableau::active_name | ( | ) | const [inline] |
Returns the name of the active tableau.
Definition at line 77 of file vgui_selector_tableau.h.
void vgui_selector_tableau::active_raise | ( | ) |
Move the active tableau up one position in the display list.
Definition at line 278 of file vgui_selector_tableau.cxx.
vgui_tableau_sptr vgui_selector_tableau::active_tableau | ( | ) | const |
Returns a smart pointer to the active tableau.
Definition at line 218 of file vgui_selector_tableau.cxx.
void vgui_selector_tableau::active_to_bottom | ( | ) |
Move the active tableau to the bottom of the display list.
Definition at line 315 of file vgui_selector_tableau.cxx.
void vgui_selector_tableau::active_to_top | ( | ) |
Move the active tableau to the top of the display list.
Definition at line 302 of file vgui_selector_tableau.cxx.
void vgui_selector_tableau::add | ( | vgui_tableau_sptr const & | tab, |
vcl_string | name = "" |
||
) |
Add a tableau to the list of child tableaux.
Definition at line 143 of file vgui_selector_tableau.cxx.
bool vgui_selector_tableau::add_child | ( | vgui_tableau_sptr const & | t | ) | [protected, virtual] |
Add to list of child tableaux.
virtual
Reimplemented from vgui_tableau.
Definition at line 161 of file vgui_selector_tableau.cxx.
void vgui_tableau::add_popup | ( | vgui_menu & | ) | [virtual, inherited] |
Add the given menu to the popup menu for the tableau.
Add given menu to the tableau popup menu.
This method is for tableaux to implement if they want to _add_ some items to the popup menu. They can assign to or clear 'menu', but that is not recommended as it would remove what other tableaux put there. The recommended usage is to .add() items or to .include() another menu.
** This is an interface method. it abstracts a behaviour. **
Reimplemented in vgui_satellite_tableau_t< object, data >, vgui_active_tableau, and vgui_clear_tableau.
Definition at line 316 of file vgui_tableau.cxx.
virtual void vgui_selector_tableau::add_to_menu | ( | vgui_menu & | ) | [inline, virtual] |
for subclasses to add additional menus.
Definition at line 110 of file vgui_selector_tableau.h.
const vcl_vector<vcl_string>& vgui_selector_tableau::child_names | ( | ) | const [inline] |
Returns a vector containing the names of all children (in rendering order).
Definition at line 107 of file vgui_selector_tableau.h.
void vgui_selector_tableau::clear | ( | ) |
Clear the list of child tableaux.
Definition at line 208 of file vgui_selector_tableau.cxx.
bool vgui_tableau::draw | ( | ) | [virtual, inherited] |
Called by default handle when it receives a draw event.
Reimplemented in vgui_function_tableau.
Definition at line 176 of file vgui_tableau.cxx.
bool vgui_tableau::exists | ( | vgui_tableau_sptr const & | ptr | ) | [static, inherited] |
Returns true if the given address points to a valid tableau.
Definition at line 385 of file vgui_tableau.cxx.
vcl_string vgui_selector_tableau::file_name | ( | ) | const [virtual] |
There is no obvious filename, so this just returns the type.
Return the file name of the active tableau or just return the type.
Reimplemented from vgui_tableau.
Definition at line 49 of file vgui_selector_tableau.cxx.
void vgui_tableau::get_all | ( | vcl_vector< vgui_tableau_sptr > * | out | ) | [static, inherited] |
Push all tableaux onto the given vector.
Definition at line 376 of file vgui_tableau.cxx.
bool vgui_selector_tableau::get_bounding_box | ( | float | low[3], |
float | high[3] | ||
) | const [protected, virtual] |
Returns a bounding box large enough to contain all child bounding boxes.
Returns a bounding box large enough to contain all the visible child bounding boxes.
Reimplemented from vgui_tableau.
Definition at line 102 of file vgui_selector_tableau.cxx.
vgui_tableau_sptr vgui_tableau::get_child | ( | unsigned | i | ) | const [inherited] |
Get the ith child or return 0.
Get the ith child, or return 0.
Definition at line 274 of file vgui_tableau.cxx.
void vgui_tableau::get_children | ( | vcl_vector< vgui_tableau_sptr > * | out | ) | const [inherited] |
Get the child tableaux for this tableau.
Push children onto the given vcl_vector.
Definition at line 267 of file vgui_tableau.cxx.
void vgui_tableau::get_parents | ( | vcl_vector< vgui_tableau_sptr > * | out | ) | const [inherited] |
Get the parent tableaux for this tableau.
Push parents onto the given vcl_vector.
Definition at line 260 of file vgui_tableau.cxx.
void vgui_selector_tableau::get_popup | ( | const vgui_popup_params & | params, |
vgui_menu & | m | ||
) | [virtual] |
Builds a popup menu for the user to select the active child and set visibility.
Builds a popup menu for the user to select the active child.
Over-rides function in vgui_tableau.
Reimplemented from vgui_tableau.
Definition at line 383 of file vgui_selector_tableau.cxx.
vgui_tableau_sptr vgui_selector_tableau::get_tableau | ( | const vcl_string & | name | ) | const |
Returns a smart pointer to the tableau with the given name.
Definition at line 227 of file vgui_selector_tableau.cxx.
bool vgui_selector_tableau::handle | ( | const vgui_event & | event | ) | [virtual] |
Handle all events sent to this tableau.
Key-press '?' prints info on this file, before being sent to the children.
Reimplemented from vgui_tableau.
Definition at line 69 of file vgui_selector_tableau.cxx.
bool vgui_tableau::help | ( | ) | [virtual, inherited] |
Called by default handle when it receives a '?' pressed event.
Reimplemented in vgui_deck_tableau, vgui_listmanager2D_tableau, vgui_composite_tableau, vgui_viewer2D_tableau, vgui_function_tableau, and vgui_viewer3D_tableau.
Definition at line 166 of file vgui_tableau.cxx.
bool vgui_tableau::idle | ( | ) | [virtual, inherited] |
Called when the application is otherwise idle.
Override if you want to do idle processing. Return false once your idle processing is complete, or if you have no need for more idle processing. Return true if you need more idle processing time.
Definition at line 185 of file vgui_tableau.cxx.
bool vgui_selector_tableau::is_visible | ( | const vcl_string & | name | ) | const |
Returns true if the child tableau with the given name is active.
Definition at line 261 of file vgui_selector_tableau.cxx.
bool vgui_tableau::key_press | ( | int | x, |
int | y, | ||
vgui_key | , | ||
vgui_modifier | |||
) | [virtual, inherited] |
Called by default handle when it receives a key-press event.
Caled by default handle when it receives a key press event.
Reimplemented in vgui_deck_tableau, vgui_listmanager2D_tableau, vgui_viewer2D_tableau, vgui_function_tableau, and vgui_viewer3D_tableau.
Definition at line 156 of file vgui_tableau.cxx.
bool vgui_tableau::motion | ( | int | x, |
int | y | ||
) | [virtual, inherited] |
Called by handle when it receives a mouse motion event.
Called by default handle when it receives a mouse motion event.
Reimplemented in vgui_listmanager2D_tableau, vgui_function_tableau, and vgui_displaylist2D_tableau.
Definition at line 146 of file vgui_tableau.cxx.
bool vgui_tableau::mouse_down | ( | int | x, |
int | y, | ||
vgui_button | , | ||
vgui_modifier | |||
) | [virtual, inherited] |
Called by default handle when it receives a mouse down event.
Reimplemented in vgui_listmanager2D_tableau, vgui_viewer2D_tableau, vgui_function_tableau, vgui_viewer3D_tableau, vgui_displaylist3D_tableau, and vgui_displaylist2D_tableau.
Definition at line 126 of file vgui_tableau.cxx.
bool vgui_tableau::mouse_up | ( | int | x, |
int | y, | ||
vgui_button | , | ||
vgui_modifier | |||
) | [virtual, inherited] |
Called by default handle when it receives a mouse up event.
Reimplemented in vgui_viewer2D_tableau, vgui_function_tableau, and vgui_viewer3D_tableau.
Definition at line 136 of file vgui_tableau.cxx.
virtual vcl_string vgui_tableau::name | ( | void | ) | const [inline, virtual, inherited] |
Return the name of the tableau.
Reimplemented in vgui_easy2D_tableau.
Definition at line 90 of file vgui_tableau.h.
bool vgui_tableau::notify_replaced_child | ( | vgui_tableau_sptr const & | old_child, |
vgui_tableau_sptr const & | new_child | ||
) | [virtual, inherited] |
Called whenever a child of this tableau is about to be forcibly replaced.
Called when a child of this tableau is forcibly replaced.
This method is called when some part of the program (typically the parent_child_link mechanism) is about to forcibly replace a child of this tableau. The canonical reason to override this is in order to invalidate caches.
Definition at line 302 of file vgui_tableau.cxx.
int vgui_selector_tableau::num_children | ( | ) | const [inline] |
Returns the number of children.
Definition at line 104 of file vgui_selector_tableau.h.
void vgui_tableau::post_idle_request | ( | void | ) | [virtual, inherited] |
Post an idle request event.
The fact that this is virtual does not imply that you should go and override it.
Posting an idle event request means that your tableau has some idle processing that it'd like to do. This means that your tableau will continue to receive vgui_IDLE events until the event handler returns false (i.e. all idle processing is complete). The idle event handler should return false when it has no idle processing, or has completed its idle processing. It may return true if has only partially completed its idle processing; in this case, it will receive more idle event to allow it to complete processing.
Reimplemented in vgui_adaptor_tableau.
Definition at line 235 of file vgui_tableau.cxx.
void vgui_tableau::post_message | ( | char const * | msg, |
void const * | data | ||
) | [virtual, inherited] |
Post a message event.
The fact that this is virtual does not imply that you should go and override it.
Reimplemented in vgui_adaptor_tableau.
Definition at line 205 of file vgui_tableau.cxx.
void vgui_tableau::post_overlay_redraw | ( | void | ) | [virtual, inherited] |
Post an overlay-redraw event.
Post an overlay redraw event.
The fact that this is virtual does not imply that you should go and override it.
Reimplemented in vgui_adaptor_tableau.
Definition at line 225 of file vgui_tableau.cxx.
void vgui_tableau::post_redraw | ( | void | ) | [virtual, inherited] |
Post a draw event.
The fact that this is virtual does not imply that you should go and override it.
Reimplemented in vgui_adaptor_tableau.
Definition at line 215 of file vgui_tableau.cxx.
vcl_string vgui_selector_tableau::pretty_name | ( | ) | const [virtual] |
Returns a nice version of the name, including info on the children.
Reimplemented from vgui_tableau.
Definition at line 61 of file vgui_selector_tableau.cxx.
void vgui_tableau::ref | ( | ) | const [inherited] |
Increase the reference count by one (for smart pointers).
Increase the reference count by one (for smart-pointers).
"const" is for convenience, it is cast away internally.
Definition at line 79 of file vgui_tableau.cxx.
void vgui_selector_tableau::remove | ( | vgui_tableau_sptr const & | tab | ) |
Remove a tableau from the list of child tableaux.
Remove given tableau from list of child tableaux.
Definition at line 169 of file vgui_selector_tableau.cxx.
bool vgui_selector_tableau::remove | ( | const vcl_string | name | ) |
Remove a tableau from the list of child tableaux by name.
Remove given tableau from list of child tableaux.
Definition at line 177 of file vgui_selector_tableau.cxx.
bool vgui_selector_tableau::remove_child | ( | vgui_tableau_sptr const & | t | ) | [protected, virtual] |
Remove given tableau from list of child tableaux.
Reimplemented from vgui_tableau.
Definition at line 236 of file vgui_selector_tableau.cxx.
void vgui_selector_tableau::set_active | ( | const vcl_string & | name | ) |
Make the child tableau with the given name the active child.
Make the child tableau with the given position the active child.
Definition at line 270 of file vgui_selector_tableau.cxx.
bool vgui_selector_tableau::toggle | ( | const vcl_string & | name | ) |
Toggle the child tableau with the given name between visible/invisible.
Definition at line 250 of file vgui_selector_tableau.cxx.
vcl_string vgui_selector_tableau::type_name | ( | ) | const [inline, virtual] |
Returns the type of this tableau ('vgui_selector_tableau').
Reimplemented from vgui_tableau.
Definition at line 49 of file vgui_selector_tableau.h.
void vgui_tableau::unref | ( | ) | const [inherited] |
Decrease the reference count by one (for smart pointers).
Decrease the reference count by one (for smart-pointers).
"const" is for convenience, it is cast away internally. If the reference count reaches zero then delete the object.
If the reference count reaches zero then delete the object.
Definition at line 87 of file vgui_tableau.cxx.
vcl_string vgui_selector_tableau::active_child_ [protected] |
The name of the active tableau.
Definition at line 138 of file vgui_selector_tableau.h.
vcl_map<vcl_string, vgui_parent_child_link> vgui_selector_tableau::child_map_ [protected] |
A map from unique names to children.
Definition at line 135 of file vgui_selector_tableau.h.
vcl_vector<vcl_string> vgui_selector_tableau::render_order_ [protected] |
The unique child names sorted in rendering order.
Definition at line 132 of file vgui_selector_tableau.h.
vcl_map<vcl_string, bool> vgui_selector_tableau::visible_ [protected] |
Whether each child is visible or not (ie. using events).
Definition at line 129 of file vgui_selector_tableau.h.