GuiDropDown Class Reference
[2D graphical user interface]

A drop down list. More...

#include <guidropdown.h>

Inheritance diagram for GuiDropDown:

Inheritance graph
[legend]
Collaboration diagram for GuiDropDown:

Collaboration graph
[legend]
List of all members.

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)

Detailed Description

A drop down list.


Constructor & Destructor Documentation

GuiDropDown::GuiDropDown ( const SDL_Rect &  r,
GuiElement p,
const char *  name,
bool  editable = false 
)

Constructor.

Parameters:
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.

Parameters:
el the XML data for initialisation
p parent element (or NULL, to take GuiManager::the as parent)
See also:
GuiElement(TiXmlElement*,GuiElement*)


Member Function Documentation

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

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

Returns:
the name of the class.

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

Parameters:
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)

Parameters:
str the string
pos the index of the item

bool GuiDropDown::clearStr ( int  pos = -1  )  [inline]

see GuiList::clearStr(pos)

Parameters:
pos the index of the item to erase
Returns:
true, if pos was valid

void GuiDropDown::clearAll (  )  [inline]

see GuiList::clearAll()

bool GuiDropDown::changeStr ( const char *  newstr,
int  pos 
) [inline]

see GuiList::changeStr(newstr, pos)

Parameters:
newstr the new string to set
pos the index of the item to change
Returns:
true, if pos was valid

const char* GuiDropDown::getStr ( int  pos  )  const [inline]

Parameters:
pos index of the item to return
Returns:
the content of the selected item

const char* GuiDropDown::getSelStr (  )  const [inline]

Returns:
the selected string from the list

const char * GuiDropDown::getString (  )  const

Returns:
the string, that appears in the textbox

int GuiDropDown::getSelId (  )  const [inline]

Returns:
the index of the selected item

int GuiDropDown::getCount (  )  const [inline]

Returns:
the number of items in the list

void GuiDropDown::setSelected ( int  i  )  [inline]

Selects an item.

Parameters:
i the item's index to select

Uint32 GuiDropDown::onResize (  )  [protected, virtual]

This event is called, when the element changed its place or size.

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

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.

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

Reimplemented from GuiElement.


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