23#include <FL/Fl_Scroll.H>
32typedef std::vector<int> Fl_Int_Vector;
131 CONTEXT_STARTPAGE = 0x01,
132 CONTEXT_ENDPAGE = 0x02,
133 CONTEXT_ROW_HEADER = 0x04,
134 CONTEXT_COL_HEADER = 0x08,
136 CONTEXT_TABLE = 0x20,
137 CONTEXT_RC_RESIZE = 0x40
158 int _redraw_rightcol;
170 Fl_Int_Vector *_colwidths;
171 Fl_Int_Vector *_rowheights;
180 TableContext _callback_context;
181 int _callback_row, _callback_col;
194 void _redraw_cell(TableContext context,
int R,
int C);
196 void _start_auto_drag();
197 void _stop_auto_drag();
198 void _auto_drag_cb();
199 static void _auto_drag_cb2(
void *d);
205 RESIZE_COL_RIGHT = 2,
206 RESIZE_ROW_ABOVE = 3,
253 void recalc_dimensions();
254 void table_resized();
255 void table_scrolled();
257 int &X,
int &Y,
int &W,
int &H);
259 TableContext cursor2rowcol(
int &R,
int &C, ResizeFlag &resizeflag);
261 int R,
int C,
int &X,
int &Y,
int &W,
int &H);
262 int row_col_clamp(
TableContext context,
int &R,
int &C);
376 int X=0,
int Y=0,
int W=0,
int H=0)
377 { (void)context; (void)R; (void)C; (void)X; (void)Y; (void)W; (void)H;}
379 long row_scroll_position(
int row);
380 long col_scroll_position(
int col);
391 void damage_zone(
int r1,
int c1,
int r2,
int c2,
int r3 = 0,
int c3 = 0);
398 if ( _redraw_toprow == -1 ) {
400 _redraw_toprow = topRow;
401 _redraw_botrow = botRow;
402 _redraw_leftcol = leftCol;
403 _redraw_rightcol = rightCol;
406 if ( topRow < _redraw_toprow ) _redraw_toprow = topRow;
407 if ( botRow > _redraw_botrow ) _redraw_botrow = botRow;
408 if ( leftCol < _redraw_leftcol ) _redraw_leftcol = leftCol;
409 if ( rightCol > _redraw_rightcol ) _redraw_rightcol = rightCol;
419 Fl_Table(
int X,
int Y,
int W,
int H, const
char *l=0);
427 virtual
void clear() {
449 return(table->
box());
452 virtual void rows(
int val);
461 virtual void cols(
int val);
510 return(_resizing_row != -1 || _resizing_col != -1);
551 return(_col_resize_min);
560 _col_resize_min = ( val < 1 ) ? 1 : val;
567 return(_row_resize_min);
576 _row_resize_min = ( val < 1 ) ? 1 : val;
617 _col_header_h = height;
626 return(_col_header_h);
633 _row_header_w = width;
642 return(_row_header_w);
649 _row_header_color = val;
657 return(_row_header_color);
664 _col_header_color = val;
672 return(_col_header_color);
675 void row_height(
int row,
int height);
678 int row_height(
int row);
680 void col_width(
int col,
int width);
683 int col_width(
int col);
690 for (
int r=0; r<rows(); r++ ) {
691 row_height(r, height);
700 for (
int c=0; c<cols(); c++ ) {
705 void row_position(
int row);
706 void col_position(
int col);
712 return(_row_position);
719 return(_col_position);
736 return(row_position());
738 int is_selected(
int r,
int c);
739 void get_selection(
int &row_top,
int &col_left,
int &row_bot,
int &col_right);
740 void set_selection(
int row_top,
int col_left,
int row_bot,
int col_right);
741 int move_cursor(
int R,
int C,
int shiftselect);
742 int move_cursor(
int R,
int C);
836 return(table->
array());
854 return(table->
child(n));
871 return(table->
find(wgt));
876 return(table->
find(wgt));
887 return(_callback_row);
896 return(_callback_col);
905 return(_callback_context);
916 _callback_context = context;
1045 return(_scrollbar_size);
1067 if ( newSize != _scrollbar_size )
redraw();
1068 _scrollbar_size = newSize;
1085 if ( val ) flags_ |= TABCELLNAV;
1086 else flags_ &= ~TABCELLNAV;
1097 return(flags_ & TABCELLNAV ? 1 : 0);
Fl_Cursor
The following constants define the mouse cursors that are available in FLTK.
Definition Enumerations.H:1261
unsigned int Fl_Color
An FLTK color value; see also Colors
Definition Enumerations.H:1101
@ FL_DAMAGE_CHILD
A child needs to be redrawn.
Definition Enumerations.H:1319
Fl_When
These constants determine when a callback is performed.
Definition Enumerations.H:426
Fl_Boxtype
FLTK standard box types.
Definition Enumerations.H:626
Fl_Group and Fl_End classes.
The Fl_Group class is the FLTK container widget.
Definition Fl_Group.H:56
void end()
Exactly the same as current(this->parent()).
Definition Fl_Group.cxx:73
int handle(int) FL_OVERRIDE
Handles the specified event.
Definition Fl_Group.cxx:145
void resize(int, int, int, int) FL_OVERRIDE
Resizes the Fl_Group widget and all of its children.
Definition Fl_Group.cxx:823
void add(Fl_Widget &)
The widget is removed from its current group (if any) and then added to the end of this group.
Definition Fl_Group.cxx:558
void draw() FL_OVERRIDE
Draws the widget.
Definition Fl_Group.cxx:926
Fl_Widget * child(int n) const
Returns array()[n].
Definition Fl_Group.H:102
void insert(Fl_Widget &, int i)
The widget is removed from its current group (if any) and then inserted into this group.
Definition Fl_Group.cxx:509
int children() const
Returns how many child widgets the group has.
Definition Fl_Group.H:98
void begin()
Sets the current group so you can build the widget tree by just constructing the widgets.
Definition Fl_Group.cxx:67
Fl_Widget *const * array() const
Returns a pointer to the array of children.
Definition Fl_Group.cxx:41
int find(const Fl_Widget *) const
Searches the child array for the widget and returns the index.
Definition Fl_Group.cxx:50
void init_sizes()
Resets the internal array of widget sizes and positions.
Definition Fl_Group.cxx:690
void remove(int index)
Removes the widget at index from the group but does not delete it.
Definition Fl_Group.cxx:583
static Fl_Group * current()
Returns the currently active group.
Definition Fl_Group.cxx:82
A table of widgets or other content.
Definition Fl_Table.H:121
void col_resize_min(int val)
Sets the current column minimum resize value.
Definition Fl_Table.H:559
int is_interactive_resize()
Returns 1 if someone is interactively resizing a row or column.
Definition Fl_Table.H:509
Fl_Widget *const * array()
Returns a pointer to the array of children.
Definition Fl_Table.H:835
int toy
Data table's outer y dimension, outside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:235
void remove(Fl_Widget &wgt)
The specified widget is removed from Fl_Table's group.
Definition Fl_Table.H:808
int wiw
Table widget's inner w dimension, inside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:242
Fl_Scroll * table
child Fl_Scroll widget container for child fltk widgets (if any)
Definition Fl_Table.H:245
int toh
Data table's outer h dimension, outside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:237
void col_width_all(int width)
Convenience method to set the width of all columns to the same value, in pixels.
Definition Fl_Table.H:699
void row_resize_min(int val)
Sets the current row minimum resize value.
Definition Fl_Table.H:575
void row_header_width(int width)
Sets the row header width to n and causes the screen to redraw.
Definition Fl_Table.H:632
void add(Fl_Widget *wgt)
The specified widget is removed from its current group (if any) and added to the end of Fl_Table's gr...
Definition Fl_Table.H:784
int current_row
selection cursor's current row (-1 if none)
Definition Fl_Table.H:218
void table_box(Fl_Boxtype val)
Sets the kind of box drawn around the data table, the default being FL_NO_BOX.
Definition Fl_Table.H:440
int select_row
extended selection row (-1 if none)
Definition Fl_Table.H:220
int botrow
bottom row# of currently visible table on screen
Definition Fl_Table.H:213
void insert(Fl_Widget &wgt, int n)
The specified widget is removed from its current group (if any) and inserted into the Fl_Table's grou...
Definition Fl_Table.H:792
virtual void draw_cell(TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0)
Subclass should override this method to handle drawing the cells.
Definition Fl_Table.H:375
int row_resize_min()
Returns the current row minimum resize value.
Definition Fl_Table.H:566
int rightcol
right column# of currently visible table on screen
Definition Fl_Table.H:215
void row_header(int flag)
Enables/disables showing the row headers.
Definition Fl_Table.H:590
int wih
Table widget's inner h dimension, inside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:243
void tab_cell_nav(int val)
Flag to control if Tab navigates table cells or not.
Definition Fl_Table.H:1084
int tiw
Data table's inner w dimension, inside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:230
int tiy
Data table's inner y dimension, inside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:229
void row_height_all(int height)
Convenience method to set the height of all rows to the same value, in pixels.
Definition Fl_Table.H:689
int tow
Data table's outer w dimension, outside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:236
int tih
Data table's inner h dimension, inside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:231
int wiy
Table widget's inner y dimension, inside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:241
int callback_col()
Returns the current column the event occurred on.
Definition Fl_Table.H:895
int leftcol
left column# of currently visible table on screen
Definition Fl_Table.H:214
void row_header_color(Fl_Color val)
Sets the row header color and causes the screen to redraw.
Definition Fl_Table.H:648
int children() const
Returns the number of children in the table.
Definition Fl_Table.H:865
int callback_row()
Returns the current row the event occurred on.
Definition Fl_Table.H:886
int row_header_width()
Returns the current row header width (in pixels).
Definition Fl_Table.H:641
TableContext callback_context()
Returns the current 'table context'.
Definition Fl_Table.H:904
void init_sizes()
Resets the internal array of widget sizes and positions.
Definition Fl_Table.H:762
void do_callback(TableContext context, int row, int col)
Calls the widget callback.
Definition Fl_Table.H:915
int col_header_height()
Gets the column header height.
Definition Fl_Table.H:625
int wix
Table widget's inner x dimension, inside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:240
TableContext
The context bit flags for Fl_Table related callbacks.
Definition Fl_Table.H:129
int col_header()
Returns if column headers are enabled or not.
Definition Fl_Table.H:599
Fl_Color row_header_color()
Returns the current row header color.
Definition Fl_Table.H:656
int cols()
Get the number of columns in the table.
Definition Fl_Table.H:466
int select_col
extended selection column (-1 if none)
Definition Fl_Table.H:221
void visible_cells(int &r1, int &r2, int &c1, int &c2)
Returns the range of row and column numbers for all visible and partially visible cells in the table.
Definition Fl_Table.H:498
void insert(Fl_Widget &wgt, Fl_Widget *w2)
The specified widget is removed from its current group (if any) and inserted into Fl_Table's group be...
Definition Fl_Table.H:801
int tab_cell_nav() const
Get state of table's 'Tab' key cell navigation flag.
Definition Fl_Table.H:1096
void top_row(int row)
Sets which row should be at the top of the table, scrolling as necessary, and the table is redrawn.
Definition Fl_Table.H:727
int table_w
table's virtual width (in pixels)
Definition Fl_Table.H:210
int toprow_scrollpos
precomputed scroll position for top row
Definition Fl_Table.H:224
int col_resize()
Returns if column resizing by the user is allowed.
Definition Fl_Table.H:533
Fl_Boxtype table_box(void)
Returns the current box type used for the data table.
Definition Fl_Table.H:448
int current_col
selection cursor's current column (-1 if none)
Definition Fl_Table.H:219
void col_header_height(int height)
Sets the height in pixels for column headers and redraws the table.
Definition Fl_Table.H:616
int row_position()
Returns the current row scroll position as a row number.
Definition Fl_Table.H:711
void row_resize(int flag)
Allows/disallows row resizing by the user.
Definition Fl_Table.H:526
int tox
Data table's outer x dimension, outside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:234
Fl_Scrollbar * vscrollbar
child vertical scrollbar widget
Definition Fl_Table.H:246
Fl_Widget * child(int n) const
Returns the child widget by an index.
Definition Fl_Table.H:853
void col_header(int flag)
Enable or disable column headers.
Definition Fl_Table.H:607
int scrollbar_size() const
Gets the current size of the scrollbars' troughs, in pixels.
Definition Fl_Table.H:1044
int leftcol_scrollpos
precomputed scroll position for left column
Definition Fl_Table.H:225
int top_row()
Returns the current top row shown in the table.
Definition Fl_Table.H:735
Fl_Color col_header_color()
Gets the color for column headers.
Definition Fl_Table.H:671
int col_resize_min()
Returns the current column minimum resize value.
Definition Fl_Table.H:550
int row_header()
Returns if row headers are enabled or not.
Definition Fl_Table.H:582
void when(Fl_When flags)
The Fl_Widget::when() function is used to set a group of flags, determining when the widget callback ...
void add(Fl_Widget &wgt)
The specified widget is removed from its current group (if any) and added to the end of Fl_Table's gr...
Definition Fl_Table.H:771
void col_header_color(Fl_Color val)
Sets the color for column headers and redraws the table.
Definition Fl_Table.H:663
int is_fltk_container()
Does the table contain any child fltk widgets?
Definition Fl_Table.H:385
int tix
Data table's inner x dimension, inside bounding box. See Table Dimension Diagram.
Definition Fl_Table.H:228
int col_position()
Returns the current column scroll position as a column number.
Definition Fl_Table.H:718
Fl_Scrollbar * hscrollbar
child horizontal scrollbar widget
Definition Fl_Table.H:247
void scrollbar_size(int newSize)
Sets the pixel size of the scrollbars' troughs to newSize, in pixels.
Definition Fl_Table.H:1066
int row_resize()
Returns if row resizing by the user is allowed.
Definition Fl_Table.H:516
int toprow
top row# of currently visible table on screen
Definition Fl_Table.H:212
void col_resize(int flag)
Allows/disallows column resizing by the user.
Definition Fl_Table.H:543
int rows()
Returns the number of rows in the table.
Definition Fl_Table.H:457
int table_h
table's virtual height (in pixels)
Definition Fl_Table.H:211
void callback(Fl_Widget *, void *)
Callbacks will be called depending on the setting of Fl_Widget::when().
void redraw_range(int topRow, int botRow, int leftCol, int rightCol)
Define region of cells to be redrawn by specified range of rows/cols, and then sets damage(DAMAGE_CHI...
Definition Fl_Table.H:397
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46