/usr/include/Wt/WTable is in libwt-dev 3.3.6+dfsg-1.1.
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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | // 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 WTABLE_H_
#define WTABLE_H_
#include <Wt/WInteractWidget>
#include <Wt/WTableCell>
#include <Wt/WTableColumn>
#include <Wt/WTableRow>
namespace Wt {
/*! \class WTable Wt/WTable Wt/WTable
* \brief A container widget which provides layout of children in a table grid.
*
* A %WTable arranges its children in a table.
*
* To insert or access contents, use elementAt(int row, int column) to
* access the \link WTableCell cell\endlink at a particular location
* in the table. The %WTable expands automatically to create the indexed
* (row, column) as necessary.
*
* It is possible to insert and delete entire rows or columns from the
* table using the insertColumn(int column), insertRow(int row),
* deleteColumn(int column), or deleteRow(int row) methods.
*
* You may indicate a number of rows and columns that act as headers
* using setHeaderCount(). Header cells are rendered as
* <tt><th></tt> instead of <tt><td></tt> elements. By
* default, no rows or columns are configured as headers.
*
* %WTable is displayed as a \link WWidget::setInline(bool) block\endlink.
*
* \if cpp
* Usage example:
* \code
* Wt::WTable *table = new Wt::WTable(this);
* table->elementAt(0, 0)->addWidget(new Wt::WText("Item @ row 0, column 0"));
* table->elementAt(0, 1)->addWidget(new Wt::WText("Item @ row 0, column 1"));
* table->elementAt(1, 0)->addWidget(new Wt::WText("Item @ row 1, column 0"));
* table->elementAt(1, 1)->addWidget(new Wt::WText("Item @ row 1, column 1"));
*
* Wt::WTableCell *cell = table->elementAt(2, 0);
* cell->addWidget(new Wt::WText("Item @ row 2"));
* cell->setColumnSpan(2);
* \endcode
* \endif
*
* <h3>CSS</h3>
*
* The widget corresponds to the HTML <tt><table></tt> tag and
* does not provide styling. It can be styled using inline or external
* CSS as appropriate.
*
* \sa WTableCell, WTableRow, WTableColumn
*/
class WT_API WTable : public WInteractWidget
{
public:
/*! \brief Creates an empty table.
*/
WTable(WContainerWidget *parent = 0);
/*! \brief Deletes the table and its entire contents.
*/
virtual ~WTable();
/*! \brief Accesses the table element at the given row and column.
*
* If the row/column is beyond the current table dimensions, then
* the table is expanded automatically.
*/
WTableCell *elementAt(int row, int column);
/*! \brief Returns the row object for the given row.
*
* Like with elementAt(), the table expands automatically when the row
* is beyond the current table dimensions.
*
* \sa elementAt(int, int), columnAt(int)
*/
WTableRow *rowAt(int row);
/*! \brief Returns the column object for the given column.
*
* Like with elementAt(), the table expands automatically when the
* column is beyond the current table dimensions.
*
* \sa elementAt(int, int), rowAt(int)
*/
WTableColumn *columnAt(int column);
/*! \brief Deletes a table cell and its contents.
*
* The table cell at that position is recreated.
*
* \sa removeCell(int int)
*/
void removeCell(WTableCell *item);
/*! \brief Deletes the table cell at the given position.
*
* \sa removeCell(WTableCell *)
*/
virtual void removeCell(int row, int column);
/*! \brief Inserts an empty row.
*/
virtual WTableRow* insertRow(int row, WTableRow *tableRow = 0);
/*! \brief Deletes a row and all its contents.
*
* Rows below the given row are shifted up.
*/
virtual void deleteRow(int row);
/*! \brief Inserts an empty column.
*/
virtual WTableColumn* insertColumn(int column, WTableColumn *tableColumn = 0);
/*! \brief Delete a column and all its contents.
*/
virtual void deleteColumn(int column);
/*! \brief Clears the entire table.
*
* This method clears the entire table: all cells and their contents
* are deleted.
*/
virtual void clear();
/*! \brief Returns the number of rows in the table.
*/
int rowCount() const;
/*! \brief Returns the number of columns in the table.
*/
int columnCount() const;
/*! \brief Sets the number of header rows or columns.
*
* The default values are 0.
*
* \note This must be set before the initial rendering and cannot
* be changed later.
*/
void setHeaderCount(int count, Orientation orientation = Horizontal);
/*! \brief Returns the number of header rows or columns.
*
* \sa setHeaderCount()
*/
int headerCount(Orientation orientation = Horizontal);
/*! \brief Move a table row from its original position to a new position.
*
* The table expands automatically when the \p to row is beyond the
* current table dimensions.
*
* \sa moveColumn()
*/
virtual void moveRow(int from, int to);
/*! \brief Move a table column from its original position to a new position.
*
* The table expands automatically when the \p to column is beyond
* the current table dimensions.
*
* \sa moveRow()
*/
virtual void moveColumn(int from, int to);
private:
static const int BIT_GRID_CHANGED = 0;
static const int BIT_COLUMNS_CHANGED = 1;
std::bitset<3> flags_;
std::vector<WTableRow *> rows_;
std::vector<WTableColumn *> columns_;
std::set<WTableRow *> *rowsChanged_;
unsigned rowsAdded_;
int headerRowCount_, headerColumnCount_;
void expand(int row, int column, int rowSpan, int columnSpan);
WTableRow::TableData& itemAt(int row, int column);
void repaintRow(WTableRow *row);
void repaintColumn(WTableColumn *col);
friend class WTableCell;
friend class WTableColumn;
friend class WTableRow;
protected:
/*! \brief Creates a table cell.
*
* You may want to override this method if you want your table to
* contain specialized cells.
*/
virtual WTableCell* createCell(int row, int column);
/*! \brief Creates a table row.
*
* You may want to override this method if you want your table to
* contain specialized rows.
*/
virtual WTableRow* createRow(int row);
/*! \brief Creates a table column.
*
* You may want to override this method if you want your table to
* contain specialized columns.
*/
virtual WTableColumn* createColumn(int column);
virtual void updateDom(DomElement& element, bool all);
virtual DomElementType domElementType() const;
virtual DomElement *createDomElement(WApplication *app);
virtual void getDomChanges(std::vector<DomElement *>& result,
WApplication *app);
virtual void propagateRenderOk(bool deep);
private:
DomElement *createRowDomElement(int row, bool withIds, WApplication *app);
};
}
#endif // WTABLE_H_
|