Gorgon Game Engine
Registry Class Referenceabstract

This class stores templates for elements. More...

Inheritance diagram for Registry:
[legend]

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::Templateoperator[] (TemplateType type)
 Returns the template for the requested type. More...
 

Static Public Member Functions

static RegistryActive ()
 

Protected Member Functions

virtual UI::Templategenerate (TemplateType type)=0
 This function should return a template for the given type. More...
 

Protected Attributes

std::array< UI::Template *, Maxtemplates
 Stores the templates. Mutable to allow late loading. More...
 

Detailed Description

This class stores templates for elements.

Once a registry is active all created widgets will use the specified registry for templates.

Member Enumeration Documentation

◆ 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.

Enumerator
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 

Do not use this value.

Constructor & Destructor Documentation

◆ Registry()

Registry ( bool  activate = false)
explicit

Default constructor.

◆ ~Registry()

virtual ~Registry ( )
virtual

Destroys all stored templates.

References Registry::templates.

Member Function Documentation

◆ Activate()

void Activate ( )

Activates this registry to be used to provide templates.

◆ Active()

static Registry& Active ( )
static

References ASSERT.

◆ generate()

virtual UI::Template& generate ( TemplateType  type)
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.

◆ GetEmSize()

virtual int GetEmSize ( ) const
pure virtual

Implemented in PresetRegistry, and SimpleGenerator.

◆ GetSpacing()

virtual int GetSpacing ( ) const
pure virtual

Implemented in PresetRegistry, and SimpleGenerator.

◆ operator[]()

const UI::Template& operator[] ( TemplateType  type)

Returns the template for the requested type.

Member Data Documentation

◆ templates

std::array<UI::Template*, Max> templates
mutableprotected

Stores the templates. Mutable to allow late loading.


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