Mana
|
A table, with rows and columns made out of sub-widgets. More...
#include <table.h>
Public Member Functions | |
GuiTable (TableModel *initialModel=nullptr, gcn::Color background=0xffffff, bool opacity=true) | |
~GuiTable () override | |
TableModel * | getModel () const |
Retrieves the active table model. | |
void | setModel (TableModel *m) |
Sets the table model. | |
void | setSelected (int row, int column) |
int | getSelectedRow () const |
int | getSelectedColumn () const |
void | setSelectedRow (int selected) |
void | setSelectedColumn (int selected) |
bool | isWrappingEnabled () const |
void | setWrappingEnabled (bool wrappingEnabled) |
gcn::Rectangle | getChildrenArea () override |
void | setLinewiseSelection (bool linewise) |
Toggle whether to use linewise selection mode, in which the table selects an entire line at a time, rather than a single cell. | |
void | draw (gcn::Graphics *graphics) override |
void | drawFrame (gcn::Graphics *graphics) override |
gcn::Widget * | getWidgetAt (int x, int y) override |
void | moveToTop (gcn::Widget *child) override |
void | moveToBottom (gcn::Widget *child) override |
void | _setFocusHandler (gcn::FocusHandler *focusHandler) override |
void | keyPressed (gcn::KeyEvent &keyEvent) override |
void | setOpaque (bool opaque) |
Sets the table to be opaque, that is sets the table to display its background. | |
bool | isOpaque () const |
Checks if the table is opaque, that is if the table area displays its background. | |
void | mousePressed (gcn::MouseEvent &mouseEvent) override |
void | mouseWheelMovedUp (gcn::MouseEvent &mouseEvent) override |
void | mouseWheelMovedDown (gcn::MouseEvent &mouseEvent) override |
void | mouseDragged (gcn::MouseEvent &mouseEvent) override |
void | modelUpdated (bool) override |
Must be invoked by the TableModel whenever a global change is about to occur or has occurred (e.g., when a row or column is being removed or added). | |
![]() | |
virtual | ~TableModelListener () |
Protected Member Functions | |
void | uninstallActionListeners () |
Frees all action listeners on inner widgets. | |
void | installActionListeners () |
Installs all action listeners on inner widgets. | |
int | getRowHeight () const |
int | getColumnWidth (int i) const |
Private Member Functions | |
int | getRowForY (int y) const |
int | getColumnForX (int x) const |
void | recomputeDimensions () |
Private Attributes | |
bool | mLinewiseMode = false |
bool | mWrappingEnabled = false |
bool | mOpaque |
gcn::Color | mBackgroundColor |
Holds the background color of the table. | |
TableModel * | mModel = nullptr |
int | mSelectedRow = 0 |
int | mSelectedColumn = 0 |
gcn::Widget * | mTopWidget = nullptr |
If someone moves a fresh widget to the top, we must display it. | |
std::vector< GuiTableActionListener * > | mActionListeners |
Vector for compactness; used as a list in practice. | |
Friends | |
class | GuiTableActionListener |
A table, with rows and columns made out of sub-widgets.
Largely inspired by (and can be thought of as a generalisation of) the guichan listbox implementation.
Normally you want this within a ScrollArea.
GuiTable::GuiTable | ( | TableModel * | initialModel = nullptr , |
gcn::Color | background = 0xffffff , |
||
bool | opacity = true |
||
) |
|
override |
|
inlineoverride |
TableModel * GuiTable::getModel | ( | ) | const |
|
override |
|
protected |
|
inline |
|
override |
|
overridevirtual |
Must be invoked by the TableModel whenever a global change is about to occur or has occurred (e.g., when a row or column is being removed or added).
This method is triggered twice, once before and once after the update.
completed | whether we are signalling the end of the update |
Implements TableModelListener.
|
override |
|
override |
|
override |
|
override |
|
override |
void GuiTable::setLinewiseSelection | ( | bool | linewise | ) |
Toggle whether to use linewise selection mode, in which the table selects an entire line at a time, rather than a single cell.
Note that column information is tracked even in linewise selection mode; this mode therefore only affects visualisation.
Disabled by default.
linewise | Whether to enable linewise selection mode |
void GuiTable::setModel | ( | TableModel * | m | ) |
Sets the table model.
Note that actions issued by widgets returned from the model will update the table selection, but only AFTER any event handlers installed within the widget have been triggered. To be notified after such an update, add an action listener to the table instead.
|
inline |
|
inline |
|
protected |
|
friend |
|
private |
|
private |
|
private |
|
private |