This class can be used to manage the widget renderers.  
 More...
#include <TGUI/Loading/Theme.hpp>
 | 
| 
std::map< std::string, std::shared_ptr< RendererData > >  | m_renderers | 
|   | Maps ids to renderer datas. 
  | 
|   | 
 | 
| 
static std::shared_ptr< BaseThemeLoader >  | m_themeLoader | 
|   | Theme loader which will do the actual loading. 
  | 
|   | 
This class can be used to manage the widget renderers. 
 
◆ Theme()
      
        
          | tgui::Theme::Theme  | 
          ( | 
          const std::string &  | 
          primary = "" | ) | 
           | 
        
      
 
Constructs the theme class, with an optional theme file to load. 
- Parameters
 - 
  
    | primary | Primary parameter for the theme loader (filename of the theme file in DefaultThemeLoader)  | 
  
   
 
 
◆ ~Theme()
Destructor. 
When a pointer to this theme was passed to setDefault, the default theme will be reset. 
 
 
◆ addRenderer()
      
        
          | void tgui::Theme::addRenderer  | 
          ( | 
          const std::string &  | 
          id,  | 
        
        
           | 
           | 
          std::shared_ptr< RendererData >  | 
          renderer  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Manually adds a renderer data to the theme. 
- Parameters
 - 
  
    | id | Identifier of the renderer  | 
    | renderer | The 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. 
 
 
◆ getDefault()
  
  
      
        
          | static Theme * tgui::Theme::getDefault  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Returns a pointer to the theme class that widgets use by default. 
- Returns
 - Default theme
 
- Warning
 - When setDefault was not called or was given a nullptr as parameter, getDefault will return the default theme. If you set textures in this theme then you MUST call setDefault(nullptr) before the end of the program to prevent a potential crash due to undefined order of destruction. 
 
 
 
◆ getPrimary()
      
        
          | const std::string & tgui::Theme::getPrimary  | 
          ( | 
           | ) | 
           const | 
        
      
 
Returns the primary theme loader parameter. 
- Returns
 - Primary parameter for the theme loader (filename of the theme file in DefaultThemeLoader) 
 
 
 
◆ getRenderer()
      
        
          | std::shared_ptr< RendererData > tgui::Theme::getRenderer  | 
          ( | 
          const std::string &  | 
          id | ) | 
           | 
        
      
 
Gets data for the renderers. 
- Parameters
 - 
  
    | id | The secondary parameter for the theme loader (name of section in theme file in DefaultThemeLoader). | 
  
   
- Returns
 - Shared renderer data
 
- Exceptions
 - 
  
    | Exception | if theme loader fails to load the requested renderer  | 
  
   
 
 
◆ getRendererNoThrow()
      
        
          | std::shared_ptr< RendererData > tgui::Theme::getRendererNoThrow  | 
          ( | 
          const std::string &  | 
          id | ) | 
           | 
        
      
 
Gets data for the renderers. 
- Parameters
 - 
  
    | id | The secondary parameter for the theme loader (name of section in theme file in DefaultThemeLoader). | 
  
   
- Returns
 - Shared renderer data
 
Unlike getRenderer which throws an exception, this function will return nullptr when the renderer is not found 
 
 
◆ getThemeLoader()
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
 - 
  
    | primary | Primary 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
 - 
  
    | id | Identifier of the renderer | 
  
   
- Returns
 - True when removed, false when the identifier did not match any renderer 
 
 
 
◆ setDefault()
  
  
      
        
          | static void tgui::Theme::setDefault  | 
          ( | 
          Theme *  | 
          theme | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Sets the theme class that widgets use by default. 
- Parameters
 - 
  
    | theme | Theme to use as default | 
  
   
The default theme will automatically be reset to nullptr when the theme that is pointed to is destructed. 
 
 
◆ setThemeLoader()
  
  
      
        
          | static void tgui::Theme::setThemeLoader  | 
          ( | 
          std::shared_ptr< BaseThemeLoader >  | 
          themeLoader | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Changes the function that will load the widget theme data. 
- Parameters
 - 
  
    | themeLoader | Pointer to the new loader  | 
  
   
 
 
The documentation for this class was generated from the following file: