#include <vgui_grid_tableau.h>
Inheritance diagram for vgui_grid_tableau:

It is derived from vgui_poly_tableau but unlike vgui_poly_tablea, the child tableaux of vgui_grid_tableau can only be laid out in an m by n rectangular grid. Rows and columns are numbered starting from 0 with (0,0) in the top left and (m-1,n-1) in the bottom right.
The default behaviour of vgui_grid is to keep a list of every tableau added to the grid (using add_next to add to the next free position or add_at to add at a specific grid position). Users can flip through this list of tableaux, 'tabs', by clicking in the grid position they wish to change, and using PageUp and PageDown to go through the list. When a new tableau is added using add_at the old tableau at that position is kept in the 'tabs' list and can still be viewed by using PageUp and PageDown. Each grid position provides a view of the deck of tableaux kept in 'tabs'. A tableau will only be removed from 'tabs' by using remove_at.
By default, the user can make the grid larger or smaller by using (CTRL) + and - to add and remove (rows and) columns.
These default behaviours can be changed using set_uses_paging_events and set_grid_size_changeable. This stops vgui_grid using the events, but still passes them down to the child tableaux. By disabling PageUp and PageDown you can prevent users from changing the displayed tableau - this could also be useful if you want to show two vgui_deck tableau and so want the PageUp and PageDown events to pass through vgui_grid and be used by the child decks. Disabling plus and minus events gives a grid tableau of fixed size.
This tableau was originally written for xcv, so look at this application to get a better idea what it does.
Definition at line 70 of file vgui_grid_tableau.h.
Public Types | |
| typedef vgui_grid_tableau_data | grid_data |
| typedef vcl_vector< item > | container |
| typedef container::iterator | iterator |
| typedef container::const_iterator | const_iterator |
Public Member Functions | |
| vcl_string | type_name () const |
| Returns the type name of the tableau ("vgui_grid_tableau" in this case). | |
| vgui_grid_tableau (unsigned initial_columns=1, unsigned initial_rows=1) | |
| Constructor - don't use this, use vgui_grid_tableau_new. | |
| vgui_grid_tableau (vgui_tableau_sptr const &l, vgui_tableau_sptr const &r) | |
| Constructor - don't use this, use vgui_grid_tableau_new. | |
| vgui_grid_tableau (vgui_tableau_sptr const &l, vgui_tableau_sptr const &m, vgui_tableau_sptr const &r) | |
| Constructor - don't use this, use vgui_grid_tableau_new. | |
| float | get_x (unsigned index) |
| Given the column number, returns the x coord for that column. | |
| float | get_y (unsigned index) |
| Given the row number, returns the y coord for that row. | |
| float | get_w () |
| Get the width of each column. | |
| float | get_h () |
| Get the height of each row. | |
| void | add_next (vgui_tableau_sptr const &tab) |
| Adds a tableau to the next free space in the grid and the list of tableaux. | |
| void | add_next (vgui_tableau_sptr const &tab, unsigned &col, unsigned &row) |
| Adds a tableau to the next free space and returns the grid location. | |
| void | add_at (vgui_tableau_sptr const &tab, unsigned col_pos, unsigned row_pos) |
| Add (or replace the tableau at the given position with) the given tableau. | |
| void | remove_at (unsigned col_pos, unsigned row_pos) |
| Removes the tableau at the given grid coordinates from the display. | |
| unsigned | rows () const |
| Returns the number of rows in the grid. | |
| unsigned | cols () const |
| Returns the number of columns in the grid. | |
| vgui_tableau_sptr | get_tableau_at (unsigned col_pos, unsigned row_pos) |
| Returns a pointer to the tableau at the given position. | |
| vcl_vector< vgui_tableau_sptr > | get_tableau_list () |
| Returns the list of tableaux. | |
| void | get_active_position (unsigned *col_pos, unsigned *row_pos) |
| Returns the active tableau, this is the tableau with the mouse in. | |
| void | get_last_selected_position (unsigned *col_pos, unsigned *row_pos) |
| Returns the most recently selected column and row positions. | |
| int | get_selected_positions (vcl_vector< int > *col_pos, vcl_vector< int > *row_pos, vcl_vector< int > *times) |
| Gets the positions and times of selection of the selected tableaux. | |
| void | set_selected (int r, int c, bool onoff=true) |
| Select a certain tableau. | |
| void | set_grid_size_changeable (bool v) |
| True to allow the grid size to change, false to have fixed size. | |
| void | set_uses_paging_events (bool v) |
| True to use paging events, false to ignore them. | |
| void | set_frames_selectable (bool v) |
| True to use mouse down events, false to ignore them. | |
| void | set_unique_selected (bool u) |
| Only allow one grid cell to be selected at a time, others are deselected. | |
| void | emulate_ntab () |
| Use this to emulate the deprecated bitab and tritab:. | |
| void | layout_grid () |
| Redraw the grid keeping each tableau in its current row and column. | |
| void | layout_grid2 () |
| Redraw the grid of tableaux packing them in without gaps. | |
| void | add_column () |
| Add an empty column to the RHS of the grid. | |
| void | remove_column () |
| Remove last column on RHS of the grid. | |
| void | add_row () |
| Add an empty row to the bottom of the grid. | |
| void | remove_row () |
| Remove last row on the bottom of the grid. | |
| void | page_up () |
| Flip forwards through the list of tableaux. | |
| void | page_down () |
| Flip backwards through the list of tableaux. | |
| bool | handle (const vgui_event &) |
| Handle any events matching the {vgui_event_condition}s. | |
| bool | cell_bounding_box (unsigned col, unsigned row, float &xmin, float &ymin, float &xmax, float &ymax) |
| Window coordinates of the cell bounding box at col, row. | |
| void | get_popup (vgui_popup_params const &, vgui_menu &) |
| Get popup menu. | |
| unsigned | size () const |
| Returns the number of items in the list of items. | |
| iterator | begin () |
| Return an iterator pointing to the first item in the list of items. | |
| const_iterator | begin () const |
| Return a const iterator pointing to the first item in the list of items. | |
| iterator | end () |
| Return an iterator pointing to the last item in the list of items. | |
| const_iterator | end () const |
| Return a const iterator pointing to the last item in the list of items. | |
| void | erase (iterator) |
| Erase the item at the given position from the list of items. | |
| int | add (vgui_tableau_sptr const &, float x, float y, float w, float h) |
| Adds the given tableau to the given proportion of the viewport. | |
| void | remove (int id) |
| Remove subtableau, referred to by handle. | |
| void | move (int id, float x, float y, float w, float h) |
| Move subtableau to a new location. | |
| void | replace (int id, vgui_tableau_sptr const &tab) |
| Replace the tableau with the given ID, with the given tableau. | |
| vgui_tableau_sptr | get (int id) const |
| Get pointer to tableau from id. | |
| void | set_outline_color (const int id, const int r, const int g, const int b) |
| Set color to outline tableau. | |
| virtual vcl_string | name () const |
| Return the name of the tableau. | |
| virtual vcl_string | file_name () const |
| Return the name of a file associated with some tableau below (if meaningful). | |
| virtual vcl_string | pretty_name () const |
| Used to provide an informative name for printouts, debugging etc. | |
| 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 | add_child (vgui_tableau_sptr const &) |
| Add the given tableau to the list of child tableaux. | |
| virtual bool | remove_child (vgui_tableau_sptr const &) |
| Remove the given child from the list of child tableaux. | |
| 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 a overlay-redraw event. | |
| virtual void | post_idle_request () |
| Post an idle request event. | |
| virtual bool | get_bounding_box (float low[3], float high[3]) const |
| Get the bounding box of this tableau. | |
| 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 | |
| ~vgui_grid_tableau () | |
| Destructor - called by vgui_grid_tableau_sptr. | |
| bool | handle (GLint const vp[4], vgui_event const &e) |
| Handles events for this tableau and passes unused ones to the correct child. | |
| int | get_active (GLint const vp[4], int wx, int wy) const |
| Misnomer - returns the index of child under the pointer's position. | |
| int | get_current () const |
| int | get_current_id () |
| Returns the ID of the current child. | |
| void | set_current (GLint const vp[4], int index) |
| Sets the child under the pointer to current. | |
Protected Attributes | |
| int | current |
| Index of the item currently getting events. | |
| vcl_vector< item > | sub |
| List of items displayed by this tableau. | |
| bool | may_switch_child |
Private Member Functions | |
| void | init (unsigned initial_cols, unsigned initial_rows) |
| Initialisation called by all constructors. | |
| void | add_default (unsigned col_pos, unsigned row_pos) |
| Adds the default tableau to the given space in the grid. | |
| void | select_current (int time) |
| Make the current tableau selected by saving the current time. | |
| void | deselect_current () |
| Mark the current table as deselected by setting the time to -1. | |
Private Attributes | |
| vgui_event_condition | cond_row_add |
| vgui_event_condition | cond_row_remove |
| vgui_event_condition | cond_col_add |
| vgui_event_condition | cond_col_remove |
| vgui_event_condition | cond_flip_fwd |
| vgui_event_condition | cond_flip_bwd |
| vgui_event_condition | cond_select |
| vgui_event_condition | cond_deselect |
| int | INCREMENT_COLS |
| int | INCREMENT_ROWS |
| bool | grid_size_changeable |
| unsigned | nb_cols |
| unsigned | max_cols |
| unsigned | nb_rows |
| unsigned | max_rows |
| unsigned | last_selected [2] |
| bool | unique_selected_ |
| vgui_tableau_sptr | default_tab |
| vcl_vector< vgui_tableau_sptr > | tabs |
| vbl_array_2d< grid_data > | grid_pos |
|
|
Definition at line 107 of file vgui_poly_tableau.h. |
|
|
Definition at line 105 of file vgui_poly_tableau.h. |
|
|
Definition at line 73 of file vgui_grid_tableau.h. |
|
|
Definition at line 106 of file vgui_poly_tableau.h. |
|
||||||||||||
|
Constructor - don't use this, use vgui_grid_tableau_new. Takes the initial number of columns and rows. Definition at line 80 of file vgui_grid_tableau.h. |
|
||||||||||||
|
Constructor - don't use this, use vgui_grid_tableau_new. This creates a bi-tab, taking the two tableaux as parameters. Definition at line 64 of file vgui_grid_tableau.cxx. |
|
||||||||||||||||
|
Constructor - don't use this, use vgui_grid_tableau_new. This creates a tri-tab, taking the three tableau as parameters. Definition at line 73 of file vgui_grid_tableau.cxx. |
|
|
Destructor - called by vgui_grid_tableau_sptr.
Definition at line 206 of file vgui_grid_tableau.h. |
|
||||||||||||||||||||||||
|
Adds the given tableau to the given proportion of the viewport. x,y,w,h specify a portion of the vgui_poly_tableau's viewport in coordinates which go from 0 to 1. Returns handle to child. Definition at line 176 of file vgui_poly_tableau.cxx. |
|
||||||||||||||||
|
Add (or replace the tableau at the given position with) the given tableau. Adds the given tableau to the end of the vcl_list of tableaux. Definition at line 200 of file vgui_grid_tableau.cxx. |
|
|
Add the given tableau to the list of child tableaux. Virtual overridden by consenting parents. Reimplemented in vgui_composite_tableau, vgui_deck_tableau, and vgui_wrapper_tableau. Definition at line 283 of file vgui_tableau.cxx. |
|
|
Add an empty column to the RHS of the grid.
Definition at line 424 of file vgui_grid_tableau.cxx. |
|
||||||||||||
|
Adds the default tableau to the given space in the grid. (but not to the vcl_list of tableaux). Definition at line 123 of file vgui_grid_tableau.cxx. |
|
||||||||||||||||
|
Adds a tableau to the next free space and returns the grid location. If there are no free spaces and the grid size is changeable then it adds a new column to the RHS of the grid and adds the new tableau to the top of it. Definition at line 140 of file vgui_grid_tableau.cxx. |
|
|
Adds a tableau to the next free space in the grid and the list of tableaux.
Definition at line 191 of file vgui_grid_tableau.cxx. |
|
|
Add the given menu to the popup menu for the tableau. 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_active_tableau, vgui_clear_tableau, and vgui_satellite_tableau_t< object, data >. Definition at line 315 of file vgui_tableau.cxx. |
|
|
Add an empty row to the bottom of the grid.
Definition at line 463 of file vgui_grid_tableau.cxx. |
|
|
Return a const iterator pointing to the first item in the list of items.
Definition at line 116 of file vgui_poly_tableau.h. |
|
|
Return an iterator pointing to the first item in the list of items.
Definition at line 113 of file vgui_poly_tableau.h. |
|
||||||||||||||||||||||||||||
|
Window coordinates of the cell bounding box at col, row. The computation is based on dividing the entire viewport by the number of row and columns. Definition at line 282 of file vgui_grid_tableau.cxx. |
|
|
Returns the number of columns in the grid.
Definition at line 120 of file vgui_grid_tableau.h. |
|
|
Mark the current table as deselected by setting the time to -1. Set the outline color to white. Definition at line 595 of file vgui_grid_tableau.cxx. |
|
|
Called by default handle when it receives a draw event.
Reimplemented in vgui_function_tableau. Definition at line 175 of file vgui_tableau.cxx. |
|
|
Use this to emulate the deprecated bitab and tritab:.
Definition at line 166 of file vgui_grid_tableau.h. |
|
|
Return a const iterator pointing to the last item in the list of items.
Definition at line 122 of file vgui_poly_tableau.h. |
|
|
Return an iterator pointing to the last item in the list of items.
Definition at line 119 of file vgui_poly_tableau.h. |
|
|
Erase the item at the given position from the list of items.
Definition at line 93 of file vgui_poly_tableau.cxx. |
|
|
Returns true if the given address points to a valid tableau.
Definition at line 384 of file vgui_tableau.cxx. |
|
|
Return the name of a file associated with some tableau below (if meaningful).
Reimplemented in vgui_blender_tableau, vgui_composite_tableau, vgui_deck_tableau, vgui_easy2D_tableau, vgui_enhance_tableau, vgui_image_tableau, vgui_roi_tableau, vgui_wrapper_tableau, and vgui_vrml_tableau. Definition at line 92 of file vgui_tableau.h. |
|
|
Get pointer to tableau from id.
Definition at line 150 of file vgui_poly_tableau.cxx. |
|
||||||||||||||||
|
Misnomer - returns the index of child under the pointer's position.
Definition at line 195 of file vgui_poly_tableau.cxx. |
|
||||||||||||
|
Returns the active tableau, this is the tableau with the mouse in. Note that there is only one active tableau, while there may be many selected tableaux. Definition at line 301 of file vgui_grid_tableau.cxx. |
|
|
Push all tableaux onto the given vector.
Definition at line 375 of file vgui_tableau.cxx. |
|
||||||||||||
|
Get the bounding box of this tableau. If infinite in extent, or nothing is drawn, or you can't be bothered to implement it, return false. const. if you need to cache, cast away const. Reimplemented in vgui_composite_tableau, vgui_image_tableau, vgui_roi_tableau, and vgui_wrapper_tableau. Definition at line 197 of file vgui_tableau.cxx. |
|
|
Get the ith child or return 0.
Definition at line 273 of file vgui_tableau.cxx. |
|
|
Get the child tableaux for this tableau.
Definition at line 266 of file vgui_tableau.cxx. |
|
|
Definition at line 163 of file vgui_poly_tableau.h. |
|
|
Returns the ID of the current child.
Definition at line 206 of file vgui_poly_tableau.cxx. |
|
|
Get the height of each row.
Definition at line 117 of file vgui_grid_tableau.cxx. |
|
||||||||||||
|
Returns the most recently selected column and row positions.
Definition at line 329 of file vgui_grid_tableau.cxx. |
|
|
Get the parent tableaux for this tableau.
Definition at line 259 of file vgui_tableau.cxx. |
|
||||||||||||
|
Get popup menu.
Reimplemented from vgui_tableau. Definition at line 368 of file vgui_poly_tableau.cxx. |
|
||||||||||||||||
|
Gets the positions and times of selection of the selected tableaux. The number of selected tableau is returned. Their positions are returned in the vcl_vectors passed in as parameters. Note, a tableau is selected if it has been clicked on by the left mouse button. It can be deselected by clicking with the middle mouse button. Definition at line 355 of file vgui_grid_tableau.cxx. |
|
||||||||||||
|
Returns a pointer to the tableau at the given position.
Definition at line 261 of file vgui_grid_tableau.cxx. |
|
|
Returns the list of tableaux.
Definition at line 126 of file vgui_grid_tableau.h. |
|
|
Get the width of each column.
Definition at line 113 of file vgui_grid_tableau.cxx. |
|
|
Given the column number, returns the x coord for that column. Note col_pos is numbered from 0. Definition at line 84 of file vgui_grid_tableau.cxx. |
|
|
Given the row number, returns the y coord for that row. Note row_pos is numbered from 0. Note that poly_tableau coord system starts in the bottom left and we want rows to be numbered from the top down. Definition at line 100 of file vgui_grid_tableau.cxx. |
|
||||||||||||
|
Handles events for this tableau and passes unused ones to the correct child.
Definition at line 241 of file vgui_poly_tableau.cxx. |
|
|
Handle any events matching the {vgui_event_condition}s. All other events go to the base class. Reimplemented from vgui_poly_tableau. Definition at line 610 of file vgui_grid_tableau.cxx. |
|
|
Called by default handle when it receives a '?' pressed event.
Reimplemented in vgui_composite_tableau, vgui_deck_tableau, vgui_function_tableau, vgui_listmanager2D_tableau, vgui_viewer2D_tableau, and vgui_viewer3D_tableau. Definition at line 165 of file vgui_tableau.cxx. |
|
|
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 184 of file vgui_tableau.cxx. |
|
||||||||||||
|
Initialisation called by all constructors.
Definition at line 24 of file vgui_grid_tableau.cxx. |
|
||||||||||||||||||||
|
Called by default handle when it receives a key-press event.
Reimplemented in vgui_deck_tableau, vgui_function_tableau, vgui_listmanager2D_tableau, vgui_viewer2D_tableau, and vgui_viewer3D_tableau. Definition at line 155 of file vgui_tableau.cxx. |
|
|
Redraw the grid keeping each tableau in its current row and column. If for example a new column had been added, using this would redraw the grid with that column empty. Definition at line 379 of file vgui_grid_tableau.cxx. |
|
|
Redraw the grid of tableaux packing them in without gaps. Fill each row from top left downwards. Definition at line 395 of file vgui_grid_tableau.cxx. |
|
||||||||||||
|
Called by handle when it receives a mouse motion event.
Reimplemented in vgui_displaylist2D_tableau, vgui_function_tableau, and vgui_listmanager2D_tableau. Definition at line 145 of file vgui_tableau.cxx. |
|