|
TGUI
0.7.8
|
#include <TGUI/Loading/Theme.hpp>
Public Types | |
| typedef std::shared_ptr< Theme > | Ptr |
| Shared theme pointer. | |
Public Member Functions | |
| Theme (const std::string &filename="") | |
| Construct the theme class, with an optional theme file to load. More... | |
| WidgetConverter | load (std::string className) |
| Load the widget from the theme. More... | |
| void | reload (const std::string &filename) |
| Reload the theme with a different filename. More... | |
| void | reload (std::string oldClassName, std::string newClassName) |
| Reload all widgets that were loaded with a certain class name. More... | |
| void | reload (Widget::Ptr widget, std::string className) |
| Reload a specific widget. More... | |
| void | setProperty (std::string className, const std::string &property, const std::string &value) |
| Change a property of the renderer of all widgets that were loaded with a certain class name. More... | |
| void | setProperty (std::string className, const std::string &property, ObjectConverter &&value) |
| Change a property of the renderer of all widgets that were loaded with a certain class name. More... | |
| std::string | getProperty (std::string className, std::string property) const |
| Retrieve the serialized value of a certain property of widgets that use a certain class name. More... | |
| std::map< std::string, std::string > | getPropertyValuePairs (std::string className) const |
| Get a map with all properties and their values from widgets loaded with a certain class name. More... | |
| std::shared_ptr< Theme > | clone () const |
| Clone the theme without its connected widgets. More... | |
| virtual void | widgetDetached (Widget *widget) override |
| Function that gets called when a widget is disconnected from this theme. More... | |
| virtual WidgetConverter | internalLoad (const std::string &filename, const std::string &className) override |
| This function can be used inside a widget to load other widgets without access to the derived theme class. More... | |
| virtual void | initWidget (Widget *widget, std::string filename, std::string className) override |
| Function called by the widget to finish its initialization. More... | |
Public Member Functions inherited from tgui::BaseTheme | |
| virtual | ~BaseTheme ()=default |
| Virtual destructor. | |
| virtual void | widgetAttached (Widget *widget) |
| Virtual function that gets called when a widget is connected to this theme. More... | |
Static Public Member Functions | |
| static Theme::Ptr | create (const std::string &filename="") |
| Creates a new theme instance. More... | |
Static Public Member Functions inherited from tgui::BaseTheme | |
| static void | setConstructFunction (const std::string &type, const std::function< Widget::Ptr()> &constructor) |
| Changes the construct function of a specific widget type. More... | |
| static void | setThemeLoader (const std::shared_ptr< BaseThemeLoader > &themeLoader) |
| Change the function that will load the widget theme data. More... | |
Additional Inherited Members | |
Static Protected Attributes inherited from tgui::BaseTheme | |
| static std::map< std::string, std::function< Widget::Ptr()> > | m_constructors |
| Widget creator functions. | |
| static std::shared_ptr< BaseThemeLoader > | m_themeLoader |
| Theme loading functions, they read the theme file. | |
Default Theme class.
| tgui::Theme::Theme | ( | const std::string & | filename = "" | ) |
Construct the theme class, with an optional theme file to load.
| filename | Filename of the theme file |
| std::shared_ptr< Theme > tgui::Theme::clone | ( | ) | const |
Clone the theme without its connected widgets.
Any changes made on the returned theme will not have any impact on this theme and vice versa.
|
static |
Creates a new theme instance.
| std::string tgui::Theme::getProperty | ( | std::string | className, |
| std::string | property | ||
| ) | const |
Retrieve the serialized value of a certain property of widgets that use a certain class name.
| className | The class name of the widgets |
| property | The property that you would like to retrieve |
| std::map< std::string, std::string > tgui::Theme::getPropertyValuePairs | ( | std::string | className | ) | const |
Get a map with all properties and their values from widgets loaded with a certain class name.
| className | The class name of the widgets |
|
overridevirtual |
Function called by the widget to finish its initialization.
| widget | The widget that needs to be initialized |
| filename | Filename that was used to load the widget |
| className | Class name that was used to load the widget |
Implements tgui::BaseTheme.
|
overridevirtual |
This function can be used inside a widget to load other widgets without access to the derived theme class.
| filename | The filename that has to match the one used to load this theme |
| className | The class name of the theme to load |
Implements tgui::BaseTheme.
| WidgetConverter tgui::Theme::load | ( | std::string | className | ) |
| void tgui::Theme::reload | ( | const std::string & | filename | ) |
Reload the theme with a different filename.
| filename | Filename of the new theme file |
All widgets that are connected to this theme will be reloaded with the new theme file. The class names thus have to match with those from the old theme file!
| Exception | when one of the widgets failed to reload |
| void tgui::Theme::reload | ( | std::string | oldClassName, |
| std::string | newClassName | ||
| ) |
Reload all widgets that were loaded with a certain class name.
| oldClassName | Class name that was used to load the widget |
| newClassName | Class name to load the widget with |
| void tgui::Theme::reload | ( | Widget::Ptr | widget, |
| std::string | className | ||
| ) |
| void tgui::Theme::setProperty | ( | std::string | className, |
| const std::string & | property, | ||
| const std::string & | value | ||
| ) |
Change a property of the renderer of all widgets that were loaded with a certain class name.
| className | The class name of the widgets |
| property | The property that you would like to change |
| value | The new serialized value that you like to assign to the property |
| Exception | when deserialization fails or when the widget does not have this property. |
| void tgui::Theme::setProperty | ( | std::string | className, |
| const std::string & | property, | ||
| ObjectConverter && | value | ||
| ) |
Change a property of the renderer of all widgets that were loaded with a certain class name.
| className | The class name of the widgets |
| property | The property that you would like to change |
| value | The new value that you like to assign to the property. The ObjectConverter is implicitly constructed from the possible value types. |
| Exception | for unknown properties or when value was of a wrong type. |
|
overridevirtual |
Function that gets called when a widget is disconnected from this theme.
| widget | The widget that was detached from this theme |
Reimplemented from tgui::BaseTheme.