UiObject Class Reference
[User interface]

Base class for all objects, that have a managed user interface. More...

#include <uiobject.h>

Inheritance diagram for UiObject:

Inheritance graph
[legend]
Collaboration diagram for UiObject:

Collaboration graph
[legend]
List of all members.

Public Types

enum  FocusType { ftKeyboard = 1, ftMouse = 2, ftDisplay = 4 }
 kinds of focus an UiObject can have
typedef Uint8 FocusTypes
 combinations of focustypes

Public Member Functions

DECLSPEC UiObject (BasicObject *parent, const char *name)
DECLSPEC UiObject (TiXmlElement *el, BasicObject *parent)
virtual const char * getClassName ()
DECLSPEC void toTop ()
DECLSPEC void toBottom ()
DECLSPEC void oneStepToTop ()
DECLSPEC void oneStepToBottom ()
virtual bool isGuiElement () const
virtual bool isOglElement () const
virtual bool isUiObject () const
 
Returns:
whether this is derived from UiObject

void applyTheme (UiTheme *t)

Static Public Member Functions

static DECLSPEC const char * tr (const char *text)

Protected Member Functions

virtual Uint32 onKeyDown (SDL_KeyboardEvent *ev)
virtual Uint32 onKeyUp (SDL_KeyboardEvent *ev)
virtual Uint32 onMouseDown (SDL_MouseButtonEvent *ev)
virtual Uint32 onMouseUp (SDL_MouseButtonEvent *ev)
virtual Uint32 onMouseMotion (SDL_MouseMotionEvent *ev)
virtual Uint32 onFocus (FocusTypes gained)
virtual Uint32 onRelease (FocusTypes lost)
virtual Uint32 onFrame ()
virtual DECLSPEC Uint32 onThemeChanged (UiTheme *t)
virtual DECLSPEC void onDestroy ()

Friends

class UiManager

Detailed Description

Base class for all objects, that have a managed user interface.

All classes, derived from UiObject, are managed by UiManager to handle events that are needed for user-program interaction.

See also:
UiManager


Constructor & Destructor Documentation

UiObject::UiObject ( BasicObject parent,
const char *  name 
)

Constructor.

Parameters:
parent the parent object
name the object's name

UiObject::UiObject ( TiXmlElement el,
BasicObject parent 
)

Constructor.

Parameters:
el the XML-element to use for initialization
parent the parent object


Member Function Documentation

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

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

Returns:
the name of the class.

Reimplemented from BasicObject.

Reimplemented in GuiBackground, GuiFrame, GuiBorder, GuiRadioContainer, GuiPictureBg, GuiFlowWindow, GuiPageControl, GuiCheck, GuiRadio, GuiNumScroller, GuiCursor, GuiDropDown, GuiDynamicButton, GuiClickableBtn, GuiCheckableBtn, GuiRadioBtn, GuiElement, GuiFader, GuiFileElement, GuiFlowMenu, GuiForm, GuiHint, GuiListBox, GuiManager, GuiMenuBar, GuiMenuItem, GuiMessageBox, GuiProgressBar, GuiRotator, GuiScroller, GuiScrollBg, GuiSurface, GuiText, GuiTextInput, GuiKeyControl, GuiFrameCounter, GuiTextField, and GuiUpDown.

void UiObject::toTop (  ) 

Brings the element to top, so that sibling elements, that are (partially) drawn at the same place, appear behind this element

void UiObject::toBottom (  ) 

Sends the element to bottom, so that sibling elements, that are (partially) drawn at the same place, appear in front of this element

void UiObject::oneStepToTop (  ) 

Brings the element one step to top, so that it appeares in front of the element, that was one step above it before.

void UiObject::oneStepToBottom (  ) 

Sends the element one step to bottom, so that it appeares behind the element, that was one step below it before.

virtual bool UiObject::isGuiElement (  )  const [inline, virtual]

Returns:
true, if the object is a class derived from GuiElement; false, if not

Reimplemented in GuiElement.

virtual bool UiObject::isOglElement (  )  const [inline, virtual]

Returns:
true, if the object is a class derived from OglElement; false, if not
Note:
OpenGL is not yet supported.

void UiObject::applyTheme ( UiTheme t  )  [inline]

Calls onThemeChanged(t) of this and all its child objects.

Parameters:
t the theme to apply
Note:
calling this makes usually only sense after the initialisation of this object
Todo:
!!!Make applying themes on creation automatically!!!

const char * UiObject::tr ( const char *  text  )  [static]

Translates a text-string into another language, if possible. It uses UiTheme::translate( text ).

Parameters:
text the string to translate

virtual Uint32 UiObject::onKeyDown ( SDL_KeyboardEvent *  ev  )  [inline, protected, virtual]

This event is called, when the object has the keyboard focus and a key is pressed down.

Parameters:
ev the key-down event, that occured
Returns:
currently the result is not used; may be zero, if no error...

Reimplemented in GuiManager, GuiTextInput, and GuiKeyControl.

virtual Uint32 UiObject::onKeyUp ( SDL_KeyboardEvent *  ev  )  [inline, protected, virtual]

This event is called, when the object has the keyboard focus and a key is released.

Parameters:
ev the key-up event, that occured
Returns:
currently the result is not used; may be zero, if no error...

Reimplemented in GuiManager, and GuiTextInput.

virtual Uint32 UiObject::onMouseDown ( SDL_MouseButtonEvent *  ev  )  [inline, protected, virtual]

This event is called, when the object has the mouse focus and a mouse button is pressed down.

Parameters:
ev the button-down event, that occured
Returns:
currently the result is not used; may be zero, if no error...

Reimplemented in GuiClickableBtn, GuiCheckableBtn, GuiManager, GuiScroller, GuiTextInput, and GuiKeyControl.

virtual Uint32 UiObject::onMouseUp ( SDL_MouseButtonEvent *  ev  )  [inline, protected, virtual]

This event is called, when the object has the mouse focus and a mouse button is released.

Parameters:
ev the button-up event, that occured
Returns:
currently the result is not used; may be zero, if no error...

Reimplemented in GuiClickableBtn, GuiCheckableBtn, GuiManager, and GuiScroller.

virtual Uint32 UiObject::onMouseMotion ( SDL_MouseMotionEvent *  ev  )  [inline, protected, virtual]

This event is called, when the mouse cursor is moved over the object.

Parameters:
x the absolute x coordinate of the cursor (distance from left)
y the absolute y coordinate of the cursor (distance from top)
Returns:
currently the result is not used; may be zero, if no error...

Reimplemented in GuiManager.

virtual Uint32 UiObject::onFocus ( FocusTypes  gained  )  [inline, protected, virtual]

This event is called, when the object gains keyboard or mouse focus.

Parameters:
gained the gained focustypes
Returns:
currently the result is not used; may be zero, if no error...

virtual Uint32 UiObject::onRelease ( FocusTypes  lost  )  [inline, protected, virtual]

This event is called, when the object loses keyboard or mouse focus.

Parameters:
lost the lost focustypes
Returns:
currently the result is not used; may be zero, if no error...

virtual Uint32 UiObject::onFrame (  )  [inline, protected, virtual]

This event is called when graphics should be updated. It does not call the children's onFrame() function!

Returns:
currently the result is not used; may be zero, if no error...
Note:
in classes derived from GuiElement, it is probably more useful to implement onFrame(SdlSurface*)

Reimplemented in GuiFader, and GuiManager.

Uint32 UiObject::onThemeChanged ( UiTheme t  )  [protected, virtual]

This event is called, when the theme changes. Perform here the changes of the object's look and feel.

Parameters:
t pointer to the new used theme
Returns:
currently the result is not used; may be zero, if no error...

Reimplemented in GuiBackground, GuiBorder, GuiPictureBg, GuiFlowWindow, GuiPageControl, GuiDropDown, GuiDynamicButton, GuiClickableBtn, GuiCheckableBtn, GuiRadioBtn, GuiElement, GuiForm, GuiHint, GuiManager, GuiProgressBar, GuiScroller, GuiText, GuiTextInput, and GuiUpDown.

void UiObject::onDestroy (  )  [protected, virtual]

May be called to reinitialise this object or stop an initialised module. Calls all children's onDestroy(). Most classes do not use this method. But sometimes it is useful to reset the functionality of an object.

Reimplemented from BasicObject.

Reimplemented in GuiElement, and GuiManager.


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