TGUI  0.8-dev

This class can be used to manage the widget renderers. More...

#include <Theme.hpp>

Public Member Functions

 Theme (const std::string &primary="")
 Constructs the theme class, with an optional theme file to load. More...
 
void load (const std::string &primary)
 Changes the primary theme loader parameter. More...
 
std::shared_ptr< RendererDatagetRenderer (const std::string &id)
 Gets data for the renderers. More...
 
void addRenderer (const std::string &id, std::shared_ptr< RendererData > renderer)
 Manually adds a renderer data to the theme. More...
 
bool removeRenderer (const std::string &id)
 Manually removes a renderer to the theme. More...
 

Static Public Member Functions

static void setThemeLoader (std::shared_ptr< BaseThemeLoader > themeLoader)
 Changes the function that will load the widget theme data. More...
 
static std::shared_ptr< BaseThemeLoadergetThemeLoader ()
 Returns the function that is currently being used to load the widget theme data. More...
 

Protected Attributes

std::map< std::string, std::shared_ptr< RendererData > > m_renderers
 Maps ids to renderer datas.
 

Static Protected Attributes

static std::shared_ptr< BaseThemeLoaderm_themeLoader
 Theme loader which will do the actual loading.
 

Detailed Description

This class can be used to manage the widget renderers.

Constructor & Destructor Documentation

◆ Theme()

tgui::Theme::Theme ( const std::string &  primary = "")

Constructs the theme class, with an optional theme file to load.

Parameters
primaryPrimary parameter for the theme loader (filename of the theme file in DefaultThemeLoader)

Member Function Documentation

◆ addRenderer()

void tgui::Theme::addRenderer ( const std::string &  id,
std::shared_ptr< RendererData renderer 
)

Manually adds a renderer data to the theme.

Parameters
idIdentifier of the renderer
rendererThe renderer to add

If a renderer with the same id already exists then it will be replaced by this one. Widgets using the old renderer will keep using that old renderer and remain unchanged.

◆ getRenderer()

std::shared_ptr<RendererData> tgui::Theme::getRenderer ( const std::string &  id)

Gets data for the renderers.

Parameters
idThe secondary parameter for the theme loader (name of section in theme file in DefaultThemeLoader).
Returns
Shared renderer data

◆ getThemeLoader()

static std::shared_ptr<BaseThemeLoader> tgui::Theme::getThemeLoader ( )
static

Returns the function that is currently being used to load the widget theme data.

Returns
Theme loader

◆ load()

void tgui::Theme::load ( const std::string &  primary)

Changes the primary theme loader parameter.

Parameters
primaryPrimary parameter for the theme loader (filename of the theme file in DefaultThemeLoader)

When the theme was loaded before and a renderer with the same name is encountered, the widgets that were using the old renderer will be reloaded with the new renderer.

◆ removeRenderer()

bool tgui::Theme::removeRenderer ( const std::string &  id)

Manually removes a renderer to the theme.

Parameters
idIdentifier of the renderer
Returns
True when removed, false when the identifier did not match any renderer

◆ setThemeLoader()

static void tgui::Theme::setThemeLoader ( std::shared_ptr< BaseThemeLoader themeLoader)
static

Changes the function that will load the widget theme data.

Parameters
themeLoaderPointer to the new loader

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