![]() |
Gorgon Game Engine
|
This class stores templates for elements. More...
Public Types | |
enum | TemplateType { Button_Regular, Button_Icon, Label_Regular, Label_Error, Checkbox_Regular, Checkbox_Button, Radio_Regular, Inputbox_Regular, Panel_Regular, Panel_Blank, Panel_Top, Panel_Left, Panel_Bottom, Panel_Right, Progress_Regular, Layerbox_Regular, Layerbox_Blank, Scrollbar_Horizontal, Scrollbar_Vertical, Listbox_Regular, Dropdown_Regular, Max } |
This enum lists all possible template types. More... | |
Public Member Functions | |
Registry (bool activate=false) | |
Default constructor. More... | |
virtual | ~Registry () |
Destroys all stored templates. More... | |
void | Activate () |
Activates this registry to be used to provide templates. More... | |
virtual int | GetEmSize () const =0 |
virtual int | GetSpacing () const =0 |
const UI::Template & | operator[] (TemplateType type) |
Returns the template for the requested type. More... | |
Static Public Member Functions | |
static Registry & | Active () |
Protected Member Functions | |
virtual UI::Template & | generate (TemplateType type)=0 |
This function should return a template for the given type. More... | |
Protected Attributes | |
std::array< UI::Template *, Max > | templates |
Stores the templates. Mutable to allow late loading. More... | |
This class stores templates for elements.
Once a registry is active all created widgets will use the specified registry for templates.
enum TemplateType |
This enum lists all possible template types.
All registries should be able to provide a template for each time, even if the template is completely empty.
|
explicit |
Default constructor.
|
virtual |
Destroys all stored templates.
References Registry::templates.
void Activate | ( | ) |
Activates this registry to be used to provide templates.
|
protectedpure virtual |
This function should return a template for the given type.
Due to being used in constructors you are not allowed to reject template type. If the generator is capable of generating a similar template, simply return that one instead of throwing (ie. return Panel_Regular instead of Panel_Top if Panel_Top is not supported). If that is not possible as well, return a template with a fixed error image/text.
Implemented in PresetRegistry, and Generator.
|
pure virtual |
Implemented in PresetRegistry, and SimpleGenerator.
|
pure virtual |
Implemented in PresetRegistry, and SimpleGenerator.
const UI::Template& operator[] | ( | TemplateType | type | ) |
Returns the template for the requested type.
|
mutableprotected |
Stores the templates. Mutable to allow late loading.