/usr/include/Wt/WTreeTable is in libwt-dev 3.1.10-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WTREETABLE_H_
#define WTREETABLE_H_
#include <Wt/WCompositeWidget>
namespace Wt {
class WTree;
class WTreeTableNode;
class WText;
/*! \class WTreeTable Wt/WTreeTable Wt/WTreeTable
* \brief A table with a navigatable tree in the first column.
*
* A %WTreeTable implements a tree table, where additional data
* associated is associated with tree items, which are organized in
* columns.
*
* Unlike the MVC-based WTreeView widget, the tree renders a widget
* hierarchy, rather than a hierarhical standard model. This provides
* extra flexibility (as any widget can be used as contents), at the
* cost of server-side, client-side and bandwidth resources
* (especially for large tree tables).
*
* The actual data is organized and provided by WTreeTableNode widgets.
*
* 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().
*
* The table cannot be given a height using CSS style rules, instead you
* must use layout managers, or use resize().
*
* \if cpp
* Usage example:
* \code
* Wt::WTreeTable *treeTable = new Wt::WTreeTable();
* treeTable->resize(650, 300);
*
* // Add 3 extra columns
* treeTable->addColumn("Yuppie Factor", 125);
* treeTable->addColumn("# Holidays", 125);
* treeTable->addColumn("Favorite Item", 125);
*
* // Create and set the root node
* Wt::WTreeTableNode *root = new Wt::WTreeTableNode("All Personnel");
* root->setImagePack("resources/");
* treeTable->setTreeRoot(root, "Emweb Organigram");
*
* // Populate the tree with data nodes.
* Wt::WTreeTableNode *node1 = new Wt::WTreeTableNode("Upper Management", 0, root);
* Wt::WTreeTableNode *node2;
* node2 = new Wt::WTreeTableNode("Chief Anything Officer", 0, node1);
* node2->setColumnWidget(1, new Wt::WText("-2.8"));
* node2->setColumnWidget(2, new Wt::WText("20"));
* node2->setColumnWidget(3, new Wt::WText("Scepter"));
*
* node2 = new WTreeTableNode("Vice President of Parties", 0, node1);
* node2->setColumnWidget(1, new Wt::WText("13.57"));
* node2->setColumnWidget(2, new Wt::WText("365"));
* node2->setColumnWidget(3, new Wt::WText("Flag"));
*
* root->expand();
* \endcode
* \endif
*
* <h3>CSS</h3>
*
* The treetable is styled by the current CSS theme. The look can be
* overridden using the <tt>Wt-treetable</tt> CSS class. The style
* selectors that affect the rendering of the tree are indicated in
* the documentation for WTree (for selection) and WTreeNode (for
* decoration). In addition, the following selector may be used to to
* style the header:
*
* \verbatim
.Wt-treetable .Wt-header : header
\endverbatim
*
* A screenshot of the treetable:
* \image html WTreeTable-default-1.png "An example WTreeTable (default)"
* \image html WTreeTable-polished-1.png "An example WTreeTable (polished)"
*
* \sa WTreeTableNode, WTreeView
*/
class WT_API WTreeTable : public WCompositeWidget
{
public:
/*! \brief Creates a new tree table.
*
* The treeRoot() is \c 0. The table should first be properly dimensioned
* using addColumn() calls, and then data using setTreeRoot().
*/
WTreeTable(WContainerWidget *parent = 0);
/*! \brief Adds an extra column.
*
* Add an extra column, specifying the column header and a column
* width. The extra columns are numbered from 1 as column 0 contains
* the tree itself. The header for column 0 (the tree itself) is
* specified in setTreeRoot(), and the width of column 0 takes the
* remaining available width.
*/
void addColumn(const WString& header, const WLength& width);
/*! \brief Returns the number of columns in this table.
*
* Returns the number of columns in the table, including in the count
* column 0 (which contains the tree).
*
* \sa addColumn()
*/
int columnCount() const { return (int)columnWidths_.size(); }
/*! \brief Sets the tree root.
*
* Sets the data for the tree table, and specify the header for the
* first column.
*
* \sa treeRoot(), setTree(WTree *tree, const WString&)
*/
void setTreeRoot(WTreeTableNode *root, const WString& header);
/*! \brief Returns the tree root.
*/
WTreeTableNode *treeRoot();
/*! \brief Sets the tree which provides the data for the tree table.
*
* \sa setTreeRoot(WTreeTableNode *, const WString&).
*/
void setTree(WTree *tree, const WString& header);
/*! \brief Returns the tree that provides the data this table.
*
* \sa setTree(WTree *tree, const WString&).
*/
WTree *tree() const { return tree_; }
/*! \brief Returns 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.
*
* \sa addColumn(), setTreeRoot()
*/
WLength columnWidth(int column) const { return columnWidths_[column]; }
/*! \brief Returns the header for the given column.
*
* \sa addColumn(), setTreeRoot()
*/
WText *header(int column) const;
/*! \brief Returns the header widget.
*
* This is the widget that contains the column headers.
*/
WWidget *headerWidget() const;
protected:
virtual void render(WFlags<RenderFlag> flags);
private:
WContainerWidget *impl_;
WContainerWidget *headers_;
WContainerWidget *headerContainer_;
WTree *tree_;
std::vector<WLength> columnWidths_;
void defineJavaScript();
};
}
#endif // WTREETABLE_H_
|