Gorgon Game Engine
Gorgon::UI Namespace Reference

This namespace contains User interface related functionality. More...

Namespaces

 internal
 
 Organizers
 This namespace contains organizers that manage the location of the widgets in a container automatically.
 

Classes

class  Component
 This class is an instance of a component. More...
 
class  ComponentStack
 Component stack is the backbone of a widget. More...
 
class  ComponentStackWidget
 This class acts as a widget base that uses component stack to handle rendering, resizing and other operations. More...
 
class  ComponentStorage
 This class stores component related data. More...
 
class  ComponentTemplate
 Defines an object according to the Box Model. More...
 
class  ContainerTemplate
 Container class that defines an area according to the Box Model. More...
 
class  ConversionValidator
 Accepts all input and tries to convert using in-library functions. More...
 
class  Dimension
 Dimension data for components. Allows relative position and sizing. More...
 
struct  ExtenderRequestResponse
 This structure is used to transfer extender request response. More...
 
class  GraphicsTemplate
 Defines a visual component. More...
 
class  IgnoredTemplate
 This component type will be ignored by ComponentStack, effectively erasing Always when necessary. More...
 
class  LayerAdapter
 This class turns a layer into a widget container. More...
 
class  PlaceholderTemplate
 Defines a placeholder according to the Box Model. More...
 
class  RadioControl
 This class is designed to turn any group of two state widgets to a radio button group, only allowing one of them to be checked at the same time. More...
 
class  Template
 This class stores visual information about a widget template. More...
 
class  TextholderTemplate
 Textholder is designed to hold text data. More...
 
class  TwoStateControl
 This class is designed to be the interface class for all checkbox like UI elements. More...
 
class  VisualProvider
 
class  Widget
 This class is the base for all widgets. More...
 
class  WidgetContainer
 This class is the base class for all widget containers. More...
 
class  Window
 UI window allows programmers to create an OS window that will accept widgets and has the ability to run by its own. More...
 

Typedefs

using Margin = Geometry::basic_Margin< Dimension >
 This class stores the margin information for a box object. More...
 
using Point = Geometry::basic_Point< Dimension >
 This class stores the location information for a box object. More...
 
using Size = Geometry::basic_Size< Dimension >
 This class stores the size information for a box object. More...
 

Enumerations

enum  Anchor {
  None, TopLeft, TopCenter, TopRight,
  MiddleLeft, MiddleCenter, MiddleRight, BottomLeft,
  BottomCenter, BottomRight, FirstBaselineLeft, FirstBaselineRight,
  LastBaselineLeft, LastBaselineRight
}
 Anchor position. More...
 
enum  ComponentCondition {
  Always, Never, None, Disabled,
  Readonly, Focused, Hover, Down,
  State2, State3, State4, Opened,
  Closed, Reversed, Odd, Even,
  First, Middle, Last, Alone,
  Active, HScroll, VScroll, HVScroll,
  Ch1V0, Ch1V05, Ch1V1, Ch2V0,
  Ch2V05, Ch2V1, Ch3V0, Ch3V05,
  Ch3V1, Ch4V0, Ch4V05, Ch4V1,
  Default, Cancel, DataEffectStart, TextIsSet,
  TitleIsSet, LabelIsSet, ValueText1IsSet, ValueText2IsSet,
  ValueText3IsSet, ValueText4IsSet, State1TextIsSet, State2TextIsSet,
  State3TextIsSet, State4TextIsSet, Icon1IsSet, Icon2IsSet,
  StateIcon1IsSet, StateIcon2IsSet, StateIcon3IsSet, StateIcon4IsSet,
  Max
}
 Controls the condition when the components are visible. More...
 
enum  ComponentType {
  Placeholder, Textholder, Graphics, Container,
  Ignored
}
 Types of components, see respective classes for details. More...
 

Functions

int calculatemargin (int l, int r)
 
Geometry::Margin Convert (const Margin &m, const Geometry::Size &parent, int emwidth=10)
 Converts a dimension based margin to pixel based margin. More...
 
Geometry::Point Convert (const Point &p, const Geometry::Size &parent, int emwidth=10)
 Converts a dimension based point to pixel based point. More...
 
Geometry::Size Convert (const Size &s, const Geometry::Size &parent, int emwidth=10)
 Converts a dimension based size to pixel based size. More...
 
void Initialize (float density, int min=9)
 Initializes the UI system. More...
 
void Initialize (std::string fontname="", float density=7.5, int min=9)
 Initializes the UI system. More...
 
bool IsBottom (Anchor a)
 Returns if the given anchor is at bottom. More...
 
bool IsCenter (Anchor a)
 Returns if an anchor is centered horizontally. More...
 
bool IsIn (Anchor left, Anchor right)
 
bool IsLeft (Anchor a)
 Returns if an anchor is on the left. More...
 
bool IsMiddle (Anchor a)
 Returns if the given anchor is at middle vertically. More...
 
bool IsMouseRelated (ComponentCondition condition)
 Returns if the given condition is related to mouse events. More...
 
bool IsRight (Anchor a)
 Returns if an anchor is on the right. More...
 
bool IsTop (Anchor a)
 Returns if the given anchor is at top. More...
 
ComponentTemplate::ValueSource operator| (ComponentTemplate::ValueSource l, ComponentTemplate::ValueSource r)
 

Variables

Widgets::Generatorgenerator
 

Detailed Description

This namespace contains User interface related functionality.

This namespace does not contain the actual widgets that can be used. For that purpose, use Gorgon::Widgets namespace.

Typedef Documentation

◆ Margin

This class stores the margin information for a box object.

◆ Point

This class stores the location information for a box object.

◆ Size

This class stores the size information for a box object.

Enumeration Type Documentation

◆ Anchor

enum Anchor

Anchor position.

Enumerator
None 

This anchor position should is only used to denote object will not be anchored to a previous object, only to its parent.

If used as parent anchor it will be ignored and default anchor will be used instead. This should be paired with absolute positioning.

TopLeft 

Top left.

TopCenter 

Top center.

TopRight 

Top right.

MiddleLeft 

Middle left.

MiddleCenter 

Middle center, using this position ensures that the components will be inside each other.

MiddleRight 

Middle right.

BottomLeft 

Bottom left.

BottomCenter 

Bottom center.

BottomRight 

Bottom right.

FirstBaselineLeft 

Baseline left, for text, this aligns to the baseline of the first line.

FirstBaselineRight 

Baseline right, for text, this aligns to the baseline of the first line.

LastBaselineLeft 

Baseline left, for text, this aligns to the baseline of the last line.

This mode only works properly if Sizing is set to automatic.

LastBaselineRight 

Baseline right, for text, this aligns to the baseline of the last line.

This mode only works properly if Sizing is set to automatic.

◆ ComponentCondition

Controls the condition when the components are visible.

Components with the same ID will replace a previous one. If there is a condition that is satisfied, the component at the specific index will be replaced with that one, otherwise, if a component with condition always exists, it will be used.

Enumerator
Always 

Component is always active.

Never 

Component is always disabled.

None 

This anchor position should is only used to denote object will not be anchored to a previous object, only to its parent.

If used as parent anchor it will be ignored and default anchor will be used instead. This should be paired with absolute positioning.

Disabled 

Component is visible when the widget is disabled.

Readonly 

Component is visible when the widget is readonly.

Focused 

Widget has the focus.

Hover 

Mouse is over the widget, or over a particular repeat.

Down 

This is activated when the mouse is pressed on the component stack.

However, it can be activated in cases when activation key is pressed.

State2 

Second state of the widget, first state is Always.

State3 

Third state of the widget, first state is Always.

State4 

Fourth state of the widget, first state is Always.

Opened 

This condition is triggered when the widget is opened like a combobox showing its list part.

For widgets which are "opened" by default like window, this condition will never be satisfied. Instead of this condition, use Always for the base state.

Closed 

This condition is triggered when the widget is closed like a tree view item that is folded, or a window that is rolled.

For widgets which are "closed" by default, like combobox, this condition will never be satisfied. Instead of this condition, use Always for the base state.

Reversed 

For widgets that can have reversed state.

When dropdown will open above, this will be set.

Odd 

In lists denotes the item is in odd position.

Even 

In lists denotes the item is in even position.

First 

In a list this denotes the item is at the first place.

Middle 

In a list this denotes the item is somewhere in the middle.

Last 

In a list this denotes the item is at the last place.

Alone 

In a list this denotes the item alone.

Active 

This is for widgets that can be activated, like a count down timer.

HScroll 

There is space horizontally to be scrolled.

VScroll 

There is space vertically to be scrolled.

HVScroll 

There is space both horizontally and vertically to be scrolled.

Ch1V0 

Channel 1 value is 0, the value will be rounded to 4 decimal points before comparison.

Ch1V05 

Channel 1 value is 0.5, the value will be rounded to 4 decimal points before comparison.

Ch1V1 

Channel 1 value is 1, the value will be rounded to 4 decimal points before comparison.

Ch2V0 

Channel 2 value is 0, the value will be rounded to 4 decimal points before comparison.

Ch2V05 

Channel 2 value is 0.5, the value will be rounded to 4 decimal points before comparison.

Ch2V1 

Channel 2 value is 1, the value will be rounded to 4 decimal points before comparison.

Ch3V0 

Channel 3 value is 0, the value will be rounded to 4 decimal points before comparison.

Ch3V05 

Channel 3 value is 0.5, the value will be rounded to 4 decimal points before comparison.

Ch3V1 

Channel 3 value is 1, the value will be rounded to 4 decimal points before comparison.

Ch4V0 

Channel 4 value is 0, the value will be rounded to 4 decimal points before comparison.

Ch4V05 

Channel 4 value is 0.5, the value will be rounded to 4 decimal points before comparison.

Ch4V1 

Channel 4 value is 1, the value will be rounded to 4 decimal points before comparison.

Default 

This widget is the default widget of its container.

Cancel 

This widget is the cancel widget of its container.

DataEffectStart 

Do not use this value.

TextIsSet 

Data effect of the component is set.

TitleIsSet 

Data effect of the component is set.

LabelIsSet 

Data effect of the component is set.

ValueText1IsSet 

Data effect of the component is set.

ValueText2IsSet 

Data effect of the component is set.

ValueText3IsSet 

Data effect of the component is set.

ValueText4IsSet 

Data effect of the component is set.

State1TextIsSet 

Data effect of the component is set.

State2TextIsSet 

Data effect of the component is set.

State3TextIsSet 

Data effect of the component is set.

State4TextIsSet 

Data effect of the component is set.

Icon1IsSet 

Data effect of the component is set.

Icon2IsSet 

Data effect of the component is set.

StateIcon1IsSet 

Data effect of the component is set.

StateIcon2IsSet 

Data effect of the component is set.

StateIcon3IsSet 

Data effect of the component is set.

StateIcon4IsSet 

Data effect of the component is set.

Max 

Do not use this condition, this is to size the arrays.

◆ ComponentType

Types of components, see respective classes for details.

Enumerator
Placeholder 
Textholder 
Graphics 
Container 
Ignored 

Function Documentation

◆ calculatemargin()

int Gorgon::UI::calculatemargin ( int  l,
int  r 
)

◆ Convert() [1/3]

Geometry::Margin Gorgon::UI::Convert ( const Margin m,
const Geometry::Size parent,
int  emwidth = 10 
)

◆ Convert() [2/3]

Geometry::Point Gorgon::UI::Convert ( const Point p,
const Geometry::Size parent,
int  emwidth = 10 
)

Converts a dimension based point to pixel based point.

References basic_Size< T_ >::Height, basic_Size< T_ >::Width, basic_Point< T_ >::X, and basic_Point< T_ >::Y.

◆ Convert() [3/3]

Geometry::Size Gorgon::UI::Convert ( const Size s,
const Geometry::Size parent,
int  emwidth = 10 
)

Converts a dimension based size to pixel based size.

References basic_Size< T_ >::Height, and basic_Size< T_ >::Width.

◆ Initialize() [1/2]

void Gorgon::UI::Initialize ( float  density,
int  min = 9 
)

Initializes the UI system.

Creates a simple widget template generator based on the primary monitor resolution. Density controls the size of the widgets. Increased density leads to smaller widgets. 7.5 leads to 12pt/16px on a FullHD monitor. This is a very relaxed and easy to use and read size. 10 is more or less standard density.

References Initialize().

◆ Initialize() [2/2]

void Initialize ( std::string  fontname = "",
float  density = 7.5,
int  min = 9 
)

Initializes the UI system.

Creates a simple widget template generator based on the primary monitor resolution. Density controls the size of the widgets. Increased density leads to smaller widgets. 7.5 leads to 12pt/16px on a FullHD monitor. This is a very relaxed and easy to use and read size. 10 is more or less standard density.

References generator, and Monitor::Primary().

◆ IsBottom()

bool Gorgon::UI::IsBottom ( Anchor  a)

Returns if the given anchor is at bottom.

References BottomCenter, BottomLeft, BottomRight, LastBaselineLeft, and LastBaselineRight.

◆ IsCenter()

bool Gorgon::UI::IsCenter ( Anchor  a)

Returns if an anchor is centered horizontally.

References BottomCenter, MiddleCenter, and TopCenter.

◆ IsIn()

bool Gorgon::UI::IsIn ( Anchor  left,
Anchor  right 
)

◆ IsLeft()

bool Gorgon::UI::IsLeft ( Anchor  a)

Returns if an anchor is on the left.

References BottomLeft, FirstBaselineLeft, LastBaselineLeft, MiddleLeft, and TopLeft.

◆ IsMiddle()

bool Gorgon::UI::IsMiddle ( Anchor  a)

Returns if the given anchor is at middle vertically.

References MiddleCenter, MiddleLeft, and MiddleRight.

◆ IsMouseRelated()

bool Gorgon::UI::IsMouseRelated ( ComponentCondition  condition)

Returns if the given condition is related to mouse events.

References Down, and Hover.

◆ IsRight()

bool Gorgon::UI::IsRight ( Anchor  a)

Returns if an anchor is on the right.

References BottomRight, FirstBaselineRight, LastBaselineRight, MiddleRight, and TopRight.

◆ IsTop()

bool Gorgon::UI::IsTop ( Anchor  a)

Returns if the given anchor is at top.

References FirstBaselineLeft, FirstBaselineRight, TopCenter, TopLeft, and TopRight.

◆ operator|()

Variable Documentation

◆ generator

Widgets::Generator* generator