Class Hierarchy
Flv_List
|
+----Flv_Table
Include Files
#include <FL/Flv_Table.H>
Description
The Flv_Table widget displays items in a table or grid. The items
can be of any complexity. Below are some examples of tables:
The second table uses both style information and dynamic information to generate
the table. The Flv_Table widget has the following features:
- Optional title
- Supports optional row/column headers/footers
- Optional horizontal and vertical scroll bars
(Never/Always/Automatic)
- Dynamic and styled row heights/column widths
- Trickle down style information (default, global, row, col, cell)
includes alignment, background color, font name, font size,
foreground color, frame style, height, width,
resizable, edit locked
- Optional selectable cell range
- Optional row and/or column grids
- Dynamic or settable rows per page
- Optional Row/Col resizing w/mouse either in row/column ends only
or in full grid
- Current cell or row selection
(Row selection acts like list w/columns)
- No data stored in widget
- Supports ~2 billion rows and columns
- Absolute cell references (row, column)
- For text values draw_cell is trivial to implement
Methods
These functions create and destroy the table widgets.
This function is called to draw the widget. Currently it calculates the
correct row width and calls Flv_List::draw().
This function is used to draw a basic cell. You will always need to
override this function to provide cell content. By default this function
draws the cell background and prepares for drawing the cell foreground.
A simple implementation for your application may look like the following:
...::draw_cell( int Offset, int X, int Y, int W, int H, int R, int C )
{
Flv_Style s;
Flv_Table::draw_cell( Offset, X, Y, W, H, R, C );
get_style( s, R, C );
fl_draw(get_value(R,C), X-Offset, Y, W, H, s.align() );
}
These functions return the width of a column. The second function will
actually set the width before returning the value. Currently these
functions use col_style to track individual widths. You may override this
function to provide calculated widths. The testtable2 example program
is an example of dynamically sizing columns.
This function handles basic events for the table. You may override this
function to provide additional functionality.
This function handles basic row drawing for a table. It repeatedly calls
draw cell for each cell on a row. Normally you will not need to override
this.
This function adds the selection style for a specific cell. It will only
add the selection style if the cell R, C is actually
set.
This function returns true if cell R, C is
currently selected.
This is a feature convenience function that returns true if the column
footers are visible. Column footers appear at the far right of the
widget.
This is a feature convenience function that returns true if the
column headers are visible. Column headers appear at the far left of
the widget.
This is a feature convenience function that returns true if the
column dividers/grid lines are visible. Column dividers/grid lines
appear between each cell.
The is a feature convenience function that returns true if the
FLVF_SELECT_ROW feature is set. If set, the entire current row will be
selected. If not set, only the current cell will be selected.
This function is a guaranteed style retrieval function. That means all
style information in parameter s will be defined. This function
retrieves the trickle down style information for cell R, C.
The retrieval order is (default style, global style, row style,
column style cell style).
These functions return the current column number. The second function will
actually set the column number before returning the value. There are two
special columns: -1 is the column header, -2 is the column footer.
These functions return true if column c is resizable. The second
function will actually set whether the column is resizable before returning
the value. The value returned is always a trickle down value (default
style, global style, column style). The range of these functions are:
-2 <= column number < cols()
These functions return the number of columns in the table. The second
function will actually set the number of columns.
This function will return true if a cell in column n is
selected.
This function gets the visible column that contains the point x, y.
These functions return the first column selected. The second function will
actually set the value before returning it. The select start column may
be before or after the current column.
This property contains a list of defined column styles. In
practice you should use the find or skip_to functions to determine if
a column has a style defined. For a complete list of
Flv_Style_List properties and methods see the
Flv_Style_List reference.