21 #include <FL/Fl_Group.H> 22 #include <FL/Fl_Scroll.H> 118 CONTEXT_STARTPAGE = 0x01,
119 CONTEXT_ENDPAGE = 0x02,
120 CONTEXT_ROW_HEADER = 0x04,
121 CONTEXT_COL_HEADER = 0x08,
123 CONTEXT_TABLE = 0x20,
124 CONTEXT_RC_RESIZE = 0x40
145 int _redraw_rightcol;
158 class FL_EXPORT IntVector {
165 void copy(
int *newarr,
unsigned int newsize);
167 IntVector() { init(); }
169 IntVector(IntVector&o) { init(); copy(o.arr, o._size); }
170 IntVector& operator=(IntVector&o) {
172 copy(o.arr, o._size);
175 int operator[](
int x)
const {
return(arr[x]); }
176 int& operator[](
int x) {
return(arr[x]); }
177 unsigned int size() {
return(_size); }
178 void size(
unsigned int count);
179 int pop_back() {
int tmp = arr[_size-1]; _size--;
return(tmp); }
180 void push_back(
int val) {
unsigned int x = _size; size(_size+1); arr[x] = val; }
181 int back() {
return(arr[_size-1]); }
184 IntVector _colwidths;
185 IntVector _rowheights;
191 int _callback_row, _callback_col;
206 void _start_auto_drag();
207 void _stop_auto_drag();
208 void _auto_drag_cb();
209 static void _auto_drag_cb2(
void *d);
215 RESIZE_COL_RIGHT = 2,
216 RESIZE_ROW_ABOVE = 3,
263 void recalc_dimensions();
264 void table_resized();
265 void table_scrolled();
267 int &X,
int &Y,
int &W,
int &H);
269 TableContext cursor2rowcol(
int &R,
int &C, ResizeFlag &resizeflag);
271 int R,
int C,
int &X,
int &Y,
int &W,
int &H);
272 int row_col_clamp(
TableContext context,
int &R,
int &C);
386 int X=0,
int Y=0,
int W=0,
int H=0)
389 long row_scroll_position(
int row);
390 long col_scroll_position(
int col);
401 void damage_zone(
int r1,
int c1,
int r2,
int c2,
int r3 = 0,
int c3 = 0);
408 if ( _redraw_toprow == -1 ) {
410 _redraw_toprow = topRow;
411 _redraw_botrow = botRow;
412 _redraw_leftcol = leftCol;
413 _redraw_rightcol = rightCol;
416 if ( topRow < _redraw_toprow ) _redraw_toprow = topRow;
417 if ( botRow > _redraw_botrow ) _redraw_botrow = botRow;
418 if ( leftCol < _redraw_leftcol ) _redraw_leftcol = leftCol;
419 if ( rightCol > _redraw_rightcol ) _redraw_rightcol = rightCol;
429 Fl_Table(
int X,
int Y,
int W,
int H,
const char *l=0);
459 return(table->
box());
462 virtual void rows(
int val);
471 virtual void cols(
int val);
520 return(_resizing_row != -1 || _resizing_col != -1);
561 return(_col_resize_min);
570 _col_resize_min = ( val < 1 ) ? 1 : val;
577 return(_row_resize_min);
586 _row_resize_min = ( val < 1 ) ? 1 : val;
627 _col_header_h = height;
636 return(_col_header_h);
643 _row_header_w = width;
652 return(_row_header_w);
659 _row_header_color = val;
667 return(_row_header_color);
674 _col_header_color = val;
682 return(_col_header_color);
685 void row_height(
int row,
int height);
691 return((row<0 || row>=(
int)_rowheights.size()) ? 0 : _rowheights[row]);
694 void col_width(
int col,
int width);
700 return((col<0 || col>=(
int)_colwidths.size()) ? 0 : _colwidths[col]);
708 for (
int r=0; r<rows(); r++ ) {
709 row_height(r, height);
718 for (
int c=0; c<cols(); c++ ) {
723 void row_position(
int row);
724 void col_position(
int col);
730 return(_row_position);
737 return(_col_position);
754 return(row_position());
756 int is_selected(
int r,
int c);
757 void get_selection(
int &row_top,
int &col_left,
int &row_bot,
int &col_right);
758 void set_selection(
int row_top,
int col_left,
int row_bot,
int col_right);
759 int move_cursor(
int R,
int C,
int shiftselect);
760 int move_cursor(
int R,
int C);
761 void resize(
int X,
int Y,
int W,
int H);
854 return(table->
array());
872 return(table->
child(n));
889 return(table->
find(wgt));
894 return(table->
find(wgt));
905 return(_callback_row);
914 return(_callback_col);
923 return(_callback_context);
934 _callback_context = context;
1063 return(_scrollbar_size);
1085 if ( newSize != _scrollbar_size ) redraw();
1086 _scrollbar_size = newSize;
1103 if ( val ) flags_ |= TABCELLNAV;
1104 else flags_ &= ~TABCELLNAV;
1115 return(flags_ & TABCELLNAV ? 1 : 0);
void col_resize(int flag)
Allows/disallows column resizing by the user.
Definition: Fl_Table.H:553
int row_resize_min()
Returns the current row minimum resize value.
Definition: Fl_Table.H:576
int tiy
Data table's inner y dimension, inside bounding box. See Table Dimension Diagram. ...
Definition: Fl_Table.H:239
A table of widgets or other content.
Definition: Fl_Table.H:108
Fl_Boxtype table_box(void)
Returns the current box type used for the data table.
Definition: Fl_Table.H:458
int tow
Data table's outer w dimension, outside bounding box. See Table Dimension Diagram.
Definition: Fl_Table.H:246
Fl_Cursor
The following constants define the mouse cursors that are available in FLTK.
Definition: Enumerations.H:1156
int rows()
Returns the number of rows in the table.
Definition: Fl_Table.H:467
int row_header()
Returns if row headers are enabled or not.
Definition: Fl_Table.H:592
int col_header_height()
Gets the column header height.
Definition: Fl_Table.H:635
Fl_Widget *const * array()
Returns a pointer to the array of children.
Definition: Fl_Table.H:853
int callback_col()
Returns the current column the event occurred on.
Definition: Fl_Table.H:913
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:450
void col_header_height(int height)
Sets the height in pixels for column headers and redraws the table.
Definition: Fl_Table.H:626
Fl_Widget * child(int n) const
Returns the child widget by an index.
Definition: Fl_Table.H:871
virtual void clear()
Clears the table to zero rows (rows(0)), zero columns (cols(0)), and clears any widgets (table->clear...
Definition: Fl_Table.H:437
int col_header()
Returns if column headers are enabled or not.
Definition: Fl_Table.H:609
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:717
void remove(int index)
Removes the widget at index from the group but does not delete it.
Definition: Fl_Group.cxx:509
int toh
Data table's outer h dimension, outside bounding box. See Table Dimension Diagram.
Definition: Fl_Table.H:247
Fl_When
These constants determine when a callback is performed.
Definition: Enumerations.H:421
int wiw
Table widget's inner w dimension, inside bounding box. See Table Dimension Diagram.
Definition: Fl_Table.H:252
int leftcol
left column# of currently visible table on screen
Definition: Fl_Table.H:224
int find(const Fl_Widget *) const
Searches the child array for the widget and returns the index.
Definition: Fl_Group.cxx:49
Fl_Color row_header_color()
Returns the current row header color.
Definition: Fl_Table.H:666
void init_sizes()
Resets the internal array of widget sizes and positions.
Definition: Fl_Table.H:780
int children() const
Returns how many child widgets the group has.
Definition: Fl_Group.H:81
void init_sizes()
Resets the internal array of widget sizes and positions.
Definition: Fl_Group.cxx:567
TableContext
The context bit flags for Fl_Table related callbacks.
Definition: Fl_Table.H:116
int tih
Data table's inner h dimension, inside bounding box. See Table Dimension Diagram. ...
Definition: Fl_Table.H:241
int children() const
Returns the number of children in the table.
Definition: Fl_Table.H:883
void end()
Exactly the same as current(this->parent()).
Definition: Fl_Group.cxx:72
void row_resize_min(int val)
Sets the current row minimum resize value.
Definition: Fl_Table.H:585
A child needs to be redrawn.
Definition: Enumerations.H:1214
Fl_Color col_header_color()
Gets the color for column headers.
Definition: Fl_Table.H:681
int toy
Data table's outer y dimension, outside bounding box. See Table Dimension Diagram.
Definition: Fl_Table.H:245
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:508
int tox
Data table's outer x dimension, outside bounding box. See Table Dimension Diagram.
Definition: Fl_Table.H:244
Fl_Boxtype
FLTK standard box types.
Definition: Enumerations.H:598
int cols()
Get the number of columns in the table.
Definition: Fl_Table.H:476
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:707
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:464
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:407
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:42
int wih
Table widget's inner h dimension, inside bounding box. See Table Dimension Diagram.
Definition: Fl_Table.H:253
int table_w
table's virtual width (in pixels)
Definition: Fl_Table.H:220
int is_interactive_resize()
Returns 1 if someone is interactively resizing a row or column.
Definition: Fl_Table.H:519
int toprow
top row# of currently visible table on screen
Definition: Fl_Table.H:222
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:497
int select_row
extended selection row (-1 if none)
Definition: Fl_Table.H:230
void tab_cell_nav(int val)
Flag to control if Tab navigates table cells or not.
Definition: Fl_Table.H:1102
void row_header_color(Fl_Color val)
Sets the row header color and causes the screen to redraw.
Definition: Fl_Table.H:658
int col_width(int col)
Returns the current width of the specified column in pixels.
Definition: Fl_Table.H:699
int row_position()
Returns the current row scroll position as a row number.
Definition: Fl_Table.H:729
void begin()
Sets the current group so you can build the widget tree by just constructing the widgets.
Definition: Fl_Group.cxx:66
void col_header(int flag)
Enable or disable column headers.
Definition: Fl_Table.H:617
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:789
int current_row
selection cursor's current row (-1 if none)
Definition: Fl_Table.H:228
void row_resize(int flag)
Allows/disallows row resizing by the user.
Definition: Fl_Table.H:536
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:385
int col_resize()
Returns if column resizing by the user is allowed.
Definition: Fl_Table.H:543
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:745
int current_col
selection cursor's current column (-1 if none)
Definition: Fl_Table.H:229
int rightcol
right column# of currently visible table on screen
Definition: Fl_Table.H:225
int table_h
table's virtual height (in pixels)
Definition: Fl_Table.H:221
int row_height(int row)
Returns the current height of the specified row as a value in pixels.
Definition: Fl_Table.H:690
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:810
void col_header_color(Fl_Color val)
Sets the color for column headers and redraws the table.
Definition: Fl_Table.H:673
int is_fltk_container()
Does the table contain any child fltk widgets?
Definition: Fl_Table.H:395
int top_row()
Returns the current top row shown in the table.
Definition: Fl_Table.H:753
int toprow_scrollpos
precomputed scroll position for top row
Definition: Fl_Table.H:234
int scrollbar_size() const
Gets the current size of the scrollbars' troughs, in pixels.
Definition: Fl_Table.H:1062
Fl_Scrollbar * vscrollbar
child vertical scrollbar widget
Definition: Fl_Table.H:256
Fl_Widget *const * array() const
Returns a pointer to the array of children.
Definition: Fl_Group.cxx:40
int row_header_width()
Returns the current row header width (in pixels).
Definition: Fl_Table.H:651
void col_resize_min(int val)
Sets the current column minimum resize value.
Definition: Fl_Table.H:569
int tiw
Data table's inner w dimension, inside bounding box. See Table Dimension Diagram. ...
Definition: Fl_Table.H:240
int select_col
extended selection column (-1 if none)
Definition: Fl_Table.H:231
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition: Enumerations.H:1042
int tab_cell_nav() const
Get state of table's 'Tab' key cell navigation flag.
Definition: Fl_Table.H:1114
int wiy
Table widget's inner y dimension, inside bounding box. See Table Dimension Diagram.
Definition: Fl_Table.H:251
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:802
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:819
void scrollbar_size(int newSize)
Sets the pixel size of the scrollbars' troughs to newSize, in pixels.
Definition: Fl_Table.H:1084
int callback_row()
Returns the current row the event occurred on.
Definition: Fl_Table.H:904
int col_resize_min()
Returns the current column minimum resize value.
Definition: Fl_Table.H:560
int row_resize()
Returns if row resizing by the user is allowed.
Definition: Fl_Table.H:526
Fl_Scroll * table
child Fl_Scroll widget container for child fltk widgets (if any)
Definition: Fl_Table.H:255
int wix
Table widget's inner x dimension, inside bounding box. See Table Dimension Diagram.
Definition: Fl_Table.H:250
int botrow
bottom row# of currently visible table on screen
Definition: Fl_Table.H:223
int col_position()
Returns the current column scroll position as a column number.
Definition: Fl_Table.H:736
void do_callback(TableContext context, int row, int col)
Calls the widget callback.
Definition: Fl_Table.H:933
int tix
Data table's inner x dimension, inside bounding box. See Table Dimension Diagram. ...
Definition: Fl_Table.H:238
int leftcol_scrollpos
precomputed scroll position for left column
Definition: Fl_Table.H:235
TableContext callback_context()
Returns the current 'table context'.
Definition: Fl_Table.H:922
Fl_Widget * child(int n) const
Returns array()[n].
Definition: Fl_Group.H:85
void row_header_width(int width)
Sets the row header width to n and causes the screen to redraw.
Definition: Fl_Table.H:642
static Fl_Group * current()
Returns the currently active group.
Definition: Fl_Group.cxx:81
Fl_Scrollbar * hscrollbar
child horizontal scrollbar widget
Definition: Fl_Table.H:257
void row_header(int flag)
Enables/disables showing the row headers.
Definition: Fl_Table.H:600