Gorgon Game Engine
PresetRegistry Class Reference

This registry contains preset templates. More...

Inheritance diagram for PresetRegistry:
[legend]

Public Member Functions

void Add (TemplateType type, UI::Template &temp)
 Add the given template to the registry, transferring ownership. More...
 
virtual int GetEmSize () const override
 
virtual int GetSpacing () const override
 
void SetEmSize (const int size)
 
void SetSpacing (const int tspacing)
 
- Public Member Functions inherited from Registry
 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...
 
const UI::Templateoperator[] (TemplateType type)
 Returns the template for the requested type. More...
 

Protected Member Functions

virtual UI::Templategenerate (Gorgon::Widgets::Registry::TemplateType) override
 This function should return a template for the given type. More...
 

Protected Attributes

int emsize
 
int spacing
 
- Protected Attributes inherited from Registry
std::array< UI::Template *, Maxtemplates
 Stores the templates. Mutable to allow late loading. More...
 

Additional Inherited Members

- Public Types inherited from Registry
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...
 
- Static Public Member Functions inherited from Registry
static RegistryActive ()
 

Detailed Description

This registry contains preset templates.

You are required to set all the templates otherwise, missing templates will be generated completely empty.

Member Function Documentation

◆ Add()

void Add ( TemplateType  type,
UI::Template temp 
)

Add the given template to the registry, transferring ownership.

If a template with the same type exists, it will be deleted.

◆ generate()

virtual UI::Template& generate ( Gorgon::Widgets::Registry::TemplateType  type)
overrideprotectedvirtual

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.

Implements Registry.

◆ GetEmSize()

virtual int GetEmSize ( ) const
overridevirtual

Implements Registry.

References PresetRegistry::emsize.

◆ GetSpacing()

virtual int GetSpacing ( ) const
overridevirtual

Implements Registry.

References PresetRegistry::spacing.

◆ SetEmSize()

void SetEmSize ( const int  size)

◆ SetSpacing()

void SetSpacing ( const int  tspacing)

Member Data Documentation

◆ emsize

int emsize
protected

◆ spacing

int spacing
protected

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