#include <uiobject.h>
Inheritance diagram for UiObject:
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 |
| |
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 |
All classes, derived from UiObject, are managed by UiManager to handle events that are needed for user-program interaction.
UiObject::UiObject | ( | BasicObject * | parent, | |
const char * | name | |||
) |
Constructor.
parent | the parent object | |
name | the object's name |
UiObject::UiObject | ( | TiXmlElement * | el, | |
BasicObject * | parent | |||
) |
Constructor.
el | the XML-element to use for initialization | |
parent | the parent object |
virtual const char* UiObject::getClassName | ( | ) | [inline, virtual] |
This function should be overriden in every sub-class of BasicObject!
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] |
Reimplemented in GuiElement.
virtual bool UiObject::isOglElement | ( | ) | const [inline, virtual] |
void UiObject::applyTheme | ( | UiTheme * | t | ) | [inline] |
Calls onThemeChanged(t) of this and all its child objects.
t | the theme to apply |
const char * UiObject::tr | ( | const char * | text | ) | [static] |
Translates a text-string into another language, if possible. It uses UiTheme::translate( text ).
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.
ev | the key-down event, that occured |
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.
ev | the key-up event, that occured |
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.
ev | the button-down event, that occured |
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.
ev | the button-up event, that occured |
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.
x | the absolute x coordinate of the cursor (distance from left) | |
y | the absolute y coordinate of the cursor (distance from top) |
Reimplemented in GuiManager.
virtual Uint32 UiObject::onFocus | ( | FocusTypes | gained | ) | [inline, protected, virtual] |
This event is called, when the object gains keyboard or mouse focus.
gained | the gained focustypes |
virtual Uint32 UiObject::onRelease | ( | FocusTypes | lost | ) | [inline, protected, virtual] |
This event is called, when the object loses keyboard or mouse focus.
lost | the lost focustypes |
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!
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.
t | pointer to the new used theme |
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.