#include <table.h>
List of all members.
Detailed Description
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.
Definition at line 44 of file table.h.
|
Public Member Functions |
| GuiTable (TableModel *initial_model=NULL, gcn::Color background=0xffffff, bool opacity=true) |
virtual | ~GuiTable () |
TableModel * | getModel () const |
| Retrieves the active table model.
|
void | setModel (TableModel *m) |
| Sets the table model.
|
const TableModel * | getModel () |
void | setSelected (int row, int column) |
int | getSelectedRow () |
int | getSelectedColumn () |
void | setSelectedRow (int selected) |
void | setSelectedColumn (int selected) |
bool | isWrappingEnabled () const |
void | setWrappingEnabled (bool wrappingEnabled) |
gcn::Rectangle | getChildrenArea (void) |
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.
|
virtual void | draw (gcn::Graphics *graphics) |
virtual gcn::Widget * | getWidgetAt (int x, int y) |
virtual void | moveToTop (gcn::Widget *child) |
virtual void | moveToBottom (gcn::Widget *child) |
virtual void | _setFocusHandler (gcn::FocusHandler *focusHandler) |
virtual void | keyPressed (gcn::KeyEvent &keyEvent) |
virtual void | setOpaque (bool opaque) |
| Sets the table to be opaque, that is sets the table to display its background.
|
virtual bool | isOpaque () const |
| Checks if the table is opaque, that is if the table area displays its background.
|
virtual void | mousePressed (gcn::MouseEvent &mouseEvent) |
virtual void | mouseWheelMovedUp (gcn::MouseEvent &mouseEvent) |
virtual void | mouseWheelMovedDown (gcn::MouseEvent &mouseEvent) |
virtual void | mouseDragged (gcn::MouseEvent &mouseEvent) |
virtual void | modelUpdated (bool) |
| 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).
|
Protected Member Functions |
virtual void | uninstallActionListeners () |
| Frees all action listeners on inner widgets.
|
virtual void | installActionListeners () |
| Installs all action listeners on inner widgets.
|
virtual int | getRowHeight () |
virtual int | getColumnWidth (int i) |
Private Member Functions |
int | getRowForY (int y) |
int | getColumnForX (int x) |
void | recomputeDimensions () |
Private Attributes |
bool | mLinewiseMode |
bool | mWrappingEnabled |
bool | mOpaque |
gcn::Color | mBackgroundColor |
| Holds the background color of the table.
|
TableModel * | mModel |
int | mSelectedRow |
int | mSelectedColumn |
int | mPopFramesNr |
| Number of frames to skip upwards when drawing the selected widget.
|
gcn::Widget * | mTopWidget |
| 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.
|
Static Private Attributes |
static float | mAlpha = 1.0 |
Friends |
class | GuiTableActionListener |
Constructor & Destructor Documentation
GuiTable::GuiTable |
( |
TableModel * |
initial_model = NULL , |
|
|
gcn::Color |
background = 0xffffff , |
|
|
bool |
opacity = true | |
|
) |
| | |
GuiTable::~GuiTable |
( |
|
) |
[virtual] |
Member Function Documentation
Retrieves the active table model.
Definition at line 106 of file table.cpp.
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.
Definition at line 111 of file table.cpp.
void GuiTable::setSelected |
( |
int |
row, |
|
|
int |
column | |
|
) |
| | |
int GuiTable::getSelectedRow |
( |
|
) |
|
int GuiTable::getSelectedColumn |
( |
|
) |
|
void GuiTable::setSelectedRow |
( |
int |
selected |
) |
|
void GuiTable::setSelectedColumn |
( |
int |
selected |
) |
|
bool GuiTable::isWrappingEnabled |
( |
|
) |
const [inline] |
void GuiTable::setWrappingEnabled |
( |
bool |
wrappingEnabled |
) |
[inline] |
gcn::Rectangle GuiTable::getChildrenArea |
( |
void |
|
) |
|
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.
- Parameters:
-
| linewise,: | Whether to enable linewise selection mode |
Definition at line 167 of file table.cpp.
void GuiTable::draw |
( |
gcn::Graphics * |
graphics |
) |
[virtual] |
gcn::Widget * GuiTable::getWidgetAt |
( |
int |
x, |
|
|
int |
y | |
|
) |
| | [virtual] |
void GuiTable::moveToTop |
( |
gcn::Widget * |
child |
) |
[virtual] |
void GuiTable::moveToBottom |
( |
gcn::Widget * |
child |
) |
[virtual] |
void GuiTable::_setFocusHandler |
( |
gcn::FocusHandler * |
focusHandler |
) |
[virtual] |
void GuiTable::keyPressed |
( |
gcn::KeyEvent & |
keyEvent |
) |
[virtual] |
virtual void GuiTable::setOpaque |
( |
bool |
opaque |
) |
[inline, virtual] |
Sets the table to be opaque, that is sets the table to display its background.
- Parameters:
-
| opaque | True if the table should be opaque, false otherwise. |
Definition at line 125 of file table.h.
virtual bool GuiTable::isOpaque |
( |
|
) |
const [inline, virtual] |
Checks if the table is opaque, that is if the table area displays its background.
- Returns:
- True if the table is opaque, false otherwise.
Definition at line 133 of file table.h.
void GuiTable::mousePressed |
( |
gcn::MouseEvent & |
mouseEvent |
) |
[virtual] |
void GuiTable::mouseWheelMovedUp |
( |
gcn::MouseEvent & |
mouseEvent |
) |
[virtual] |
void GuiTable::mouseWheelMovedDown |
( |
gcn::MouseEvent & |
mouseEvent |
) |
[virtual] |
void GuiTable::mouseDragged |
( |
gcn::MouseEvent & |
mouseEvent |
) |
[virtual] |
void GuiTable::modelUpdated |
( |
bool |
completed |
) |
[virtual] |
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.
- Parameters:
-
| completed | whether we are signalling the end of the update |
Implements TableModelListener.
Definition at line 467 of file table.cpp.
void GuiTable::uninstallActionListeners |
( |
void |
|
) |
[protected, virtual] |
Frees all action listeners on inner widgets.
Definition at line 241 of file table.cpp.
void GuiTable::installActionListeners |
( |
|
) |
[protected, virtual] |
Installs all action listeners on inner widgets.
Definition at line 247 of file table.cpp.
int GuiTable::getRowHeight |
( |
|
) |
[protected, virtual] |
int GuiTable::getColumnWidth |
( |
int |
i |
) |
[protected, virtual] |
int GuiTable::getRowForY |
( |
int |
y |
) |
[private] |
int GuiTable::getColumnForX |
( |
int |
x |
) |
[private] |
void GuiTable::recomputeDimensions |
( |
|
) |
[private] |
Friends And Related Function Documentation
Member Data Documentation
Holds the background color of the table.
Definition at line 169 of file table.h.
Number of frames to skip upwards when drawing the selected widget.
Definition at line 177 of file table.h.
If someone moves a fresh widget to the top, we must display it.
Definition at line 180 of file table.h.
Vector for compactness; used as a list in practice.
Definition at line 183 of file table.h.
The documentation for this class was generated from the following files: