TGUI  1.4.0
Loading...
Searching...
No Matches
tgui::WidgetFactory Class Reference

Static Public Member Functions

static void setConstructFunction (const String &type, std::function< Widget::Ptr()> constructor)
 Sets the construct function that will be used to create a widget when loading it.
 
static TGUI_NODISCARD std::function< Widget::Ptr()> getConstructFunction (const String &type)
 Retrieves the construct function that is used to create a widget when loading it.
 
static TGUI_NODISCARD std::vector< StringgetWidgetTypes ()
 Returns a list of all widget types for which a construct function exists.
 

Member Function Documentation

◆ getConstructFunction()

static TGUI_NODISCARD std::function< Widget::Ptr()> tgui::WidgetFactory::getConstructFunction ( const String & type)
static

Retrieves the construct function that is used to create a widget when loading it.

Parameters
typeType of the widget
Returns
Function used to construct the widget (all TGUI widgets use std::make_shared<WidgetType>)
Warning
A nullptr is returned if called with a type that isn't in the list returned by getWidgetTypes()

◆ getWidgetTypes()

static TGUI_NODISCARD std::vector< String > tgui::WidgetFactory::getWidgetTypes ( )
static

Returns a list of all widget types for which a construct function exists.

Returns
Widget type list

◆ setConstructFunction()

static void tgui::WidgetFactory::setConstructFunction ( const String & type,
std::function< Widget::Ptr()> constructor )
static

Sets the construct function that will be used to create a widget when loading it.

Parameters
typeType of the widget
constructorFunction used to construct the widget (all TGUI widgets use std::make_shared<WidgetType>)

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