GnuCashew ~ GnuCash Enabled Web
GCW
|
Custom Table View Class. More...
#include <TableView.h>
Inherits Wt::WTableView.
Public Member Functions | |
TableView () | |
auto | layoutSizeChanged (int width, int height) -> void override |
auto | setColumnWidth (int column, const Wt::WLength &width) -> void override |
auto | setVisibleRows (int rows) -> void |
Static Public Attributes | |
static const int | kTableHeaderRowHeight = 30 |
static const int | kTableBodyRowHeight = 20 |
static const int | kTableCellPadding = 7 |
static const int | kScrollBarWidth = 20 |
static const int | kDefaultDateTimeWidth = 120 |
Protected Member Functions | |
auto | handleMouseDown (const Wt::WModelIndex &_index, const Wt::WMouseEvent &_event) -> void |
Handle Click Event. More... | |
Protected Attributes | |
Wt::WModelIndex | m_lastIndexClick |
std::map< int, Wt::WLength > | widths_ |
int | visible_rows_ = -1 |
int | m_editingRow = -1 |
Custom Table View Class.
Implementing our own table view class derived from the Wt one. This implementation is designed to be layout aware.
Code Credit: https://redmine.webtoolkit.eu/boards/1/topics/11110?r=18058#message-18058
Definition at line 22 of file TableView.h.
GCW::Gui::TableView::TableView | ( | ) |
Definition at line 99 of file TableView.cpp.
References kTableBodyRowHeight, and kTableHeaderRowHeight.
|
protected |
Handle Click Event.
This handler responds to 'click' events in the view.
The intent here is to provide some 'handling' when the user is mouse-ing around the table view. He should be able to click around to get editors to open, and select rows and whatnot.
The 'purpose' for the handler is due to the fact that the view responds differently if the view is editable or not. For instance, if an index is read-only, clicking on it causes the view to 'select' the entire row. But, if the index is 'Editable' then you are placed in to the editor but the view 'selection' is still visible, even if it's on another row. Further, the editor widget that opened, did not signal to the rest of the row that it should be 'selected'.
Definition at line 486 of file TableView.cpp.
References BREAKFOOTER, and BREAKHEADER.
|
override |
Upon a table resize, size the columns appropriately.
int | width Full table width |
int | height Full table height |
Definition at line 258 of file TableView.cpp.
|
override |
Overload setColumnWidth so we can save what the user specifies into our map. This implementation can take both absolute and relative (percentage) widths. Percentages are interpretted as the percentage of non-allocated width remaining. i.e. if a table is 100px, and one column has an absolute width of 20px, then the two following relative columns should both use 50%, which would yeild 40px each (minus padding.)
Definition at line 320 of file TableView.cpp.
|
inline |
Set the number of visible rows before a scroll bar appears
Definition at line 68 of file TableView.h.
References visible_rows_.
|
static |
Default fixed width a date/time column takes up (without wrapping)
Definition at line 40 of file TableView.h.
|
static |
Width that a scroll bar adds to a table
Definition at line 37 of file TableView.h.
|
static |
|
static |
Assumed table cell padding
Definition at line 34 of file TableView.h.
|
static |
|
protected |
Definition at line 95 of file TableView.h.
|
protected |
Definition at line 77 of file TableView.h.
|
protected |
Definition at line 89 of file TableView.h.
Referenced by setVisibleRows().
|
protected |
Definition at line 83 of file TableView.h.