#include <guidropdown.h>
Inheritance diagram for GuiDropDown:
Public Member Functions | |
DECLSPEC | GuiDropDown (const SDL_Rect &r, GuiElement *p, const char *name, bool editable=false) |
DECLSPEC | GuiDropDown (TiXmlElement *el, GuiElement *p) |
virtual const char * | getClassName () |
DECLSPEC void | destroy () |
void | setCallback (Callback c, BasicObject *d) |
int | insertStr (const char *str, int pos=-1) |
bool | clearStr (int pos=-1) |
void | clearAll () |
bool | changeStr (const char *newstr, int pos) |
const char * | getStr (int pos) const |
const char * | getSelStr () const |
const char * | getString () const |
int | getSelId () const |
int | getCount () const |
void | setSelected (int i) |
Static Public Member Functions | |
static void | newguiobject (void *presult, BasicObject *o, void *xmldata) |
Protected Member Functions | |
virtual DECLSPEC Uint32 | onResize () |
virtual DECLSPEC void | onInit () |
virtual DECLSPEC Uint32 | onThemeChanged (UiTheme *t) |
GuiDropDown::GuiDropDown | ( | const SDL_Rect & | r, | |
GuiElement * | p, | |||
const char * | name, | |||
bool | editable = false | |||
) |
Constructor.
r | the rect of the list's and text's appearance, relative to the parent's top-left position | |
p | the parent element; or NULL, if it will be used as top level | |
editable | if true, the selected value can be edited; if false not |
GuiDropDown::GuiDropDown | ( | TiXmlElement * | el, | |
GuiElement * | p | |||
) |
Constructor. Uses XML data.
el | the XML data for initialisation | |
p | parent element (or NULL, to take GuiManager::the as parent) |
virtual const char* GuiDropDown::getClassName | ( | ) | [inline, virtual] |
This function should be overriden in every sub-class of BasicObject!
Reimplemented from GuiElement.
void GuiDropDown::destroy | ( | ) |
Deletes the list. Call this, if the parent is used after deleting this class.
Reimplemented from BasicObject.
void GuiDropDown::setCallback | ( | Callback | c, | |
BasicObject * | d | |||
) | [inline] |
Sets the callback function, which is called, when selecting a list item
c | the function to call | |
d | the pointer that will be used as second argument in the callback event |
int GuiDropDown::insertStr | ( | const char * | str, | |
int | pos = -1 | |||
) | [inline] |
see GuiList::insertStr(str, pos)
str | the string | |
pos | the index of the item |
bool GuiDropDown::clearStr | ( | int | pos = -1 |
) | [inline] |
see GuiList::clearStr(pos)
pos | the index of the item to erase |
void GuiDropDown::clearAll | ( | ) | [inline] |
see GuiList::clearAll()
bool GuiDropDown::changeStr | ( | const char * | newstr, | |
int | pos | |||
) | [inline] |
see GuiList::changeStr(newstr, pos)
newstr | the new string to set | |
pos | the index of the item to change |
const char* GuiDropDown::getStr | ( | int | pos | ) | const [inline] |
pos | index of the item to return |
const char* GuiDropDown::getSelStr | ( | ) | const [inline] |
const char * GuiDropDown::getString | ( | ) | const |
int GuiDropDown::getSelId | ( | ) | const [inline] |
int GuiDropDown::getCount | ( | ) | const [inline] |
void GuiDropDown::setSelected | ( | int | i | ) | [inline] |
Selects an item.
i | the item's index to select |
Uint32 GuiDropDown::onResize | ( | ) | [protected, virtual] |
This event is called, when the element changed its place or size.
Reimplemented from GuiElement.
void GuiDropDown::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 GuiElement.
Uint32 GuiDropDown::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 from GuiElement.