Gorgon Game Engine
GraphicsTemplate Class Reference

Defines a visual component. More...

Inheritance diagram for GraphicsTemplate:
[legend]

Public Member Functions

 GraphicsTemplate ()
 Default constructor. More...
 
 GraphicsTemplate (const Graphics::AnimationProvider &content)
 Filling constructor, might cause ambiguous call due to most drawables being AnimationProviders as well. More...
 
 GraphicsTemplate (const Graphics::Drawable &content)
 Filling constructor, might cause ambiguous call due to most drawables being AnimationProviders as well. More...
 
Graphics::RGBAf GetColor () const
 Returns current tint color. More...
 
bool GetFillArea () const
 Returns whether this graphics will fill the component area. More...
 
Graphics::RGBAf GetTargetColor () const
 Returns the target tint color that will be used for BlendColor value modification. More...
 
virtual ComponentType GetType () const noexcept override
 Returns the type of the component. More...
 
void SetColor (Graphics::RGBAf value)
 Changes the color that will set tint of the drawn graphics. More...
 
void SetFillArea (bool value)
 TODO: add size controller. More...
 
void SetTargetColor (Graphics::RGBAf value)
 Sets the target tint color for BlendColor value modification. More...
 
- Public Member Functions inherited from ComponentTemplate
virtual ~ComponentTemplate ()
 Destructor. More...
 
int GetBaseline () const
 Returns the baseline. If set to 0, it will be detected automatically. More...
 
Point GetCenter () const
 Returns the center point that would be used for rotation. More...
 
bool GetClip () const
 Returns whether currently clipping the contents. More...
 
ComponentCondition GetCondition () const
 Returns the current component condition. More...
 
Anchor GetContainerAnchor () const
 Returns the anchor point of the container that this component will attach to. More...
 
DataEffect GetDataEffect () const
 Returns how the data will affect this component. More...
 
SizingMode GetHorizontalSizing () const
 Returns the horizontal sizing mode of the component. More...
 
Margin GetIndent () const
 Returns the current indent. More...
 
int GetIndex () const
 Returns the component index. More...
 
Margin GetMargin () const
 Returns the margin. More...
 
Anchor GetMyAnchor () const
 Returns the anchor point of this component. More...
 
Point GetPosition () const
 Returns the current position of the component. More...
 
PositionType GetPositioning () const
 Returns the positioning method of the component. More...
 
Anchor GetPreviousAnchor () const
 Returns the anchor point of the previous component that this component will attach to. More...
 
RepeatMode GetRepeatMode () const
 Returns the repeat mode of this component. More...
 
Size GetSize () const
 Returns the size of the component. More...
 
Tag GetTag () const
 Returns the tag of the component. More...
 
ComponentCondition GetTargetCondition () const
 Returns the target component condition. More...
 
std::array< float, 4 > GetValueMax () const
 Returns the value scale maximum. More...
 
float GetValueMax (int channel) const
 Returns the value scale maximum. More...
 
std::array< float, 4 > GetValueMin () const
 Returns the value scale minimum. More...
 
float GetValueMin (int channel) const
 Returns the value scale minimum. More...
 
ValueModification GetValueModification () const
 Returns which property of this component will be modified by the value. More...
 
std::array< int, 4 > GetValueOrdering () const
 Returns the ordering of value channels. More...
 
std::array< float, 4 > GetValueRange () const
 Returns the range of the value scale. More...
 
float GetValueRange (int channel) const
 Returns the range of the value scale. More...
 
ValueSource GetValueSource () const
 Returns the value source that will be used. More...
 
SizingMode GetVerticalSizing () const
 Returns the horizontal sizing mode of the component. More...
 
bool IsReversible () const
 Returns whether this component transition can be reversed. More...
 
bool IsTransition () const
 Returns whether this component is a transition component. More...
 
void SetAnchor (Anchor previous, Anchor container, Anchor my)
 Changes the anchor of the component to the given values. More...
 
void SetBaseline (int value)
 Changes the baseline of the current component. If set to 0, it will be determined automatically. More...
 
void SetCenter (Dimension x, Dimension y)
 Changes the center coordinate that will be used in rotation. More...
 
void SetCenter (Geometry::Point pos, Dimension::Unit unit=Dimension::Pixel)
 Changes the center coordinate that will be used in rotation. More...
 
void SetCenter (int x, int y, Dimension::Unit unit=Dimension::Pixel)
 Changes the center coordinate that will be used in rotation. More...
 
void SetCenter (Point value)
 Changes the center coordinate that will be used in rotation. More...
 
void SetClip (bool value)
 Whether to clip the contents of this container, default value is false. More...
 
void SetCondition (ComponentCondition from, ComponentCondition to)
 Sets the condition when this component will be visible. This variant will create a transition condition. More...
 
void SetCondition (ComponentCondition value)
 Sets the condition when this component will be visible. More...
 
void SetDataEffect (DataEffect effect)
 Sets the data effect for this component. Default is None. More...
 
void SetIndent (Dimension hor, Dimension ver)
 Changes the indent of the component. More...
 
void SetIndent (Dimension left, Dimension top, Dimension right, Dimension bottom)
 Changes the indent of the component. More...
 
void SetIndent (Dimension value)
 Changes the indent of the component. More...
 
void SetIndent (Geometry::Margin value, Dimension::Unit unit=Dimension::Pixel)
 Changes the indent of the component. More...
 
void SetIndent (int hor, int ver, Dimension::Unit unit=Dimension::Pixel)
 Changes the indent of the component. More...
 
void SetIndent (int left, int top, int right, int bottom, Dimension::Unit unit=Dimension::Pixel)
 Changes the indent of the component. More...
 
void SetIndent (int value, Dimension::Unit unit=Dimension::Pixel)
 Changes the indent of the component. More...
 
void SetIndent (Margin value)
 Changes the indent of the component. More...
 
void SetIndex (int value)
 Changes the index of the current component. More...
 
void SetMargin (Dimension hor, Dimension ver)
 Changes the margin of the component. More...
 
void SetMargin (Dimension left, Dimension top, Dimension right, Dimension bottom)
 Changes the margin of the component. More...
 
void SetMargin (Dimension value)
 Changes the margin of the component. More...
 
void SetMargin (Geometry::Margin value, Dimension::Unit unit=Dimension::Pixel)
 Changes the margin of the component. More...
 
void SetMargin (int hor, int ver, Dimension::Unit unit=Dimension::Pixel)
 Changes the margin of the component. More...
 
void SetMargin (int left, int top, int right, int bottom, Dimension::Unit unit=Dimension::Pixel)
 Changes the margin of the component. More...
 
void SetMargin (int value, Dimension::Unit unit=Dimension::Pixel)
 Changes the margin of the component. More...
 
void SetMargin (Margin value)
 Changes the margin of the component. More...
 
void SetPosition (Dimension x, Dimension y)
 Changes the coordinates of the component to the given position. More...
 
void SetPosition (Geometry::Point pos, Dimension::Unit unit=Dimension::Pixel)
 Changes the coordinates of the component to the given position. More...
 
void SetPosition (int x, int y, Dimension::Unit unit=Dimension::Pixel)
 Changes the coordinates of the component to the given position. More...
 
void SetPosition (Point value)
 Changes the coordinates of the component to the given position. More...
 
void SetPositioning (PositionType value)
 Changes the positioning method of the component. More...
 
void SetRepeatMode (RepeatMode value)
 Changes the repeat mode of this component. More...
 
void SetReversible (bool value)
 Sets whether the component transition can be reversed. Can be used to simplify from - to - from animations. More...
 
void SetSize (Dimension w, Dimension h)
 Changes the size of the component. If sizing mode is automatic, it will be set to fixed. More...
 
void SetSize (Geometry::Size size, Dimension::Unit unit=Dimension::Pixel)
 Changes the size of the component. The given values are ignored if the sizing mode is Automatic. More...
 
void SetSize (int w, int h, Dimension::Unit unit=Dimension::Pixel)
 Changes the size of the component. The given values are ignored if the sizing mode is Automatic. More...
 
void SetSize (Size size)
 Changes the size of the component. If sizing mode is automatic, it will be set to fixed. More...
 
void SetSizing (SizingMode hor, SizingMode vert)
 Changes the sizing mode of the component. More...
 
void SetSizing (SizingMode value)
 Changes the sizing mode of the component. More...
 
void SetTag (Tag value)
 Changes the tag of this component. More...
 
void SetValueModification (ValueModification mod, ValueSource source=UseFirst, std::array< float, 4 > min={{0, 0, 0, 0}}, std::array< float, 4 > max={{1, 1, 1, 1}})
 Sets the property that will be affected by the value of the widget. More...
 
void SetValueOrdering (int first, int second, int third, int fourth)
 Changes the ordering of the values. This allows swaps like X-Y. You should specify which channel will receive which value. More...
 
void SetValueRange (int channel, float min, float max)
 Changes the data range, which scales the data effect on the component. More...
 
void SetValueRange (std::array< float, 4 > min, std::array< float, 4 > max)
 Changes the data range, which scales the data effect on the component. More...
 
void SetValueSource (ValueSource value)
 Returns the value source that will be used. More...
 

Public Attributes

VisualProvider Content
 Graphical representation of the template. More...
 
- Public Attributes inherited from ComponentTemplate
Event< ComponentTemplateChangedEvent
 This event will be fired whenever any property is changed. More...
 

Additional Inherited Members

- Public Types inherited from ComponentTemplate
enum  DataEffect {
  None, Text, Title, Label,
  ValueText1, ValueText2, ValueText3, ValueText4,
  State1Text, State2Text, State3Text, State4Text,
  AutoStart, AutoEnd, Icon, Icon1,
  Icon2, State1Icon, State2Icon, State3Icon,
  State4Icon
}
 Which property will the data of the widget affect. More...
 
enum  PositionType { Relative, AbsoluteSliding, Absolute, PolarAbsolute }
 Controls where the component will be placed. More...
 
enum  RepeatMode {
  NoRepeat, Minor, Major, XGrid,
  YGrid, XTick, YTick, XMinorGrid,
  YMinorGrid, XMajorGrid, YMajorGrid, XMinorTick,
  YMinorTick, XMajorTick, YMajorTick
}
 Some components are repeated along some axis, this property controls how they will be repeated. More...
 
enum  SizingMode { Fixed, Automatic, GrowOnly, ShrinkOnly }
 Controls how the size is affected from the contents of the object. More...
 
enum  Tag {
  NoTag, UnknownTag, TickTag, HScrollTag,
  VScrollTag, DragTag, SecondDragTag, DragBarTag,
  XDragTag, YDragTag, MinimapTag, IncrementTag,
  DecrementTag, LeftTag, RightTag, TopTag,
  BottomTag, ExpandTag, ToggleTag, ContentsTag,
  ViewPortTag, SelectionTag, CaretTag, ItemTag,
  HeaderTag, SpacerTag, ListTag
}
 Tags mark a component to be modified in a way meaningful to specific widgets. More...
 
enum  ValueModification {
  NoModification, ModifyPosition, ModifyX, ModifyY,
  ModifyAlpha, ModifyColor, BlendColor, ModifyRotation,
  ModifyAnimation, ModifySize, ModifyWidth, ModifyHeight,
  ModifyPositionAndSize, ModifyXAndWidth, ModifyXAndHeight, ModifyYAndWidth,
  ModifyYAndHeight
}
 Which property will the value of the widget affect. More...
 
enum  ValueSource {
  UseFirst, UseX, UseWidth, UseR,
  UseSecond, UseY, UseHeight, UseG,
  UseT, UseThird, UseZ, UseB,
  UseFourth, UseA, UseW, UseGray,
  UseL, UseH, UseC, UseTransition,
  ValueSourceMaxPower, UseXY, UseSize, UseRG,
  UseYZ, UseGB, UseXZ, UseRB,
  UseXW, UseRA, UseBA, UseGA,
  UseXYZ, UseRGB, UseRGA, UseRBA,
  UseGBA, UseLH, UseLC, UseCH,
  UseGrayAlpha, UseLCH, UseLCHA, UseRGBA
}
 Which data channels should be used as the value, common combinations are listed, however, all combinations are valid except when they are used for mouse mapping. More...
 
- Protected Attributes inherited from ComponentTemplate
int baseline
 Manually set baseline for this component. When 0, it will not be effective. More...
 
Point center
 Center point for rotation. More...
 
bool clip
 If set to true, will clip the contents of the component to the bounds. More...
 
ComponentCondition condition
 Condition when this component will be visible. More...
 
ComponentCondition condition_to
 Condition when this component will be visible, setting condition_to will create a transition component. More...
 
Anchor container
 Anchor point of the container that this component will be attached to, if it is attaching to its parent. More...
 
DataEffect dataeffect
 The effect that the data will have on this component. More...
 
Margin indent
 Indent is added to the margin and padding on the edge of the container. More...
 
int index
 Component index. More...
 
Margin margin
 Margin around the object, will be collapsed with other object margins and padding. More...
 
Anchor my
 Anchor point of the current component. More...
 
Point position
 Position of the component. More...
 
PositionType positioning
 Positioning mode. More...
 
Anchor previous
 Anchor point of the previous component that this component will be attached to. More...
 
RepeatMode repeat
 Whether the component will be repeated along an axis. More...
 
bool reversible
 
Size size
 Size of the object. More...
 
SizingMode sizingh
 
SizingMode sizingw
 Sizing mode. More...
 
ValueSource source
 The value that will be used for this component. More...
 
Tag tag
 Tag identifies a component for various modifications depending on the widget. More...
 
std::array< float, 4 > valuemax
 
std::array< float, 4 > valuemin
 If required, can be used to scale incoming data. More...
 
ValueModification valuemod
 The property of the component that will be affected by the value. More...
 
std::array< int, 4 > valueordering
 Changes the ordering of the value source. More...
 

Detailed Description

Defines a visual component.

RelativeToContents sizing mode is selected if no drawable is supplied, the relative size will be taken as 0x0. If the drawable has no size information, object will be treated as RelativeToContainer and size will be taken as 100%. This component can either work with animation providers, which are meant to be instantiated or drawable which will directly be used.

Constructor & Destructor Documentation

◆ GraphicsTemplate() [1/3]

◆ GraphicsTemplate() [2/3]

GraphicsTemplate ( const Graphics::Drawable content)

Filling constructor, might cause ambiguous call due to most drawables being AnimationProviders as well.

You might typecast or use Content.SetDrawable function

◆ GraphicsTemplate() [3/3]

Filling constructor, might cause ambiguous call due to most drawables being AnimationProviders as well.

You might typecast or use Content.SetDrawable function

Member Function Documentation

◆ GetColor()

Graphics::RGBAf GetColor ( ) const

Returns current tint color.

◆ GetFillArea()

bool GetFillArea ( ) const

Returns whether this graphics will fill the component area.

◆ GetTargetColor()

Graphics::RGBAf GetTargetColor ( ) const

Returns the target tint color that will be used for BlendColor value modification.

◆ GetType()

virtual ComponentType GetType ( ) const
overridevirtualnoexcept

Returns the type of the component.

Implements ComponentTemplate.

References Gorgon::UI::Graphics.

◆ SetColor()

void SetColor ( Graphics::RGBAf  value)

Changes the color that will set tint of the drawn graphics.

References ComponentTemplate::ChangedEvent.

◆ SetFillArea()

void SetFillArea ( bool  value)

TODO: add size controller.

Set to true if you want to fill the region with the given graphics. This will only work if the given animation/drawable is rectangular

References ComponentTemplate::ChangedEvent.

◆ SetTargetColor()

void SetTargetColor ( Graphics::RGBAf  value)

Sets the target tint color for BlendColor value modification.

References ComponentTemplate::ChangedEvent.

Member Data Documentation

◆ Content

VisualProvider Content

Graphical representation of the template.


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