2009-11-14 16:05:37 +03:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// Fl_Table -- A table widget for the Fast Light Tool Kit (FLTK).
|
2009-11-14 16:05:37 +03:00
|
|
|
//
|
|
|
|
// Copyright 2002 by Greg Ercolano.
|
|
|
|
// Copyright (c) 2004 O'ksi'D
|
2023-10-22 20:30:37 +03:00
|
|
|
// Copyright 2023 by Bill Spitzak and others.
|
2009-11-14 16:05:37 +03:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
2020-04-20 14:30:48 +03:00
|
|
|
// https://www.fltk.org/COPYING.php
|
2011-07-19 08:49:30 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2011-07-19 08:49:30 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/bugs.php
|
2011-07-19 08:49:30 +04:00
|
|
|
//
|
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
#ifndef _FL_TABLE_H
|
|
|
|
#define _FL_TABLE_H
|
|
|
|
|
|
|
|
#include <FL/Fl_Group.H>
|
|
|
|
#include <FL/Fl_Scroll.H>
|
2023-10-22 20:30:37 +03:00
|
|
|
|
|
|
|
// EXPERIMENTAL
|
|
|
|
// We use either std::vector or the private class Fl_Int_Vector
|
|
|
|
// depending on the build option OPTION_USE_STD or --enable-use_std.
|
|
|
|
// This option allows to use std::string and std::vector in FLTK 1.4.x
|
|
|
|
|
|
|
|
#if (FLTK_USE_STD)
|
|
|
|
#include <vector>
|
|
|
|
typedef std::vector<int> Fl_Int_Vector;
|
|
|
|
#else
|
|
|
|
class Fl_Int_Vector; // private class declared in src/Fl_Int_Vector.H
|
|
|
|
#endif
|
2009-11-14 16:05:37 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
A table of widgets or other content.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
This is the base class for table widgets.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
To be useful it must be subclassed and several virtual functions defined.
|
2020-07-01 19:03:10 +03:00
|
|
|
Normally applications use widgets derived from this widget, and do not use this
|
|
|
|
widget directly; this widget is usually too low level to be used directly by
|
2017-04-26 23:12:34 +03:00
|
|
|
applications.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
This widget does \em not handle the data in the table. The draw_cell()
|
2020-07-01 19:03:10 +03:00
|
|
|
method must be overridden by a subclass to manage drawing the contents of
|
2017-04-26 23:12:34 +03:00
|
|
|
the cells.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
This widget can be used in several ways:
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
- As a custom widget; see examples/table-simple.cxx and test/table.cxx.
|
|
|
|
Very optimal for even extremely large tables.
|
|
|
|
- As a table made up of a single FLTK widget instanced all over the table,
|
|
|
|
simulating a numeric spreadsheet. See examples/table-spreadsheet.cxx and
|
|
|
|
examples/table-spreadsheet-with-keyboard-nav.cxx. Optimal for large tables.
|
|
|
|
- As a regular container of FLTK widgets, one widget per cell.
|
|
|
|
See examples/table-as-container.cxx. \em Not recommended for large tables.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
\image html table-simple.png
|
|
|
|
\image latex table-simple.png "table-simple example" width=6cm
|
2010-12-05 12:50:59 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
\image html table-as-container.png
|
|
|
|
\image latex table-as-container.png "table-as-container example" width=6cm
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
When acting as part of a custom widget, events on the cells and/or headings
|
2020-07-01 19:03:10 +03:00
|
|
|
generate callbacks when they are clicked by the user. You control when events
|
2017-04-26 23:12:34 +03:00
|
|
|
are generated based on the setting for Fl_Table::when().
|
2020-07-01 19:03:10 +03:00
|
|
|
|
|
|
|
When acting as a container for FLTK widgets, the FLTK widgets maintain
|
|
|
|
themselves. Although the draw_cell() method must be overridden, its contents
|
2017-04-26 23:12:34 +03:00
|
|
|
can be very simple. See the draw_cell() code in examples/table-simple.cxx.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
The following variables are available to classes deriving from Fl_Table:
|
2020-07-01 19:03:10 +03:00
|
|
|
|
|
|
|
\anchor table_dimensions_diagram
|
2017-04-26 23:12:34 +03:00
|
|
|
\image html table-dimensions.png
|
|
|
|
\image latex table-dimensions.png "Fl_Table Dimensions" width=6cm
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
<table border=0>
|
|
|
|
<tr><td>x()/y()/w()/h()</td>
|
2020-07-01 19:03:10 +03:00
|
|
|
<td>Fl_Table widget's outer dimension. The outer edge of the border of the
|
2017-04-26 23:12:34 +03:00
|
|
|
Fl_Table. (Red in the diagram above)</td></tr>
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
<tr><td>wix/wiy/wiw/wih</td>
|
2020-07-01 19:03:10 +03:00
|
|
|
<td>Fl_Table widget's inner dimension. The inner edge of the border of the
|
|
|
|
Fl_Table. eg. if the Fl_Table's box() is FL_NO_BOX, these values are the same
|
2017-04-26 23:12:34 +03:00
|
|
|
as x()/y()/w()/h(). (Yellow in the diagram above)</td></tr>
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
<tr><td>tox/toy/tow/toh</td>
|
|
|
|
<td>The table's outer dimension. The outer edge of the border around the cells,
|
|
|
|
but inside the row/col headings and scrollbars. (Green in the diagram above)
|
|
|
|
</td></tr>
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
<tr><td>tix/tiy/tiw/tih</td>
|
|
|
|
<td>The table's inner dimension. The inner edge of the border around the cells,
|
2020-07-01 19:03:10 +03:00
|
|
|
but inside the row/col headings and scrollbars. AKA the table's clip region.
|
2017-04-26 23:12:34 +03:00
|
|
|
eg. if the table_box() is FL_NO_BOX, these values are the same as
|
|
|
|
tox/toy/tow/toh. (Blue in the diagram above)
|
|
|
|
</td></tr></table>
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
CORE DEVELOPERS
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
- Greg Ercolano : 12/16/2002 - initial implementation 12/16/02. Fl_Table, Fl_Table_Row, docs.
|
|
|
|
- Jean-Marc Lienher : 02/22/2004 - added keyboard nav + mouse selection, and ported Fl_Table into fltk-utf8-1.1.4
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
OTHER CONTRIBUTORS
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
- Inspired by the Feb 2000 version of FLVW's Flvw_Table widget. Mucho thanks to those folks.
|
|
|
|
- Mister Satan : 04/07/2003 - MinGW porting mods, and singleinput.cxx; a cool Fl_Input oriented spreadsheet example
|
|
|
|
- Marek Paliwoda : 01/08/2003 - Porting mods for Borland
|
|
|
|
- Ori Berger : 03/16/2006 - Optimizations for >500k rows/cols
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
LICENSE
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
Greg kindly gave his permission to integrate Fl_Table and Fl_Table_Row
|
|
|
|
into FLTK, allowing FLTK license to apply while his widgets are part
|
|
|
|
of the library. [updated by Greg, 04/26/17]
|
|
|
|
*/
|
2010-12-13 02:21:03 +03:00
|
|
|
class FL_EXPORT Fl_Table : public Fl_Group {
|
2009-11-14 16:05:37 +03:00
|
|
|
public:
|
2010-10-26 13:41:47 +04:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
The context bit flags for Fl_Table related callbacks.
|
2015-07-19 02:59:54 +03:00
|
|
|
|
2017-04-27 04:40:21 +03:00
|
|
|
Should be used in draw_cell() to determine what's being drawn,
|
|
|
|
or in a callback() to determine where a recent event occurred.
|
2017-04-26 23:12:34 +03:00
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
enum TableContext {
|
2020-07-01 19:03:10 +03:00
|
|
|
CONTEXT_NONE = 0, ///< no known context
|
|
|
|
CONTEXT_STARTPAGE = 0x01, ///< before the table is redrawn
|
|
|
|
CONTEXT_ENDPAGE = 0x02, ///< after the table is redrawn
|
|
|
|
CONTEXT_ROW_HEADER = 0x04, ///< drawing or event occurred in the row header
|
|
|
|
CONTEXT_COL_HEADER = 0x08, ///< drawing or event occurred in the col header
|
|
|
|
CONTEXT_CELL = 0x10, ///< drawing or event occurred in a cell
|
|
|
|
CONTEXT_TABLE = 0x20, ///< drawing or event occurred in a dead zone of table
|
|
|
|
CONTEXT_RC_RESIZE = 0x40 ///< column or row is being resized
|
2009-11-14 16:05:37 +03:00
|
|
|
};
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
private:
|
2020-07-01 19:03:10 +03:00
|
|
|
int _rows, _cols; // total rows/cols
|
|
|
|
int _row_header_w; // width of row header
|
|
|
|
int _col_header_h; // height of column header
|
|
|
|
int _row_position; // last row_position set (not necessarily == toprow!)
|
|
|
|
int _col_position; // last col_position set (not necessarily == leftcol!)
|
|
|
|
|
|
|
|
char _row_header; // row header enabled?
|
|
|
|
char _col_header; // col header enabled?
|
|
|
|
char _row_resize; // row resizing enabled?
|
|
|
|
char _col_resize; // col resizing enabled?
|
|
|
|
int _row_resize_min; // row minimum resizing height (default=1)
|
|
|
|
int _col_resize_min; // col minimum resizing width (default=1)
|
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
// OPTIMIZATION: partial row/column redraw variables
|
|
|
|
int _redraw_toprow;
|
|
|
|
int _redraw_botrow;
|
|
|
|
int _redraw_leftcol;
|
|
|
|
int _redraw_rightcol;
|
|
|
|
Fl_Color _row_header_color;
|
|
|
|
Fl_Color _col_header_color;
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
int _auto_drag;
|
|
|
|
int _selecting;
|
2012-04-15 00:35:56 +04:00
|
|
|
int _scrollbar_size;
|
2013-03-23 11:55:09 +04:00
|
|
|
enum {
|
2023-04-13 21:14:36 +03:00
|
|
|
TABCELLNAV = 1<<0 ///> tab cell navigation flag
|
2013-03-23 11:55:09 +04:00
|
|
|
};
|
|
|
|
unsigned int flags_;
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2023-10-22 20:30:37 +03:00
|
|
|
Fl_Int_Vector *_colwidths; // column widths in pixels
|
|
|
|
Fl_Int_Vector *_rowheights; // row heights in pixels
|
|
|
|
|
|
|
|
// number of columns and rows == size of corresponding vectors
|
|
|
|
int col_size(); // size of the column widths vector
|
|
|
|
int row_size(); // size of the row heights vector
|
2020-07-01 19:03:10 +03:00
|
|
|
|
|
|
|
Fl_Cursor _last_cursor; // last mouse cursor before changed to 'resize' cursor
|
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
// EVENT CALLBACK DATA
|
2020-07-01 19:03:10 +03:00
|
|
|
TableContext _callback_context; // event context
|
|
|
|
int _callback_row, _callback_col; // event row/col
|
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
// handle() state variables.
|
|
|
|
// Put here instead of local statics in handle(), so more
|
|
|
|
// than one Fl_Table can exist without crosstalk between them.
|
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
int _resizing_col; // column being dragged
|
|
|
|
int _resizing_row; // row being dragged
|
|
|
|
int _dragging_x; // starting x position for horiz drag
|
|
|
|
int _dragging_y; // starting y position for vert drag
|
|
|
|
int _last_row; // last row we FL_PUSH'ed
|
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
// Redraw single cell
|
|
|
|
void _redraw_cell(TableContext context, int R, int C);
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
void _start_auto_drag();
|
|
|
|
void _stop_auto_drag();
|
|
|
|
void _auto_drag_cb();
|
|
|
|
static void _auto_drag_cb2(void *d);
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
protected:
|
|
|
|
enum ResizeFlag {
|
|
|
|
RESIZE_NONE = 0,
|
|
|
|
RESIZE_COL_LEFT = 1,
|
|
|
|
RESIZE_COL_RIGHT = 2,
|
|
|
|
RESIZE_ROW_ABOVE = 3,
|
|
|
|
RESIZE_ROW_BELOW = 4
|
|
|
|
};
|
2017-04-27 19:29:30 +03:00
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
int table_w; ///< table's virtual width (in pixels)
|
|
|
|
int table_h; ///< table's virtual height (in pixels)
|
|
|
|
int toprow; ///< top row# of currently visible table on screen
|
|
|
|
int botrow; ///< bottom row# of currently visible table on screen
|
|
|
|
int leftcol; ///< left column# of currently visible table on screen
|
|
|
|
int rightcol; ///< right column# of currently visible table on screen
|
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
// selection
|
2020-07-01 19:03:10 +03:00
|
|
|
int current_row; ///< selection cursor's current row (-1 if none)
|
|
|
|
int current_col; ///< selection cursor's current column (-1 if none)
|
|
|
|
int select_row; ///< extended selection row (-1 if none)
|
|
|
|
int select_col; ///< extended selection column (-1 if none)
|
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
// OPTIMIZATION: Precomputed scroll positions for the toprow/leftcol
|
2020-07-01 19:03:10 +03:00
|
|
|
int toprow_scrollpos; ///< precomputed scroll position for top row
|
|
|
|
int leftcol_scrollpos; ///< precomputed scroll position for left column
|
|
|
|
|
2017-04-27 19:29:30 +03:00
|
|
|
// Data table's inner dimension
|
2020-07-01 19:03:10 +03:00
|
|
|
int tix; ///< Data table's inner x dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
|
|
|
int tiy; ///< Data table's inner y dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
|
|
|
int tiw; ///< Data table's inner w dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
|
|
|
int tih; ///< Data table's inner h dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
2017-04-27 19:29:30 +03:00
|
|
|
|
|
|
|
// Data table's outer dimension
|
2020-07-01 19:03:10 +03:00
|
|
|
int tox; ///< Data table's outer x dimension, outside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
|
|
|
int toy; ///< Data table's outer y dimension, outside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
|
|
|
int tow; ///< Data table's outer w dimension, outside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
|
|
|
int toh; ///< Data table's outer h dimension, outside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
2017-04-27 19:29:30 +03:00
|
|
|
|
|
|
|
// Table widget's inner dimension
|
2020-07-01 19:03:10 +03:00
|
|
|
int wix; ///< Table widget's inner x dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
|
|
|
int wiy; ///< Table widget's inner y dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
|
|
|
int wiw; ///< Table widget's inner w dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
|
|
|
int wih; ///< Table widget's inner h dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram"
|
|
|
|
|
|
|
|
Fl_Scroll *table; ///< child Fl_Scroll widget container for child fltk widgets (if any)
|
|
|
|
Fl_Scrollbar *vscrollbar; ///< child vertical scrollbar widget
|
|
|
|
Fl_Scrollbar *hscrollbar; ///< child horizontal scrollbar widget
|
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
// Fltk
|
2022-12-30 21:14:36 +03:00
|
|
|
int handle(int e) FL_OVERRIDE; // fltk handle() FL_OVERRIDE
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
// Class maintenance
|
|
|
|
void recalc_dimensions();
|
2020-07-01 19:03:10 +03:00
|
|
|
void table_resized(); // table resized; recalc
|
|
|
|
void table_scrolled(); // table scrolled; recalc
|
|
|
|
void get_bounds(TableContext context, // return x/y/w/h bounds for context
|
2009-11-14 18:49:12 +03:00
|
|
|
int &X, int &Y, int &W, int &H);
|
2020-07-01 19:03:10 +03:00
|
|
|
void change_cursor(Fl_Cursor newcursor); // change mouse cursor to some other shape
|
2009-11-14 16:05:37 +03:00
|
|
|
TableContext cursor2rowcol(int &R, int &C, ResizeFlag &resizeflag);
|
2020-07-01 19:03:10 +03:00
|
|
|
int find_cell(TableContext context, // find cell's x/y/w/h given r/c
|
2009-11-14 18:49:12 +03:00
|
|
|
int R, int C, int &X, int &Y, int &W, int &H);
|
2009-11-14 16:05:37 +03:00
|
|
|
int row_col_clamp(TableContext context, int &R, int &C);
|
2009-11-14 18:49:12 +03:00
|
|
|
// clamp r/c to known universe
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Subclass should override this method to handle drawing the cells.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
This method will be called whenever the table is redrawn, once per cell.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
Only cells that are completely (or partially) visible will be told to draw.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
\p context will be one of the following:
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
<table border=1>
|
|
|
|
<tr>
|
|
|
|
<td>\p Fl_Table::CONTEXT_STARTPAGE</td>
|
|
|
|
<td>When table, or parts of the table, are about to be redrawn.<br>
|
|
|
|
Use to initialize static data, such as font selections.<p>
|
|
|
|
R/C will be zero,<br>
|
|
|
|
X/Y/W/H will be the dimensions of the table's entire data area.<br>
|
|
|
|
(Useful for locking a database before accessing; see
|
|
|
|
also visible_cells())</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>\p Fl_Table::CONTEXT_ENDPAGE</td>
|
|
|
|
<td>When table has completed being redrawn.<br>
|
|
|
|
R/C will be zero, X/Y/W/H dimensions of table's data area.<br>
|
|
|
|
(Useful for unlocking a database after accessing)</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>\p Fl_Table::CONTEXT_ROW_HEADER</td>
|
|
|
|
<td>Whenever a row header cell needs to be drawn.<br>
|
|
|
|
R will be the row number of the header being redrawn,<br>
|
|
|
|
C will be zero,<br>
|
|
|
|
X/Y/W/H will be the fltk drawing area of the row header in the window </td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>\p Fl_Table::CONTEXT_COL_HEADER</td>
|
|
|
|
<td>Whenever a column header cell needs to be drawn.<br>
|
|
|
|
R will be zero, <br>
|
|
|
|
C will be the column number of the header being redrawn,<br>
|
|
|
|
X/Y/W/H will be the fltk drawing area of the column header in the window </td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>\p Fl_Table::CONTEXT_CELL</td>
|
|
|
|
<td>Whenever a data cell in the table needs to be drawn.<br>
|
|
|
|
R/C will be the row/column of the cell to be drawn,<br>
|
|
|
|
X/Y/W/H will be the fltk drawing area of the cell in the window </td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>\p Fl_Table::CONTEXT_RC_RESIZE</td>
|
|
|
|
<td>Whenever table or row/column is resized or scrolled,
|
|
|
|
either interactively or via col_width() or row_height().<br>
|
|
|
|
R/C/X/Y/W/H will all be zero.
|
2020-07-01 19:03:10 +03:00
|
|
|
<p>
|
2017-04-26 23:12:34 +03:00
|
|
|
Useful for fltk containers that need to resize or move
|
|
|
|
the child fltk widgets.</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2021-12-09 10:09:44 +03:00
|
|
|
\p R and \p C will be set to the row and column number
|
|
|
|
of the cell being drawn. In the case of row headers, \p C will be \a 0.
|
|
|
|
In the case of column headers, \p R will be \a 0.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2021-12-09 10:09:44 +03:00
|
|
|
<tt>X/Y/W/H</tt> will be the position and dimensions of where the cell
|
2017-04-26 23:12:34 +03:00
|
|
|
should be drawn.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
In the case of custom widgets, a minimal draw_cell() override might
|
|
|
|
look like the following. With custom widgets it is up to the caller to handle
|
|
|
|
drawing everything within the dimensions of the cell, including handling the
|
|
|
|
selection color. Note all clipping must be handled as well; this allows drawing
|
|
|
|
outside the dimensions of the cell if so desired for 'custom effects'.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
\code
|
|
|
|
// This is called whenever Fl_Table wants you to draw a cell
|
|
|
|
void MyTable::draw_cell(TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0) {
|
|
|
|
static char s[40];
|
|
|
|
sprintf(s, "%d/%d", R, C); // text for each cell
|
|
|
|
switch ( context ) {
|
|
|
|
case CONTEXT_STARTPAGE: // Fl_Table telling us it's starting to draw page
|
|
|
|
fl_font(FL_HELVETICA, 16);
|
|
|
|
return;
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
case CONTEXT_ROW_HEADER: // Fl_Table telling us to draw row/col headers
|
|
|
|
case CONTEXT_COL_HEADER:
|
|
|
|
fl_push_clip(X, Y, W, H);
|
|
|
|
{
|
|
|
|
fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, color());
|
|
|
|
fl_color(FL_BLACK);
|
|
|
|
fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
|
|
|
|
}
|
|
|
|
fl_pop_clip();
|
|
|
|
return;
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
case CONTEXT_CELL: // Fl_Table telling us to draw cells
|
|
|
|
fl_push_clip(X, Y, W, H);
|
|
|
|
{
|
|
|
|
// BG COLOR
|
|
|
|
fl_color( row_selected(R) ? selection_color() : FL_WHITE);
|
|
|
|
fl_rectf(X, Y, W, H);
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
// TEXT
|
|
|
|
fl_color(FL_BLACK);
|
|
|
|
fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
// BORDER
|
|
|
|
fl_color(FL_LIGHT2);
|
|
|
|
fl_rect(X, Y, W, H);
|
|
|
|
}
|
|
|
|
fl_pop_clip();
|
|
|
|
return;
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
default:
|
|
|
|
return;
|
2010-10-26 13:00:19 +04:00
|
|
|
}
|
|
|
|
//NOTREACHED
|
2009-11-14 17:34:29 +03:00
|
|
|
}
|
|
|
|
\endcode
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
virtual void draw_cell(TableContext context, int R=0, int C=0,
|
2009-11-14 18:49:12 +03:00
|
|
|
int X=0, int Y=0, int W=0, int H=0)
|
2021-12-09 10:09:44 +03:00
|
|
|
{ (void)context; (void)R; (void)C; (void)X; (void)Y; (void)W; (void)H;} // overridden by deriving class
|
2020-07-01 19:03:10 +03:00
|
|
|
|
|
|
|
long row_scroll_position(int row); // find scroll position of row (in pixels)
|
|
|
|
long col_scroll_position(int col); // find scroll position of col (in pixels)
|
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
/**
|
|
|
|
Does the table contain any child fltk widgets?
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
int is_fltk_container() { // does table contain fltk widgets?
|
|
|
|
return( Fl_Group::children() > 3 ); // (ie. more than box and 2 scrollbars?)
|
2009-11-14 16:05:37 +03:00
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
|
|
|
static void scroll_cb(Fl_Widget*,void*); // h/v scrollbar callback
|
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
void damage_zone(int r1, int c1, int r2, int c2, int r3 = 0, int c3 = 0);
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
/**
|
|
|
|
Define region of cells to be redrawn by specified range of rows/cols,
|
|
|
|
and then sets damage(DAMAGE_CHILD). Extends any previously defined range to redraw.
|
|
|
|
*/
|
2011-10-02 10:25:13 +04:00
|
|
|
void redraw_range(int topRow, int botRow, int leftCol, int rightCol) {
|
2009-11-14 16:05:37 +03:00
|
|
|
if ( _redraw_toprow == -1 ) {
|
|
|
|
// Initialize redraw range
|
2011-10-02 10:25:13 +04:00
|
|
|
_redraw_toprow = topRow;
|
|
|
|
_redraw_botrow = botRow;
|
|
|
|
_redraw_leftcol = leftCol;
|
|
|
|
_redraw_rightcol = rightCol;
|
2009-11-14 16:05:37 +03:00
|
|
|
} else {
|
|
|
|
// Extend redraw range
|
2011-10-02 10:25:13 +04:00
|
|
|
if ( topRow < _redraw_toprow ) _redraw_toprow = topRow;
|
|
|
|
if ( botRow > _redraw_botrow ) _redraw_botrow = botRow;
|
|
|
|
if ( leftCol < _redraw_leftcol ) _redraw_leftcol = leftCol;
|
|
|
|
if ( rightCol > _redraw_rightcol ) _redraw_rightcol = rightCol;
|
2009-11-14 16:05:37 +03:00
|
|
|
}
|
|
|
|
// Indicate partial redraw needed of some cells
|
|
|
|
damage(FL_DAMAGE_CHILD);
|
|
|
|
}
|
2020-04-20 14:30:48 +03:00
|
|
|
|
|
|
|
// draw() has to be protected per FLTK convention (was public in 1.3.x)
|
2022-12-30 21:14:36 +03:00
|
|
|
void draw() FL_OVERRIDE;
|
2020-04-20 14:30:48 +03:00
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
public:
|
|
|
|
Fl_Table(int X, int Y, int W, int H, const char *l=0);
|
|
|
|
~Fl_Table();
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2012-11-24 00:07:22 +04:00
|
|
|
Clears the table to zero rows (rows(0)), zero columns (cols(0)), and clears
|
|
|
|
any widgets (table->clear()) that were added with begin()/end() or add()/insert()/etc.
|
2009-11-14 17:34:29 +03:00
|
|
|
\see rows(int), cols(int)
|
2017-04-26 23:12:34 +03:00
|
|
|
*/
|
|
|
|
virtual void clear() {
|
|
|
|
rows(0);
|
|
|
|
cols(0);
|
|
|
|
table->clear();
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2010-12-05 04:22:53 +03:00
|
|
|
// \todo: add topline(), middleline(), bottomline()
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
|
|
|
Sets the kind of box drawn around the data table,
|
|
|
|
the default being FL_NO_BOX. Changing this value will cause the table
|
|
|
|
to redraw.
|
2017-04-26 23:12:34 +03:00
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline void table_box(Fl_Boxtype val) {
|
|
|
|
table->box(val);
|
|
|
|
table_resized();
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
|
|
|
Returns the current box type used for the data table.
|
2017-04-26 23:12:34 +03:00
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline Fl_Boxtype table_box( void ) {
|
|
|
|
return(table->box());
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2023-10-22 20:30:37 +03:00
|
|
|
virtual void rows(int val); // set number of rows
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
|
|
|
Returns the number of rows in the table.
|
2017-04-26 23:12:34 +03:00
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline int rows() {
|
|
|
|
return(_rows);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2023-10-22 20:30:37 +03:00
|
|
|
virtual void cols(int val); // set number of columns
|
2020-07-01 19:03:10 +03:00
|
|
|
|
|
|
|
/**
|
2009-11-14 17:34:29 +03:00
|
|
|
Get the number of columns in the table.
|
2017-04-26 23:12:34 +03:00
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline int cols() {
|
|
|
|
return(_cols);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2020-07-01 19:03:10 +03:00
|
|
|
Returns the range of row and column numbers for all visible
|
2017-04-26 23:12:34 +03:00
|
|
|
and partially visible cells in the table.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
These values can be used e.g. by your draw_cell() routine during
|
|
|
|
CONTEXT_STARTPAGE to figure out what cells are about to be redrawn
|
|
|
|
for the purposes of locking the data from a database before it's drawn.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
\code
|
|
|
|
leftcol rightcol
|
|
|
|
: :
|
|
|
|
toprow .. .-------------------.
|
|
|
|
| |
|
|
|
|
| V I S I B L E |
|
|
|
|
| |
|
|
|
|
| T A B L E |
|
|
|
|
| |
|
|
|
|
botrow .. '-------------------`
|
|
|
|
\endcode
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
e.g. in a table where the visible rows are 5-20, and the
|
|
|
|
visible columns are 100-120, then those variables would be:
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
- toprow = 5
|
|
|
|
- botrow = 20
|
|
|
|
- leftcol = 100
|
|
|
|
- rightcol = 120
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline void visible_cells(int& r1, int& r2, int& c1, int& c2) {
|
|
|
|
r1 = toprow;
|
|
|
|
r2 = botrow;
|
|
|
|
c1 = leftcol;
|
|
|
|
c2 = rightcol;
|
2020-07-01 19:03:10 +03:00
|
|
|
}
|
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns 1 if someone is interactively resizing a row or column.
|
|
|
|
You can currently call this only from within your callback().
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
int is_interactive_resize() {
|
|
|
|
return(_resizing_row != -1 || _resizing_col != -1);
|
2020-07-01 19:03:10 +03:00
|
|
|
}
|
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns if row resizing by the user is allowed.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline int row_resize() {
|
|
|
|
return(_row_resize);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Allows/disallows row resizing by the user.
|
|
|
|
1=allow interactive resizing, 0=disallow interactive resizing.
|
|
|
|
Since interactive resizing is done via the row headers,
|
|
|
|
row_header() must also be enabled to allow resizing.
|
2020-07-01 19:03:10 +03:00
|
|
|
*/
|
|
|
|
void row_resize(int flag) { // enable row resizing
|
2009-11-14 16:05:37 +03:00
|
|
|
_row_resize = flag;
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns if column resizing by the user is allowed.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline int col_resize() {
|
|
|
|
return(_col_resize);
|
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Allows/disallows column resizing by the user.
|
|
|
|
1=allow interactive resizing, 0=disallow interactive resizing.
|
|
|
|
Since interactive resizing is done via the column headers,
|
|
|
|
\p col_header() must also be enabled to allow resizing.
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
void col_resize(int flag) { // enable col resizing
|
2009-11-14 16:05:37 +03:00
|
|
|
_col_resize = flag;
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the current column minimum resize value.
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
inline int col_resize_min() { // column minimum resizing width
|
2009-11-14 16:05:37 +03:00
|
|
|
return(_col_resize_min);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Sets the current column minimum resize value.
|
|
|
|
This is used to prevent the user from interactively resizing
|
|
|
|
any column to be smaller than 'pixels'. Must be a value >=1.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
void col_resize_min(int val) {
|
|
|
|
_col_resize_min = ( val < 1 ) ? 1 : val;
|
2020-07-01 19:03:10 +03:00
|
|
|
}
|
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the current row minimum resize value.
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
inline int row_resize_min() { // column minimum resizing width
|
2009-11-14 16:05:37 +03:00
|
|
|
return(_row_resize_min);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Sets the current row minimum resize value.
|
|
|
|
This is used to prevent the user from interactively resizing
|
|
|
|
any row to be smaller than 'pixels'. Must be a value >=1.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
void row_resize_min(int val) {
|
|
|
|
_row_resize_min = ( val < 1 ) ? 1 : val;
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns if row headers are enabled or not.
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
inline int row_header() { // set/get row header enable flag
|
2009-11-14 16:05:37 +03:00
|
|
|
return(_row_header);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Enables/disables showing the row headers. 1=enabled, 0=disabled.
|
|
|
|
If changed, the table is redrawn.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
void row_header(int flag) {
|
|
|
|
_row_header = flag;
|
|
|
|
table_resized();
|
|
|
|
redraw();
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns if column headers are enabled or not.
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
inline int col_header() { // set/get col header enable flag
|
2009-11-14 16:05:37 +03:00
|
|
|
return(_col_header);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Enable or disable column headers.
|
|
|
|
If changed, the table is redrawn.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
void col_header(int flag) {
|
|
|
|
_col_header = flag;
|
|
|
|
table_resized();
|
|
|
|
redraw();
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Sets the height in pixels for column headers and redraws the table.
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
inline void col_header_height(int height) { // set/get col header height
|
2009-11-14 16:05:37 +03:00
|
|
|
_col_header_h = height;
|
|
|
|
table_resized();
|
|
|
|
redraw();
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Gets the column header height.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline int col_header_height() {
|
|
|
|
return(_col_header_h);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Sets the row header width to n and causes the screen to redraw.
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
inline void row_header_width(int width) { // set/get row header width
|
2009-11-14 16:05:37 +03:00
|
|
|
_row_header_w = width;
|
|
|
|
table_resized();
|
|
|
|
redraw();
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the current row header width (in pixels).
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline int row_header_width() {
|
|
|
|
return(_row_header_w);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Sets the row header color and causes the screen to redraw.
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
inline void row_header_color(Fl_Color val) { // set/get row header color
|
2009-11-14 16:05:37 +03:00
|
|
|
_row_header_color = val;
|
|
|
|
redraw();
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the current row header color.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline Fl_Color row_header_color() {
|
|
|
|
return(_row_header_color);
|
2020-07-01 19:03:10 +03:00
|
|
|
}
|
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Sets the color for column headers and redraws the table.
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
inline void col_header_color(Fl_Color val) { // set/get col header color
|
2009-11-14 16:05:37 +03:00
|
|
|
_col_header_color = val;
|
|
|
|
redraw();
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Gets the color for column headers.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline Fl_Color col_header_color() {
|
|
|
|
return(_col_header_color);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2023-10-22 20:30:37 +03:00
|
|
|
void row_height(int row, int height); // set row height in pixels
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2023-10-22 20:30:37 +03:00
|
|
|
// Returns the current height of the specified row as a value in pixels.
|
|
|
|
int row_height(int row);
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2023-10-22 20:30:37 +03:00
|
|
|
void col_width(int col, int width); // set a column's width in pixels
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2023-10-22 20:30:37 +03:00
|
|
|
// Returns the current width of the specified column in pixels.
|
|
|
|
int col_width(int col);
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Convenience method to set the height of all rows to the
|
|
|
|
same value, in pixels. The screen is redrawn.
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
void row_height_all(int height) { // set all row/col heights
|
2009-11-14 16:05:37 +03:00
|
|
|
for ( int r=0; r<rows(); r++ ) {
|
|
|
|
row_height(r, height);
|
|
|
|
}
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Convenience method to set the width of all columns to the
|
|
|
|
same value, in pixels. The screen is redrawn.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
void col_width_all(int width) {
|
|
|
|
for ( int c=0; c<cols(); c++ ) {
|
|
|
|
col_width(c, width);
|
|
|
|
}
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
|
|
|
void row_position(int row); // set/get table's current scroll position
|
2009-11-14 16:05:37 +03:00
|
|
|
void col_position(int col);
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the current row scroll position as a row number.
|
|
|
|
*/
|
|
|
|
int row_position() {
|
2009-11-14 16:05:37 +03:00
|
|
|
return(_row_position);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the current column scroll position as a column number.
|
|
|
|
*/
|
|
|
|
int col_position() {
|
2009-11-14 16:05:37 +03:00
|
|
|
return(_col_position);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Sets which row should be at the top of the table,
|
|
|
|
scrolling as necessary, and the table is redrawn. If the table
|
|
|
|
cannot be scrolled that far, it is scrolled as far as possible.
|
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
inline void top_row(int row) { // set/get top row (deprecated)
|
2009-11-14 16:05:37 +03:00
|
|
|
row_position(row);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the current top row shown in the table.
|
|
|
|
This row may be partially obscured.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
inline int top_row() {
|
|
|
|
return(row_position());
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
int is_selected(int r, int c); // selected cell
|
2010-10-26 15:30:58 +04:00
|
|
|
void get_selection(int &row_top, int &col_left, int &row_bot, int &col_right);
|
|
|
|
void set_selection(int row_top, int col_left, int row_bot, int col_right);
|
2013-03-23 11:55:09 +04:00
|
|
|
int move_cursor(int R, int C, int shiftselect);
|
2009-11-14 16:05:37 +03:00
|
|
|
int move_cursor(int R, int C);
|
2022-12-30 21:14:36 +03:00
|
|
|
void resize(int X, int Y, int W, int H) FL_OVERRIDE; // fltk resize() FL_OVERRIDE
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 18:49:12 +03:00
|
|
|
// This crashes sortapp() during init.
|
|
|
|
// void box(Fl_Boxtype val) {
|
|
|
|
// Fl_Group::box(val);
|
|
|
|
// if ( table ) {
|
|
|
|
// resize(x(), y(), w(), h());
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// Fl_Boxtype box(void) const {
|
|
|
|
// return(Fl_Group::box());
|
|
|
|
// }
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
// Child group management
|
|
|
|
|
|
|
|
/**
|
|
|
|
Resets the internal array of widget sizes and positions.
|
|
|
|
\sa Fl_Group::init_sizes()
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
void init_sizes() {
|
|
|
|
table->init_sizes();
|
|
|
|
table->redraw();
|
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
The specified widget is removed from its current group (if any)
|
|
|
|
and added to the end of Fl_Table's group.
|
|
|
|
*/
|
2011-10-02 10:25:13 +04:00
|
|
|
void add(Fl_Widget& wgt) {
|
|
|
|
table->add(wgt);
|
2011-07-23 05:10:26 +04:00
|
|
|
if ( table->children() > 2 ) {
|
|
|
|
table->show();
|
|
|
|
} else {
|
|
|
|
table->hide();
|
2020-07-01 19:03:10 +03:00
|
|
|
}
|
2009-11-14 16:05:37 +03:00
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
The specified widget is removed from its current group (if any)
|
|
|
|
and added to the end of Fl_Table's group.
|
|
|
|
*/
|
2011-10-02 10:25:13 +04:00
|
|
|
void add(Fl_Widget* wgt) {
|
|
|
|
add(*wgt);
|
2009-11-14 16:05:37 +03:00
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
The specified widget is removed from its current group (if any)
|
|
|
|
and inserted into the Fl_Table's group at position 'n'.
|
|
|
|
*/
|
2011-10-02 10:25:13 +04:00
|
|
|
void insert(Fl_Widget& wgt, int n) {
|
|
|
|
table->insert(wgt,n);
|
2009-11-14 16:05:37 +03:00
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
The specified widget is removed from its current group (if any)
|
|
|
|
and inserted into Fl_Table's group before widget 'w2'.
|
|
|
|
This will append if 'w2' is not in Fl_Table's group.
|
|
|
|
*/
|
2011-10-02 10:25:13 +04:00
|
|
|
void insert(Fl_Widget& wgt, Fl_Widget* w2) {
|
|
|
|
table->insert(wgt,w2);
|
2009-11-14 16:05:37 +03:00
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
The specified widget is removed from Fl_Table's group.
|
|
|
|
*/
|
2011-10-02 10:25:13 +04:00
|
|
|
void remove(Fl_Widget& wgt) {
|
|
|
|
table->remove(wgt);
|
2009-11-14 16:05:37 +03:00
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
|
|
|
// (doxygen will substitute Fl_Group's docs here)
|
2009-11-14 16:05:37 +03:00
|
|
|
void begin() {
|
|
|
|
table->begin();
|
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
|
|
|
// (doxygen will substitute Fl_Group's docs here)
|
2009-11-14 16:05:37 +03:00
|
|
|
void end() {
|
|
|
|
table->end();
|
|
|
|
// HACK: Avoid showing Fl_Scroll; seems to erase screen
|
|
|
|
// causing unnecessary flicker, even if its box() is FL_NO_BOX.
|
|
|
|
//
|
|
|
|
if ( table->children() > 2 ) {
|
|
|
|
table->show();
|
|
|
|
} else {
|
|
|
|
table->hide();
|
2020-07-01 19:03:10 +03:00
|
|
|
}
|
2010-02-21 00:14:47 +03:00
|
|
|
Fl_Group::current(Fl_Group::parent());
|
2009-11-14 16:05:37 +03:00
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a pointer to the array of children. <I>This pointer is only
|
|
|
|
valid until the next time a child is added or removed.</I>
|
|
|
|
*/
|
|
|
|
Fl_Widget*const* array() {
|
2009-11-14 16:05:37 +03:00
|
|
|
return(table->array());
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the child widget by an index.
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
When using the Fl_Table as a container for FLTK widgets, this method returns
|
2017-04-26 23:12:34 +03:00
|
|
|
the widget pointer from the internal array of widgets in the container.
|
|
|
|
|
|
|
|
Typically used in loops, eg:
|
|
|
|
\code
|
|
|
|
for ( int i=0; i<children(); i++ ) {
|
|
|
|
Fl_Widget *w = child(i);
|
|
|
|
[..]
|
|
|
|
}
|
|
|
|
\endcode
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
Fl_Widget *child(int n) const {
|
|
|
|
return(table->child(n));
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the number of children in the table.
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
When using the Fl_Table as a container for FLTK widgets, this method returns
|
2017-04-26 23:12:34 +03:00
|
|
|
how many child widgets the table has.
|
|
|
|
|
|
|
|
\see child(int)
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
int children() const {
|
|
|
|
return(table->children()-2); // -2: skip Fl_Scroll's h/v scrollbar widgets
|
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
|
|
|
// (doxygen will substitute Fl_Group's docs here)
|
2011-10-02 10:25:13 +04:00
|
|
|
int find(const Fl_Widget *wgt) const {
|
|
|
|
return(table->find(wgt));
|
2009-11-14 16:05:37 +03:00
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
|
|
|
// (doxygen will substitute Fl_Group's docs here)
|
2011-10-02 10:25:13 +04:00
|
|
|
int find(const Fl_Widget &wgt) const {
|
|
|
|
return(table->find(wgt));
|
2020-07-01 19:03:10 +03:00
|
|
|
}
|
2017-04-26 23:12:34 +03:00
|
|
|
|
2009-11-14 16:05:37 +03:00
|
|
|
// CALLBACKS
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the current row the event occurred on.
|
|
|
|
|
|
|
|
This function should only be used from within the user's callback function.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
int callback_row() {
|
|
|
|
return(_callback_row);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the current column the event occurred on.
|
|
|
|
|
|
|
|
This function should only be used from within the user's callback function.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
int callback_col() {
|
|
|
|
return(_callback_col);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Returns the current 'table context'.
|
|
|
|
|
|
|
|
This function should only be used from within the user's callback function.
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
TableContext callback_context() {
|
|
|
|
return(_callback_context);
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
/**
|
|
|
|
Calls the widget callback.
|
|
|
|
|
|
|
|
Saves the specified 'context', 'row', and 'col' values, so that the user's
|
|
|
|
callback can then access them with the member functions
|
|
|
|
callback_context(), callback_row() and callback_col().
|
|
|
|
*/
|
2009-11-14 16:05:37 +03:00
|
|
|
void do_callback(TableContext context, int row, int col) {
|
|
|
|
_callback_context = context;
|
|
|
|
_callback_row = row;
|
|
|
|
_callback_col = col;
|
|
|
|
Fl_Widget::do_callback();
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2016-01-31 07:33:54 +03:00
|
|
|
#ifdef FL_DOXYGEN
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
The Fl_Widget::when() function is used to set a group of flags, determining
|
|
|
|
when the widget callback is called:
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
<table border=1>
|
|
|
|
<tr>
|
|
|
|
<td>\p FL_WHEN_CHANGED</td>
|
|
|
|
<td>
|
2020-07-01 19:03:10 +03:00
|
|
|
callback() will be called when rows or columns are resized (interactively or
|
|
|
|
via col_width() or row_height()), passing CONTEXT_RC_RESIZE via
|
2017-04-26 23:12:34 +03:00
|
|
|
callback_context().
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td>\p FL_WHEN_RELEASE</td>
|
|
|
|
<td>
|
2020-07-01 19:03:10 +03:00
|
|
|
callback() will be called during FL_RELEASE events, such as when someone
|
2017-04-26 23:12:34 +03:00
|
|
|
releases a mouse button somewhere on the table.
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2015-07-19 02:59:54 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
The callback() routine is sent a TableContext that indicates the context the
|
|
|
|
event occurred in, such as in a cell, in a header, or elsewhere on the table.
|
|
|
|
When an event occurs in a cell or header, callback_row() and
|
|
|
|
callback_col() can be used to determine the row and column. The callback
|
|
|
|
can also look at the regular fltk event values (ie. Fl::event() and
|
|
|
|
Fl::event_button()) to determine what kind of event is occurring.
|
|
|
|
*/
|
2009-11-14 17:34:29 +03:00
|
|
|
void when(Fl_When flags);
|
|
|
|
#endif
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2016-01-31 07:33:54 +03:00
|
|
|
#ifdef FL_DOXYGEN
|
2009-11-14 17:34:29 +03:00
|
|
|
/**
|
2017-04-26 23:12:34 +03:00
|
|
|
Callbacks will be called depending on the setting of Fl_Widget::when().
|
2020-07-01 19:03:10 +03:00
|
|
|
|
|
|
|
Callback functions should use the following functions to determine the
|
2017-04-26 23:12:34 +03:00
|
|
|
context/row/column:
|
2015-07-19 02:59:54 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
- Fl_Table::callback_row() returns current row
|
|
|
|
- Fl_Table::callback_col() returns current column
|
|
|
|
- Fl_Table::callback_context() returns current table context
|
2015-07-19 02:59:54 +03:00
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
callback_row() and callback_col() will be set to the row and column number the
|
|
|
|
event occurred on. If someone clicked on a row header, \p col will be \a 0.
|
2017-04-26 23:12:34 +03:00
|
|
|
If someone clicked on a column header, \p row will be \a 0.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
callback_context() will return one of the following:
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
<table border=1>
|
|
|
|
<tr><td><tt>Fl_Table::CONTEXT_ROW_HEADER</tt></td>
|
|
|
|
<td>Someone clicked on a row header. Excludes resizing.</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td><tt>Fl_Table::CONTEXT_COL_HEADER</tt></td>
|
|
|
|
<td>Someone clicked on a column header. Excludes resizing.</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td><tt>Fl_Table::CONTEXT_CELL</tt></td>
|
|
|
|
<td>
|
|
|
|
Someone clicked on a cell.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
To receive callbacks for FL_RELEASE events, you must set
|
|
|
|
when(FL_WHEN_RELEASE).
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td><tt>Fl_Table::CONTEXT_RC_RESIZE</tt></td>
|
|
|
|
<td>
|
|
|
|
Someone is resizing rows/columns either interactively,
|
|
|
|
or via the col_width() or row_height() API.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
Use is_interactive_resize()
|
|
|
|
to determine interactive resizing.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
If resizing a column, R=0 and C=column being resized.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
If resizing a row, C=0 and R=row being resized.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
NOTE: To receive resize events, you must set when(FL_WHEN_CHANGED).
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
\code
|
|
|
|
class MyTable : public Fl_Table {
|
|
|
|
[..]
|
|
|
|
private:
|
|
|
|
// Handle events that happen on the table
|
|
|
|
void event_callback2() {
|
|
|
|
int R = callback_row(), // row where event occurred
|
|
|
|
C = callback_col(); // column where event occurred
|
|
|
|
TableContext context = callback_context(); // which part of table
|
|
|
|
fprintf(stderr, "callback: Row=%d Col=%d Context=%d Event=%d\n",
|
|
|
|
R, C, (int)context, (int)Fl::event());
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
// Actual static callback
|
|
|
|
static void event_callback(Fl_Widget*, void* data) {
|
|
|
|
MyTable *o = (MyTable*)data;
|
|
|
|
o->event_callback2();
|
|
|
|
}
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2017-04-26 23:12:34 +03:00
|
|
|
public:
|
|
|
|
// Constructor
|
|
|
|
MyTable() {
|
|
|
|
[..]
|
|
|
|
table.callback(&event_callback, (void*)this); // setup callback
|
|
|
|
table.when(FL_WHEN_CHANGED|FL_WHEN_RELEASE); // when to call it
|
|
|
|
}
|
|
|
|
};
|
|
|
|
\endcode
|
|
|
|
*/
|
2009-11-14 17:34:29 +03:00
|
|
|
void callback(Fl_Widget*, void*);
|
|
|
|
#endif
|
2012-04-15 00:35:56 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the current size of the scrollbars' troughs, in pixels.
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
If this value is zero (default), this widget will use the
|
2012-04-15 00:35:56 +04:00
|
|
|
Fl::scrollbar_size() value as the scrollbar's width.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2015-07-19 02:59:54 +03:00
|
|
|
\returns Scrollbar size in pixels, or 0 if the global Fl::scrollbar_size() is being used.
|
2012-04-15 00:35:56 +04:00
|
|
|
\see Fl::scrollbar_size(int)
|
|
|
|
*/
|
|
|
|
int scrollbar_size() const {
|
|
|
|
return(_scrollbar_size);
|
|
|
|
}
|
2016-03-26 05:55:14 +03:00
|
|
|
|
2012-04-15 00:35:56 +04:00
|
|
|
/**
|
|
|
|
Sets the pixel size of the scrollbars' troughs to \p newSize, in pixels.
|
|
|
|
|
|
|
|
Normally you should not need this method, and should use
|
|
|
|
Fl::scrollbar_size(int) instead to manage the size of ALL your
|
|
|
|
widgets' scrollbars. This ensures your application has a consistent
|
|
|
|
UI, is the default behavior, and is normally what you want.
|
|
|
|
|
|
|
|
Only use THIS method if you really need to override the global
|
|
|
|
scrollbar size. The need for this should be rare.
|
|
|
|
|
|
|
|
Setting \p newSize to the special value of 0 causes the widget to
|
|
|
|
track the global Fl::scrollbar_size(), which is the default.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2012-04-15 00:35:56 +04:00
|
|
|
\param[in] newSize Sets the scrollbar size in pixels.\n
|
|
|
|
If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()
|
|
|
|
\see Fl::scrollbar_size()
|
|
|
|
*/
|
|
|
|
void scrollbar_size(int newSize) {
|
|
|
|
if ( newSize != _scrollbar_size ) redraw();
|
|
|
|
_scrollbar_size = newSize;
|
2016-03-26 05:55:14 +03:00
|
|
|
}
|
|
|
|
|
2013-03-23 11:55:09 +04:00
|
|
|
/**
|
|
|
|
Flag to control if Tab navigates table cells or not.
|
|
|
|
|
|
|
|
If on, Tab key navigates table cells.
|
|
|
|
If off, Tab key navigates fltk widget focus. (default)
|
|
|
|
|
|
|
|
As of fltk 1.3, the default behavior of the Tab key is to navigate focus off
|
2013-03-23 12:14:08 +04:00
|
|
|
of the current widget, and on to the next one. But in some applications,
|
2013-03-23 11:55:09 +04:00
|
|
|
it's useful for Tab to be used to navigate cells in the Fl_Table.
|
|
|
|
|
|
|
|
\param [in] val If \p val is 1, Tab key navigates cells in table, not fltk widgets.<BR>
|
|
|
|
If \p val is 0, Tab key will advance focus to the next fltk widget (default), and does not navigate cells in table.
|
|
|
|
*/
|
|
|
|
void tab_cell_nav(int val) {
|
|
|
|
if ( val ) flags_ |= TABCELLNAV;
|
|
|
|
else flags_ &= ~TABCELLNAV;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-03-23 12:14:08 +04:00
|
|
|
Get state of table's 'Tab' key cell navigation flag.
|
2013-03-23 11:55:09 +04:00
|
|
|
|
2013-03-23 12:14:08 +04:00
|
|
|
\returns 1 if Tab configured to navigate cells in table<br>0 to navigate widget focus (default)
|
2013-03-23 11:55:09 +04:00
|
|
|
|
|
|
|
\see tab_cell_nav(int)
|
|
|
|
*/
|
|
|
|
int tab_cell_nav() const {
|
|
|
|
return(flags_ & TABCELLNAV ? 1 : 0);
|
|
|
|
}
|
2009-11-14 16:05:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /*_FL_TABLE_H*/
|