SuperTuxKart
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GUIEngine::AbstractTopLevelContainer Class Referenceabstract

Represents a GUI widgets container. More...

#include <abstract_top_level_container.hpp>

Inheritance diagram for GUIEngine::AbstractTopLevelContainer:
Inheritance graph
[legend]

Public Member Functions

virtual int getWidth ()=0
 
virtual int getHeight ()=0
 
WidgetgetWidget (const char *name)
 This function returns a widget by name if that widget is found. More...
 
WidgetgetWidget (const int id)
 This function returns a widget by irrlicht ID if that widget is found. More...
 
template<typename T >
T * getWidget (const char *name)
 This function searches and returns a widget by name, cast as specified type, if that widget is found and the type is correct. More...
 
WidgetgetFirstWidget (PtrVector< Widget > *within_vector=NULL)
 This function returns the first widget found in within_vector. More...
 
WidgetgetLastWidget (PtrVector< Widget > *within_vector=NULL)
 This function returns the last widget found in within_vector. More...
 
void elementsWereDeleted (PtrVector< Widget > *within_vector=NULL)
 This function is called when screen is removed. More...
 
bool isMyChild (Widget *widget) const
 This function checks if a widget is a child of the container. More...
 

Static Public Member Functions

static WidgetgetWidget (const char *name, PtrVector< Widget > *within_vector)
 This function returns a widget by name if that widget is found in within_vector. More...
 
static WidgetgetWidget (const int id, PtrVector< Widget > *within_vector)
 This function returns a widget by irrlicht ID if that widget is found. More...
 

Protected Member Functions

void addWidgetsRecursively (PtrVector< Widget > &widgets, Widget *parent=NULL)
 This function adds a list of widgets recursively, effectively creating the hierarchy of widgets. More...
 

Protected Attributes

PtrVector< Widget, HOLD > m_widgets
 the widgets in this screen
 
Widgetm_first_widget
 AbstractTopLevelContainer is generally able to determine its first widget just fine, but in highly complex screens (e.g. More...
 
Widgetm_last_widget
 AbstractTopLevelContainer is generally able to determine its last widget just fine, but in highly complex screens (e.g. More...
 

Detailed Description

Represents a GUI widgets container.

Abstract base class for both Screen and ModalDialog.

Member Function Documentation

◆ addWidgetsRecursively()

void AbstractTopLevelContainer::addWidgetsRecursively ( PtrVector< Widget > &  widgets,
Widget parent = NULL 
)
protected

This function adds a list of widgets recursively, effectively creating the hierarchy of widgets.

Parameters
widgetsThe vector of widgets to add
parentThe parent widget of the vector of widgets

◆ elementsWereDeleted()

void AbstractTopLevelContainer::elementsWereDeleted ( PtrVector< Widget > *  within_vector = NULL)

This function is called when screen is removed.

This means all irrlicht widgets this object has pointers to are now gone. All references are set to NULL to avoid problems.

Parameters
within_vectorThe vector of widgets to clear

◆ getFirstWidget()

Widget * AbstractTopLevelContainer::getFirstWidget ( PtrVector< Widget > *  within_vector = NULL)

This function returns the first widget found in within_vector.

Parameters
within_vectorThe vector to look into
Returns
The result of the search, or NULL if the object is not found

◆ getLastWidget()

Widget * AbstractTopLevelContainer::getLastWidget ( PtrVector< Widget > *  within_vector = NULL)

This function returns the last widget found in within_vector.

Parameters
within_vectorThe vector to look into
Returns
The result of the search, or NULL if the object is not found

◆ getWidget() [1/5]

Widget * AbstractTopLevelContainer::getWidget ( const char *  name)

This function returns a widget by name if that widget is found.

Returns
an object by name, or NULL if not found
Parameters
nameThe name of the widget to find
Returns
The result of the search, or NULL if the object is not found

◆ getWidget() [2/5]

Widget * AbstractTopLevelContainer::getWidget ( const int  id)

This function returns a widget by irrlicht ID if that widget is found.

Returns
an object by irrlicht ID, or NULL if not found
Parameters
idThe irrlicht ID of the widget to find
Returns
The result of the search, or NULL if the object is not found

◆ getWidget() [3/5]

template<typename T >
T* GUIEngine::AbstractTopLevelContainer::getWidget ( const char *  name)
inline

This function searches and returns a widget by name, cast as specified type, if that widget is found and the type is correct.

Parameters
nameThe name of the widget to find
Returns
an object by name, casted to specified type, or NULL if not found/wrong type

◆ getWidget() [4/5]

Widget * AbstractTopLevelContainer::getWidget ( const char *  name,
PtrVector< Widget > *  within_vector 
)
static

This function returns a widget by name if that widget is found in within_vector.

Parameters
nameThe name of the widget to find
within_vectorThe vector of widgets to look in
Returns
The result of the search, or NULL if the object is not found

◆ getWidget() [5/5]

Widget * AbstractTopLevelContainer::getWidget ( const int  id,
PtrVector< Widget > *  within_vector 
)
static

This function returns a widget by irrlicht ID if that widget is found.

Parameters
idThe irrlicht ID of the widget to find
within_vectorThe vector to look into
Returns
The result of the search, or NULL if the object is not found

◆ isMyChild()

bool AbstractTopLevelContainer::isMyChild ( Widget widget) const

This function checks if a widget is a child of the container.

Parameters
widgetThe widget that needs to be checked if it is a child
Returns
True if the widget is a child, false otherwise

Member Data Documentation

◆ m_first_widget

Widget* GUIEngine::AbstractTopLevelContainer::m_first_widget
protected

AbstractTopLevelContainer is generally able to determine its first widget just fine, but in highly complex screens (e.g.

multiplayer kart selection) you can help it by providing the first widget manually.

◆ m_last_widget

Widget* GUIEngine::AbstractTopLevelContainer::m_last_widget
protected

AbstractTopLevelContainer is generally able to determine its last widget just fine, but in highly complex screens (e.g.

multiplayer kart selection) you can help it by providing the first widget manually.


The documentation for this class was generated from the following files: