GuiTable Class Reference
[Core GUI related classes (widgets)]

#include <table.h>

Inheritance diagram for GuiTable:

TableModelListener

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 ()
TableModelgetModel () const
 Retrieves the active table model.
void setModel (TableModel *m)
 Sets the table model.
const TableModelgetModel ()
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.
TableModelmModel
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 
)

Definition at line 82 of file table.cpp.

GuiTable::~GuiTable (  )  [virtual]

Definition at line 100 of file table.cpp.


Member Function Documentation

TableModel * GuiTable::getModel (  )  const

Retrieves the active table model.

Definition at line 106 of file table.cpp.

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.

Definition at line 111 of file table.cpp.

const TableModel* GuiTable::getModel (  )  [inline]

Definition at line 73 of file table.h.

void GuiTable::setSelected ( int  row,
int  column 
)

Definition at line 151 of file table.cpp.

int GuiTable::getSelectedRow (  ) 

Definition at line 157 of file table.cpp.

int GuiTable::getSelectedColumn (  ) 

Definition at line 162 of file table.cpp.

void GuiTable::setSelectedRow ( int  selected  ) 

Definition at line 188 of file table.cpp.

void GuiTable::setSelectedColumn ( int  selected  ) 

Definition at line 216 of file table.cpp.

bool GuiTable::isWrappingEnabled (  )  const [inline]

Definition at line 85 of file table.h.

void GuiTable::setWrappingEnabled ( bool  wrappingEnabled  )  [inline]

Definition at line 87 of file table.h.

gcn::Rectangle GuiTable::getChildrenArea ( void   ) 

Definition at line 371 of file table.cpp.

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]

Definition at line 267 of file table.cpp.

gcn::Widget * GuiTable::getWidgetAt ( int  x,
int  y 
) [virtual]

Definition at line 481 of file table.cpp.

void GuiTable::moveToTop ( gcn::Widget *  child  )  [virtual]

Definition at line 358 of file table.cpp.

void GuiTable::moveToBottom ( gcn::Widget *  child  )  [virtual]

Definition at line 364 of file table.cpp.

void GuiTable::_setFocusHandler ( gcn::FocusHandler *  focusHandler  )  [virtual]

Definition at line 529 of file table.cpp.

void GuiTable::keyPressed ( gcn::KeyEvent &  keyEvent  )  [virtual]

Definition at line 377 of file table.cpp.

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]

Definition at line 421 of file table.cpp.

void GuiTable::mouseWheelMovedUp ( gcn::MouseEvent &  mouseEvent  )  [virtual]

Definition at line 439 of file table.cpp.

void GuiTable::mouseWheelMovedDown ( gcn::MouseEvent &  mouseEvent  )  [virtual]

Definition at line 452 of file table.cpp.

void GuiTable::mouseDragged ( gcn::MouseEvent &  mouseEvent  )  [virtual]

Definition at line 462 of file table.cpp.

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]

Definition at line 172 of file table.cpp.

int GuiTable::getColumnWidth ( int  i  )  [protected, virtual]

Definition at line 180 of file table.cpp.

int GuiTable::getRowForY ( int  y  )  [private]

Definition at line 501 of file table.cpp.

int GuiTable::getColumnForX ( int  x  )  [private]

Definition at line 511 of file table.cpp.

void GuiTable::recomputeDimensions (  )  [private]

Definition at line 129 of file table.cpp.


Friends And Related Function Documentation

friend class GuiTableActionListener [friend]

Definition at line 50 of file table.h.


Member Data Documentation

bool GuiTable::mLinewiseMode [private]

Definition at line 160 of file table.h.

Definition at line 161 of file table.h.

bool GuiTable::mOpaque [private]

Definition at line 162 of file table.h.

float GuiTable::mAlpha = 1.0 [static, private]

Definition at line 164 of file table.h.

gcn::Color GuiTable::mBackgroundColor [private]

Holds the background color of the table.

Definition at line 169 of file table.h.

Definition at line 171 of file table.h.

int GuiTable::mSelectedRow [private]

Definition at line 173 of file table.h.

Definition at line 174 of file table.h.

int GuiTable::mPopFramesNr [private]

Number of frames to skip upwards when drawing the selected widget.

Definition at line 177 of file table.h.

gcn::Widget* GuiTable::mTopWidget [private]

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:

Generated on Sun Apr 26 17:30:43 2009 for The Mana World by  doxygen 1.5.5