GuiFlowMenu Class Reference
[2D graphical user interface]

A class for showing a menu that (dis-)appears by flying out of/into the screen. More...

#include <guiflowmenu.h>

Inheritance diagram for GuiFlowMenu:

Inheritance graph
[legend]
Collaboration diagram for GuiFlowMenu:

Collaboration graph
[legend]
List of all members.

Public Member Functions

DECLSPEC GuiFlowMenu (TiXmlElement *el, GuiElement *p)
virtual const char * getClassName ()
long getActiveItemID ()
 
Returns:
the ID of the currently active item

GuiFlowMenuItemgetActiveItem ()
 
Returns:
the currently active GuiElement

void setFlyTime (Uint32 t)
void setShowRect (const SDL_Rect &r)
void setDisappearRect (const SDL_Rect &r)
DECLSPEC void appear ()
 Lets the window appear.
DECLSPEC void disappear ()
 Lets the window disappear.
void setChooseNextCallback (const BasicObject::FunctionData &fd)
void setNoNextCallback (const BasicObject::FunctionData &fd)
void setFlewInCallback (const BasicObject::FunctionData &fd)
void setBackCallback (const BasicObject::FunctionData &fd)

Static Public Member Functions

static void newguiobject (void *presult, BasicObject *o, void *xmldata)
static void flyout_back (void *sender, BasicObject *aim, void *)
static void flyout_next (void *sender, BasicObject *aim, void *)
static void flyout_disappear (void *sender, BasicObject *aim, void *)
static void flyin (void *sender, BasicObject *aim, void *)

Static Public Attributes

static const long ID_INVALID
 ID of invalid.

Protected Member Functions

virtual DECLSPEC void onInit ()
virtual DECLSPEC Uint32 onPosReached ()

Friends

class GuiFlowMenuItem

Detailed Description

A class for showing a menu that (dis-)appears by flying out of/into the screen.

Todo:
Add constructor without xml-usage.
Note:
This class may cause a crash, after showItem() failed


Constructor & Destructor Documentation

GuiFlowMenu::GuiFlowMenu ( TiXmlElement el,
GuiElement p 
)

Constructor. Uses XML data. If the attribute XmlFile is specified, the menu-items are created as specified in that XML-file: The root element must be "GuiFlowMenu", the children (1st generation) must be "MenuItem"s with an attribute "ID" (the ID of the item, see addMenuItem()) and the children 2nd generation must be usual "Gui*"-elements, but only one child per menu-item is observed (the 1st one).

Parameters:
el the XML data for initialisation, the following attributes are read: XmlFile (string, filename), StartMenuID (int), ShowRect (rect), DisappearRect (rect); Events: OnChooseNext, OnNoNext, OnFlewIn, OnDisappeared, OnBack.
p parent element
See also:
GuiFlowWindow(TiXmlElement*,GuiElement*)


Member Function Documentation

virtual const char* GuiFlowMenu::getClassName (  )  [inline, virtual]

This function should be overriden in every sub-class of BasicObject!

Returns:
the name of the class.

Reimplemented from GuiFlowWindow.

void GuiFlowMenu::setFlyTime ( Uint32  t  )  [inline]

Sets the duration of the menu's (dis)appearing.

Parameters:
t the time in millisecs

void GuiFlowMenu::setShowRect ( const SDL_Rect &  r  )  [inline]

Sets the rect to which the window flies, when it appeares. That is the position, where it stays when being visible to the user.

Parameters:
r the rect

void GuiFlowMenu::setDisappearRect ( const SDL_Rect &  r  )  [inline]

Sets the rect to which the window flies, when disappear() is called. This is the same rect, where it starts flying from, when appear() is called.

Parameters:
r the rect

void GuiFlowMenu::setChooseNextCallback ( const BasicObject::FunctionData fd  )  [inline]

Sets the callback function that is called, after the window flew out of the screen.

Parameters:
fd the callback data
Note:
the 3rd param of the callback-function points to an integer value equal to the result of getActiveItemID() (that is the ID of the window that just flew out).

void GuiFlowMenu::setNoNextCallback ( const BasicObject::FunctionData fd  )  [inline]

Sets the callback function that is called, when there is no valid next-ID. So it does not have a menu to display. You can use this callback i.e. to start the game.

Parameters:
fd the callback data
Note:
the 3rd param of the callback-function points to an integer value equal to the result of getActiveItemID() (that is the ID of the window that just flew out), if it is changed to ID_INVALID in the callback, then the window will fly back with the last view, otherwise not.

void GuiFlowMenu::setFlewInCallback ( const BasicObject::FunctionData fd  )  [inline]

Sets the callback function that is called, after the window flew into the screen.

Parameters:
fd the callback data
Note:
the 3rd param of the callback-function points to an integer value equal to the result of getActiveItemID().

void GuiFlowMenu::setBackCallback ( const BasicObject::FunctionData fd  )  [inline]

Sets the callback function that is called, after the window flew back into the screen.

Parameters:
fd the callback data

void GuiFlowMenu::onInit (  )  [protected, virtual]

Initializes the object's variables by reading data from the XML element. If there were no XML data used for creation, nothing is done. This function calls onInit() of its children recursively (after it has inited itself). It is highly recommended to call BasicObject::onInit(), usually at the end of the onInit() method, when overwriting it in a derived class.

Reimplemented from GuiFlowWindow.

Uint32 GuiFlowMenu::onPosReached (  )  [protected, virtual]

This event is called, when the "flight" is done. So the window's position is equal to the destination-rect, as specified in the 1st param of flyTo() and the time as specified in the 2nd param has expired.

Returns:
anything, currently not used, but should return zero.

Reimplemented from GuiFlowWindow.


The documentation for this class was generated from the following files:
Generated on Wed May 9 17:36:17 2007 for netrinjo by  doxygen 1.5.1