#include <Wt/WTreeTable>
Public Member Functions | |
WTreeTable (WContainerWidget *parent=0) | |
Construct a new WTreeTable. | |
void | addColumn (const WString &header, const WLength &width) |
Add a column. | |
int | numColumns () const |
The number of columns in this table. | |
void | setTreeRoot (WTreeTableNode *root, const WString &header) |
Set the tree root. | |
WTreeTableNode * | treeRoot () |
Get the tree root. | |
void | setTree (WTree *tree, const WString &header) |
Set the tree which provides the data for the tree table. | |
WTree * | tree () const |
Get the tree that provides the data this table. | |
WLength | columnWidth (int column) const |
Get the column width for the given column. | |
WText * | header (int column) const |
Get the header for the given column. | |
WWidget * | headerWidget () const |
Get the header widget. |
A WTreeTable implements a tree table, where additional data associated is associated with tree items, which are organized in columns.
The actual data is organized and provided by WTreeTableNode objects.
To use the tree table, you must first use addColumn() to specify the additional data columns. Then, you must set the tree root using setTreeRoot() and bind additional information (text or other widgets) in each node using WTreeTableNode::setColumnWidget().
To apply a style to the table header hou should use CSS in conjunction with the style class ("header") that is set for the header row. Alternatively, you may access the header directly using headerWidget(). To apply a style to each header entry, you can access each header entry using header(), e.g. to set a style class.
The table cannot be given a height using CSS style rules, instead you must use layout managers, or use resize().
Wt::WTreeTable::WTreeTable | ( | WContainerWidget * | parent = 0 |
) |
Construct a new WTreeTable.
The treeRoot() is 0. The table should first be properly dimensioned using addColumn() calls, and then data using setTreeRoot().
Add a column.
Add a column, by specifying a header and a column width.
int Wt::WTreeTable::numColumns | ( | ) | const [inline] |
The number of columns in this table.
Returns the number of columns in the table, including in the count the first column which contains the tree.
void Wt::WTreeTable::setTreeRoot | ( | WTreeTableNode * | root, | |
const WString & | header | |||
) |
Set the tree root.
Sets the data for the tree table, and specify the header for the first column.
Set the tree which provides the data for the tree table.
WTree* Wt::WTreeTable::tree | ( | ) | const [inline] |
WLength Wt::WTreeTable::columnWidth | ( | int | column | ) | const [inline] |
Get the column width for the given column.
The width of the first column (with index 0), containing the tree, is implied by the width set for the table minus the width of all other columns.
WText * Wt::WTreeTable::header | ( | int | column | ) | const |