MAUI::Layout Class Reference

#include <MAUI/Layout.h>

Inheritance diagram for MAUI::Layout:

MAUI::Widget MAUI::WidgetListener List of all members.

Detailed Description

This widget is responsible for laying out its children in a grid. It also provides navigation facilites within that grid, so that the children can be selected and triggered.


Public Types

enum  HorizontalAlignment { HA_LEFT, HA_CENTER, HA_RIGHT }
enum  VerticalAlignment { VA_TOP, VA_CENTER, VA_BOTTOM }

Public Member Functions

 Layout (int x, int y, int width, int height, Widget *parent=0)
 Layout (int x, int y, int width, int height, Widget *parent, int gridXSize, int gridYSize)
void add (Widget *w)
void drawWidget ()
void setMarginX (int p)
void setMarginY (int p)
void setHorizontalAlignment (HorizontalAlignment alignment)
void setVerticalAlignment (VerticalAlignment alignment)
void setAutoSizeX (bool f=true)
void setAutoSizeY (bool f=true)
void setNumColumns (int numColumns)
void setNumRows (int numRows)
void setPosition (int x, int y)
void setWidth (int width)
void setHeight (int height)
void goUp ()
void goDown ()
void goRight ()
void goLeft ()
void trigger ()
virtual void update ()
void setParent (Widget *w)
WidgetgetParent ()
Vector< Widget * > & getChildren ()
const Vector< Widget * > & getChildren () const
virtual void draw (bool forceDraw=false)
void requestRepaint ()
virtual bool isTransparent () const
virtual void setSkin (WidgetSkin *widgetSkin)
void setDrawBackground (bool b=true)
void setBackgroundColor (int col)
WidgetwidgetAt (const Point &p)
WidgetwidgetAt (int x, int y)
const PointgetPosition () const
const PointgetPaddedPosition () const
int getWidth () const
int getHeight () const
virtual const RectgetBounds ()
virtual bool contains (const Point &p)
virtual bool contains (int x, int y)
virtual void setSelected (bool selected=true)
bool isSelected () const
virtual void setEnabled (bool enabled=true)
bool isEnabled () const
void addWidgetListener (WidgetListener *wl)
void removeWidgetListener (WidgetListener *wl)
Vector< WidgetListener * > & getWidgetListeners ()
void setInputManager (InputManager *inputManager)
virtual void setPaddingLeft (int l)
virtual void setPaddingTop (int t)
virtual void setPaddingRight (int r)
virtual void setPaddingBottom (int b)
int getPaddingLeft () const
int getPaddingTop () const
int getPaddingRight () const
int getPaddingBottom () const
const RectgetPaddedBounds () const
virtual void setParameter (const String &name, const String &value)

Protected Member Functions

void rebuild ()
void boundsChanged (Widget *widget, const Rect &bounds)
void drawBackground ()
void updateAbsolutePosition ()
void updateAbsolutePositionChildren (int x, int y)
void updatePaddedBounds ()
bool isDirty () const
void setDirty (bool d=true)

Protected Attributes

bool mustRebuild
HorizontalAlignment alignmentX
VerticalAlignment alignmentY
int marginX
int marginY
bool autoSizeX
bool autoSizeY
int gridXSize
int gridYSize
int selectedIndex
Vector< Widget * > children
Widgetparent
Rect bounds
int relX
int relY
bool dirty
WidgetSkinskin
int backColor
bool shouldDrawBackground
bool selected
bool enabled
Vector< WidgetListener * > widgetListeners
InputManagermInputManager
Rect paddedBounds
int paddingLeft
int paddingTop
int paddingBottom
int paddingRight


Member Enumeration Documentation

enum MAUI::Layout::HorizontalAlignment
 

Enumerator:
HA_LEFT 
HA_CENTER 
HA_RIGHT 

enum MAUI::Layout::VerticalAlignment
 

Enumerator:
VA_TOP 
VA_CENTER 
VA_BOTTOM 


Constructor & Destructor Documentation

MAUI::Layout::Layout int  x,
int  y,
int  width,
int  height,
Widget parent = 0
 

Constructor.

Parameters:
x the horizontal position of the Layout relative to its parent's top left padded corner.
y the vertical position of the Layout relative to its parent's top left padded corner
width the width of the Layout.
height the height of the Layout.
parent pointer to the parent widget. Passing anything else than NULL causes the Layout to be added to the parent's children.

MAUI::Layout::Layout int  x,
int  y,
int  width,
int  height,
Widget parent,
int  gridXSize,
int  gridYSize
 

Constructor.

Parameters:
x the horizontal position of the Label relative to its parent's top left padded corner.
y the vertical position of the Label relative to its parent's top left padded corner
width the width of the Label.
height the height of the Label.
parent pointer to the parent widget. Passing anything else than NULL causes the Label to be added to the parent's children.
gridXSize the number of columns in the grid.
gridYSize the number of rows in the grid.


Member Function Documentation

void MAUI::Layout::add Widget w  )  [virtual]
 

Overloaded implementation of Widget::add(), with the same external semantics.

Reimplemented from MAUI::Widget.

void MAUI::Layout::drawWidget  )  [virtual]
 

Overloaded implementation of drawWidget().

Implements MAUI::Widget.

void MAUI::Layout::setMarginX int  p  ) 
 

Sets the x margin of each widget relative to the grid cell it resides in.

void MAUI::Layout::setMarginY int  p  ) 
 

Sets the y margin of each widget relative to the grid cell it resides in.

void MAUI::Layout::setHorizontalAlignment HorizontalAlignment  alignment  ) 
 

Sets the horizontal alignment of the child widget within their grid cells.

void MAUI::Layout::setVerticalAlignment VerticalAlignment  alignment  ) 
 

Sets the vertical alignment of the child widget within their grid cells.

void MAUI::Layout::setAutoSizeX bool  f = true  ) 
 

Sets the horizontal autosize property, determining wether the grid columns are resized so that the widest of its children fits.

void MAUI::Layout::setAutoSizeY bool  f = true  ) 
 

Sets the vertical autosize property, determining wether the grid rows are resized so that the widest of its children fits.

void MAUI::Layout::setNumColumns int  numColumns  ) 
 

Sets the number of columns in the grid.

void MAUI::Layout::setNumRows int  numRows  ) 
 

Sets the number of rows in the grid.

void MAUI::Layout::setPosition int  x,
int  y
[virtual]
 

Sets the position of the widget, relative to the parent

Reimplemented from MAUI::Widget.

void MAUI::Layout::setWidth int  width  )  [virtual]
 

Sets the width of the widget

Reimplemented from MAUI::Widget.

void MAUI::Layout::setHeight int  height  )  [virtual]
 

Sets the height of the widget

Reimplemented from MAUI::Widget.

void MAUI::Layout::goUp  ) 
 

Navigate to the cell above the currently selected one

void MAUI::Layout::goDown  ) 
 

Navigate to the cell below the currently selected one

void MAUI::Layout::goRight  ) 
 

Navigate to the cell to the right of the currently selected one

void MAUI::Layout::goLeft  ) 
 

Navigate to the cell to the left the currently selected one

void MAUI::Layout::trigger  )  [virtual]
 

Cause the currently selected cell's widget to be triggered

Reimplemented from MAUI::Widget.

virtual void MAUI::Layout::update  )  [virtual]
 

Reimplemented from MAUI::Widget.

void MAUI::Layout::rebuild  )  [protected]
 

void MAUI::Layout::boundsChanged Widget widget,
const Rect bounds
[protected, virtual]
 

This function is called whenever the widget being listened to is resized or moved.

Reimplemented from MAUI::WidgetListener.

void MAUI::Widget::setParent Widget w  )  [inherited]
 

Function used to set the parent of a widget. The widget will not be added to the parent as a child. The widget cannot have a parent already.

Widget* MAUI::Widget::getParent  )  [inherited]
 

Function to retrieve the parent of a widget.

Vector<Widget*>& MAUI::Widget::getChildren  )  [inherited]
 

Function to retrieve a reference to the list of childrens for a widget.

const Vector<Widget*>& MAUI::Widget::getChildren  )  const [inherited]
 

const version of getChildren()

virtual void MAUI::Widget::draw bool  forceDraw = false  )  [virtual, inherited]
 

Renders the Widget and all its children recursively.

Reimplemented in MAUI::ListBox.

void MAUI::Widget::requestRepaint  )  [inherited]
 

Registers an idle listener with the current environment that will redraw the widget and anything else that may be made dirty by doing so. For instance, if the widget is transparent its parent also has to be repainted, and so on recursively.

virtual bool MAUI::Widget::isTransparent  )  const [virtual, inherited]
 

Returns whether or not the widget is transparent. A widget is transparent if it has a skin that is transparent in the current selection state (selected/unselected) or if it has no solid background color.

virtual void MAUI::Widget::setSkin WidgetSkin widgetSkin  )  [virtual, inherited]
 

Assigns a widget skin to be used during the rendering of the widget. What The skin applies to varies depending on the widget. Labels extend the skin over their entire area, while listboxes apply the skin to each individual item they contain.

void MAUI::Widget::setDrawBackground bool  b = true  )  [inherited]
 

Sets the background drawing state. If b is true, the Widget's background will be drawn - otherwise not. In most cases, the background is either a constant color or a skin.

void MAUI::Widget::setBackgroundColor int  col  )  [inherited]
 

Widget* MAUI::Widget::widgetAt const Point p  )  [inherited]
 

Returns a pointer to the first child widget or deeper descendant, surrounding the point. Returns NULL if no widget is found.

Widget* MAUI::Widget::widgetAt int  x,
int  y
[inherited]
 

const Point& MAUI::Widget::getPosition  )  const [inherited]
 

Gets the widget's position relative to its parent.

const Point& MAUI::Widget::getPaddedPosition  )  const [inherited]
 

Gets the widget's padded position relative to its parent.

int MAUI::Widget::getWidth  )  const [inherited]
 

Returns the width of the widget

int MAUI::Widget::getHeight  )  const [inherited]
 

Returns the height of the widget

virtual const Rect& MAUI::Widget::getBounds  )  [virtual, inherited]
 

Returns a Rect containing the absolute screen position of the widget together with its dimensions.

virtual bool MAUI::Widget::contains const Point p  )  [virtual, inherited]
 

Check if widget surrounds position 'p'.

virtual bool MAUI::Widget::contains int  x,
int  y
[virtual, inherited]
 

Check if widget surrounds position 'x' and 'y'.

virtual void MAUI::Widget::setSelected bool  selected = true  )  [virtual, inherited]
 

Set widget selected state (default: true).

Reimplemented in MAUI::EditBox.

bool MAUI::Widget::isSelected  )  const [inherited]
 

Is widget selected?.

virtual void MAUI::Widget::setEnabled bool  enabled = true  )  [virtual, inherited]
 

Set Widget enabled state

Reimplemented in MAUI::EditBox.

bool MAUI::Widget::isEnabled  )  const [inherited]
 

Is Widget enabled ?

void MAUI::Widget::addWidgetListener WidgetListener wl  )  [inherited]
 

Add WidgetListener.

void MAUI::Widget::removeWidgetListener WidgetListener wl  )  [inherited]
 

Remove WidgetListener.

Vector<WidgetListener*>& MAUI::Widget::getWidgetListeners  )  [inherited]
 

returns a reference the the vector of Widget listeners

void MAUI::Widget::setInputManager InputManager inputManager  )  [inherited]
 

Sets the input manager to use for this widget

virtual void MAUI::Widget::setPaddingLeft int  l  )  [virtual, inherited]
 

Set left padding width.

Reimplemented in MAUI::Label.

virtual void MAUI::Widget::setPaddingTop int  t  )  [virtual, inherited]
 

Set top padding height.

Reimplemented in MAUI::Label.

virtual void MAUI::Widget::setPaddingRight int  r  )  [virtual, inherited]
 

Set right padding width.

Reimplemented in MAUI::Label.

virtual void MAUI::Widget::setPaddingBottom int  b  )  [virtual, inherited]
 

Set bottom padding height.

Reimplemented in MAUI::Label.

int MAUI::Widget::getPaddingLeft  )  const [inherited]
 

Get left padding width.

int MAUI::Widget::getPaddingTop  )  const [inherited]
 

Get top padding height.

int MAUI::Widget::getPaddingRight  )  const [inherited]
 

Get right padding width.

int MAUI::Widget::getPaddingBottom  )  const [inherited]
 

Get bottom padding height.

const Rect& MAUI::Widget::getPaddedBounds  )  const [inherited]
 

virtual void MAUI::Widget::setParameter const String name,
const String value
[virtual, inherited]
 

Reimplemented in MAUI::Label.

void MAUI::Widget::drawBackground  )  [protected, inherited]
 

void MAUI::Widget::updateAbsolutePosition  )  [protected, inherited]
 

This function is used to regenerate the absolute positions of each widget in the tree. This is done in a depth first manner where each widget takes the parent absolute position and adds it to their own relative position to calculate their absolute position.

void MAUI::Widget::updateAbsolutePositionChildren int  x,
int  y
[protected, inherited]
 

the recursive function used by updateAbsolutePosition().

void MAUI::Widget::updatePaddedBounds  )  [protected, inherited]
 

Used to recalculate the padded bounds from the global bounds.

bool MAUI::Widget::isDirty  )  const [protected, inherited]
 

Returns the dirty state of the widget, indicating whether it requires to be redrawn or not. When a widget calls requestRepaint(), it's dirty state is set to true. Normally, you shouldn't have to use isDirty() or setDirty() unless possibly when implementing your own widgets.

void MAUI::Widget::setDirty bool  d = true  )  [protected, inherited]
 

Sets the dirty state of the widget.


Member Data Documentation

bool MAUI::Layout::mustRebuild [protected]
 

HorizontalAlignment MAUI::Layout::alignmentX [protected]
 

VerticalAlignment MAUI::Layout::alignmentY [protected]
 

int MAUI::Layout::marginX [protected]
 

int MAUI::Layout::marginY [protected]
 

bool MAUI::Layout::autoSizeX [protected]
 

bool MAUI::Layout::autoSizeY [protected]
 

int MAUI::Layout::gridXSize [protected]
 

int MAUI::Layout::gridYSize [protected]
 

int MAUI::Layout::selectedIndex [protected]
 

Vector<Widget*> MAUI::Widget::children [protected, inherited]
 

Widget* MAUI::Widget::parent [protected, inherited]
 

Rect MAUI::Widget::bounds [protected, inherited]
 

int MAUI::Widget::relX [protected, inherited]
 

int MAUI::Widget::relY [protected, inherited]
 

bool MAUI::Widget::dirty [protected, inherited]
 

WidgetSkin* MAUI::Widget::skin [protected, inherited]
 

int MAUI::Widget::backColor [protected, inherited]
 

bool MAUI::Widget::shouldDrawBackground [protected, inherited]
 

bool MAUI::Widget::selected [protected, inherited]
 

bool MAUI::Widget::enabled [protected, inherited]
 

Vector<WidgetListener*> MAUI::Widget::widgetListeners [protected, inherited]
 

InputManager* MAUI::Widget::mInputManager [protected, inherited]
 

Rect MAUI::Widget::paddedBounds [protected, inherited]
 

int MAUI::Widget::paddingLeft [protected, inherited]
 

int MAUI::Widget::paddingTop [protected, inherited]
 

int MAUI::Widget::paddingBottom [protected, inherited]
 

int MAUI::Widget::paddingRight [protected, inherited]
 


Generated on Sat Feb 13 00:15:39 2010 for MoSync 2 beta 1 by  doxygen 1.4.6-NO