 |
Gorgon Game Engine
|
Go to the documentation of this file.
6 #include "../Geometry/Margin.h"
7 #include "../Geometry/Size.h"
9 #include "../Containers/Collection.h"
10 #include "../Graphics/Drawables.h"
11 #include "../Graphics/Animations.h"
382 class ComponentTemplate;
383 class PlaceholderTemplate;
384 class TextholderTemplate;
385 class GraphicsTemplate;
386 class ContainerTemplate;
387 class IgnoredTemplate;
417 components.Destroy();
462 components.Delete(index);
475 return components.GetCount();
481 return components[index];
487 return components[index];
557 durations[{from, to}] = duration;
563 if(durations.count({from, to}))
564 return durations.at({from, to});
590 std::vector<Event<ComponentTemplate>::Token> tokens;
591 std::map<std::pair<ComponentCondition, ComponentCondition>,
int> durations;
1001 margin = {{left, unit}, {top, unit}, {right, unit}, {bottom, unit}};
1043 indent = {{left, unit}, {top, unit}, {right, unit}, {bottom, unit}};
1099 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}}) {
1120 ASSERT(channel>=0 && channel<4,
"Channel index out of bounds");
1180 ASSERT(channel>=0 && channel<4,
"Channel index out of bounds");
1187 ASSERT(channel>=0 && channel<4,
"Channel index out of bounds");
1194 ASSERT(channel>=0 && channel<4,
"Channel index out of bounds");
1391 return temp !=
nullptr;
1398 ASSERT(temp,
"Template is empty.");
1446 ASSERT(renderer,
"Renderer is not set.");
1466 targetcolor = value;
1501 changed(&changed), provider(&content)
1505 changed(&changed), drawable(&content)
1510 return drawable !=
nullptr || provider !=
nullptr;
1515 return provider !=
nullptr;
1520 return drawable !=
nullptr;
1525 if(provider ==
nullptr) {
1526 throw std::runtime_error(
"Animation not set.");
1534 if(drawable ==
nullptr) {
1535 throw std::runtime_error(
"Drawable not set.");
1548 throw std::runtime_error(
"Visual provider is empty.");
1633 targetcolor = value;
1665 padding ={{left, unit},{top, unit},{right, unit},{bottom, unit}};
1671 padding ={{value.
Left, unit},{value.
Top, unit},{value.
Right, unit},{value.
Bottom, unit}};
1762 indices.push_back(componentindex);
1772 indices.insert(indices.begin() + before, componentindex);
1778 indices.erase(indices.begin() +
index);
1784 return (
int)indices.size();
1789 return indices[
index];
1794 return indices[
index];
1818 std::vector<int> indices;
1820 bool reportmouse =
false;
@ State4Icon
Definition: Template.h:684
@ Disabled
Component is visible when the widget is disabled.
Definition: Template.h:184
Point position
Position of the component.
Definition: Template.h:1323
Margin indent
Indent is added to the margin and padding on the edge of the container.
Definition: Template.h:1336
Dimension data for components. Allows relative position and sizing.
Definition: Dimension.h:9
Anchor GetPreviousAnchor() const
Returns the anchor point of the previous component that this component will attach to.
Definition: Template.h:1211
@ Last
In a list this denotes the item is at the last place.
Definition: Template.h:239
@ UseW
Definition: Template.h:792
PlaceholderTemplate()
Definition: Template.h:1373
ComponentTemplate & Get(int index) const
Returns the component at the given index.
Definition: Template.h:480
@ LabelIsSet
Data effect of the component is set.
Definition: Template.h:322
void SetPadding(int left, int top, int right, int bottom, Dimension::Unit unit=Dimension::Pixel)
Changes the padding of the component. Padding is the minimum spacing inside the component.
Definition: Template.h:1664
@ NoModification
Nothing will be modified.
Definition: Template.h:691
@ UseLH
Definition: Template.h:836
Orientation
2D orientation constants
Definition: Graphics.h:39
std::array< float, 4 > GetValueMin() const
Returns the value scale minimum.
Definition: Template.h:1170
@ Automatic
Given size is not used, object is sized to its contents.
Definition: Template.h:634
@ ValueSourceMaxPower
Maximum power of two.
Definition: Template.h:812
void InsertIndex(int before, int componentindex)
Insert an index to the specified location in the container.
Definition: Template.h:1771
@ UseC
Chromacity.
Definition: Template.h:804
int index
Component index.
Definition: Template.h:1361
@ Middle
In a list this denotes the item is somewhere in the middle.
Definition: Template.h:236
ContainerTemplate & AddIndex(int componentindex)
Adds an index to the container.
Definition: Template.h:1761
@ First
In a list this denotes the item is at the first place.
Definition: Template.h:233
bool IsRight(Anchor a)
Returns if an anchor is on the right.
Definition: Template.h:95
Anchor my
Anchor point of the current component.
Definition: Template.h:1352
@ UseSize
Definition: Template.h:815
@ TopTag
Definition: Template.h:868
void SetIndent(Dimension left, Dimension top, Dimension right, Dimension bottom)
Changes the indent of the component.
Definition: Template.h:1064
@ UseSecond
Definition: Template.h:779
@ Multiples
Size of the template should be incremented at the multiples of the size and addition size should be a...
Definition: Template.h:405
DataEffect dataeffect
The effect that the data will have on this component.
Definition: Template.h:1297
@ PolarAbsolute
The given coordinates are polar coordinates, The radius is given in pixels and angle is specified in ...
Definition: Template.h:625
@ XGrid
Definition: Template.h:892
@ Even
In lists denotes the item is in even position.
Definition: Template.h:230
@ RightTag
Definition: Template.h:867
@ State2Icon
Definition: Template.h:682
@ YMajorTick
Definition: Template.h:906
VisualProvider Background
Background graphics.
Definition: Template.h:1810
@ TextIsSet
Data effect of the component is set.
Definition: Template.h:316
Textholder is designed to hold text data.
Definition: Template.h:1422
Graphics::RGBAf GetTargetColor() const
Returns the target color that will be used for BlendColor value modification.
Definition: Template.h:1472
@ ValueText3
Definition: Template.h:664
@ HeaderTag
Definition: Template.h:877
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.
Definition: Template.h:1099
void SetBaseline(int value)
Changes the baseline of the current component. If set to 0, it will be determined automatically.
Definition: Template.h:1223
@ UseLCH
Definition: Template.h:842
@ UseG
Definition: Template.h:782
void SetSize(Dimension w, Dimension h)
Changes the size of the component. If sizing mode is automatic, it will be set to fixed.
Definition: Template.h:958
@ ContentsTag
Definition: Template.h:872
@ UseHeight
Definition: Template.h:781
void SetConditionDuration(ComponentCondition from, ComponentCondition to, int duration)
Changes the duration of a component condition.
Definition: Template.h:556
ValueSource GetValueSource() const
Returns the value source that will be used.
Definition: Template.h:1139
RepeatMode repeat
Whether the component will be repeated along an axis.
Definition: Template.h:1317
void SetMargin(int value, Dimension::Unit unit=Dimension::Pixel)
Changes the margin of the component.
Definition: Template.h:992
@ Down
This is activated when the mouse is pressed on the component stack.
Definition: Template.h:197
@ Icon
Data will effect the displayed graphics.
Definition: Template.h:678
std::array< float, 4 > valuemax
Definition: Template.h:1309
@ YDragTag
Definition: Template.h:862
T_ Left
Left margin.
Definition: Margin.h:167
@ FirstBaselineRight
Baseline right, for text, this aligns to the baseline of the first line.
Definition: Template.h:67
@ Absolute
Absolute positioning, coordinates will start from the container.
Definition: Template.h:619
virtual ComponentType GetType() const noexcept override
Returns the type of the component.
Definition: Template.h:1600
Tag tag
Tag identifies a component for various modifications depending on the widget.
Definition: Template.h:1313
int GetCount() const
Returns the number of component indices stored in this container.
Definition: Template.h:1783
void SetMargin(Dimension value)
Changes the margin of the component.
Definition: Template.h:1014
@ UseTransition
This channel will give the progress of a transition.
Definition: Template.h:809
@ Relative
Component will be placed relative to the previous component.
Definition: Template.h:610
Defines a placeholder according to the Box Model.
Definition: Template.h:1370
@ Ch2V0
Channel 2 value is 0, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:270
This class provides event mechanism.
Definition: Event.h:134
@ UseR
Red or radius for polar coordinates.
Definition: Template.h:777
Margin GetPadding() const
Returns the padding.
Definition: Template.h:1688
void SetMargin(int left, int top, int right, int bottom, Dimension::Unit unit=Dimension::Pixel)
Changes the margin of the component.
Definition: Template.h:1000
A regular drawable animation provider.
Definition: Animations.h:28
@ ModifyAlpha
Value modifies the opacity of the component.
Definition: Template.h:709
void SetRepeatMode(RepeatMode value)
Changes the repeat mode of this component.
Definition: Template.h:1157
void SetMargin(Margin value)
Changes the margin of the component.
Definition: Template.h:1026
std::string Name
Definition: Template.h:586
@ SelectionTag
Definition: Template.h:874
@ Ch2V05
Channel 2 value is 0.5, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:274
@ MiddleLeft
Middle left.
Definition: Template.h:48
@ State1TextIsSet
Data effect of the component is set.
Definition: Template.h:337
This class stores visual information about a widget template.
Definition: Template.h:392
void SetBorderSize(int hor, int ver)
Changes the border size of the component.
Definition: Template.h:1698
virtual bool IsReady() const =0
Whether the render can render text.
Controllers are required to progress animations.
Definition: Animation.h:65
@ Fixed
Size of the template is fixed and should not be modified.
Definition: Template.h:401
@ TopCenter
Top center.
Definition: Template.h:43
@ Ch4V0
Channel 4 value is 0, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:294
bool GetReportMouse() const
@ Ch3V0
Channel 3 value is 0, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:282
T_ X
X coordinate.
Definition: Point.h:368
GraphicsTemplate & AddGraphics(int index, ComponentCondition cond)
This will create a new drawable and return it.
Definition: Template.h:442
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...
Definition: Template.h:1086
@ UseRBA
Definition: Template.h:833
const Graphics::AnimationProvider & GetAnimation() const
Returns the content as animation provider.
Definition: Template.h:1524
@ State1Text
Definition: Template.h:669
@ State3Icon
Definition: Template.h:683
@ Ch4V1
Channel 4 value is 1, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:302
@ StateIcon4IsSet
Data effect of the component is set.
Definition: Template.h:364
@ Hover
Mouse is over the widget, or over a particular repeat.
Definition: Template.h:193
T_ Height
Height of this size object.
Definition: Size.h:261
int operator[](int index) const
Returns the component index at the given location.
Definition: Template.h:1788
void SetPosition(Geometry::Point pos, Dimension::Unit unit=Dimension::Pixel)
Changes the coordinates of the component to the given position.
Definition: Template.h:916
float GetValueMax(int channel) const
Returns the value scale maximum.
Definition: Template.h:1193
ComponentCondition GetCondition() const
Returns the current component condition.
Definition: Template.h:1248
@ Label
Definition: Template.h:655
void SetText(const std::string &value)
Sets the default text for the textholder.
Definition: Template.h:1478
Geometry::Size GetAdditionalSize() const
Returns the additional size.
Definition: Template.h:550
std::array< float, 4 > GetValueMax() const
Returns the value scale maximum.
Definition: Template.h:1176
@ UseGA
Definition: Template.h:827
void SetPadding(Margin value)
Changes the padding of the component. Padding is the minimum spacing inside the component.
Definition: Template.h:1685
@ DecrementTag
Definition: Template.h:865
@ ModifyRotation
Data affects the rotation of the component.
Definition: Template.h:725
void Remove(int index)
Removes the component at the given index.
Definition: Template.h:461
@ UseYZ
Definition: Template.h:818
void SetBorderSize(int value)
Changes the border size of the component.
Definition: Template.h:1694
SizingMode GetHorizontalSizing() const
Returns the horizontal sizing mode of the component.
Definition: Template.h:984
@ XMajorGrid
Definition: Template.h:900
Definition: Template.h:1496
@ TopLeft
Top left.
Definition: Template.h:41
@ XTick
Definition: Template.h:895
Size size
Size of the object.
Definition: Template.h:1329
void SetValueRange(std::array< float, 4 > min, std::array< float, 4 > max)
Changes the data range, which scales the data effect on the component.
Definition: Template.h:1110
@ SpacerTag
Definition: Template.h:878
std::array< int, 4 > GetValueOrdering() const
Returns the ordering of value channels.
Definition: Template.h:1093
void SetValueRange(int channel, float min, float max)
Changes the data range, which scales the data effect on the component.
Definition: Template.h:1119
Margin margin
Margin around the object, will be collapsed with other object margins and padding.
Definition: Template.h:1333
@ XDragTag
Definition: Template.h:861
@ LastBaselineLeft
Baseline left, for text, this aligns to the baseline of the last line.
Definition: Template.h:72
@ ModifyY
Modifies the Y coordinate of the component regardless of the container direction.
Definition: Template.h:705
@ GrowOnly
Given size is the minimum, if the contents are bigger, the object be resized to fit.
Definition: Template.h:638
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.
Definition: Template.h:955
void SetDataEffect(DataEffect effect)
Sets the data effect for this component. Default is None.
Definition: Template.h:1076
Geometry::Margin GetOverlayExtent() const
Returns the overlay extent.
Definition: Template.h:1750
bool IsReversible() const
Returns whether this component transition can be reversed.
Definition: Template.h:1260
void SetClip(bool value)
Whether to clip the contents of this container, default value is false.
Definition: Template.h:1267
void SetOverlayExtent(Geometry::Margin value)
Changes the overlay extent of the component.
Definition: Template.h:1747
Represents a four channel 32 bit float per channel color information.
Definition: Color.h:373
Template()
Definition: Template.h:408
@ HScroll
There is space horizontally to be scrolled.
Definition: Template.h:248
PositionType GetPositioning() const
Returns the positioning method of the component.
Definition: Template.h:932
@ Odd
In lists denotes the item is in odd position.
Definition: Template.h:227
@ BottomRight
Bottom right.
Definition: Template.h:60
const Template & GetTemplate() const
Returns the sub template of this placeholder.
Definition: Template.h:1397
@ UseRB
Definition: Template.h:822
void SetIndex(int value)
Changes the index of the current component.
Definition: Template.h:1232
VisualProvider(Event< ComponentTemplate > &changed, const Graphics::Drawable &content)
Definition: Template.h:1504
@ UseCH
Definition: Template.h:838
void SetSize(int w, int h)
Changes the size of the template.
Definition: Template.h:508
TextholderTemplate & AddTextholder(int index, ComponentCondition cond)
This will create a new textholder and return it.
Definition: Template.h:430
Anchor GetMyAnchor() const
Returns the anchor point of this component.
Definition: Template.h:1218
TextholderTemplate()
Definition: Template.h:1424
void SetIndent(int value, Dimension::Unit unit=Dimension::Pixel)
Changes the indent of the component.
Definition: Template.h:1034
@ None
Nothing will be affected.
Definition: Template.h:648
Graphics::RGBAf GetColor() const
Returns current tint color.
Definition: Template.h:1627
virtual ~ComponentTemplate()
Destructor.
Definition: Template.h:604
@ UnknownTag
Do not use this tag for regular components, it is used to identify substacks without a tag.
Definition: Template.h:854
@ Opened
This condition is triggered when the widget is opened like a combobox showing its list part.
Definition: Template.h:213
void SetCondition(ComponentCondition value)
Sets the condition when this component will be visible.
Definition: Template.h:1242
Geometry::Margin GetBorderSize() const
Returns the border size.
Definition: Template.h:1709
int GetBaseline() const
Returns the baseline. If set to 0, it will be detected automatically.
Definition: Template.h:1226
Defines an object according to the Box Model.
Definition: Template.h:600
@ State4
Fourth state of the widget, first state is Always.
Definition: Template.h:207
@ ModifyXAndWidth
Modifies X position and width.
Definition: Template.h:754
@ ToggleTag
Definition: Template.h:871
std::string GetText() const
Returns the default text for the textholder.
Definition: Template.h:1485
@ DataEffectStart
Do not use this value.
Definition: Template.h:313
@ Pixel
Fixed pixel based dimensions.
Definition: Dimension.h:18
@ Closed
This condition is triggered when the widget is closed like a tree view item that is folded,...
Definition: Template.h:220
Geometry::Size GetSize() const
Returns the size of the template.
Definition: Template.h:520
bool IsAnimation() const
Of this drawable template has animation content.
Definition: Template.h:1514
@ ModifyWidth
Width of this component will be affected.
Definition: Template.h:739
void SetIndent(int hor, int ver, Dimension::Unit unit=Dimension::Pixel)
Changes the indent of the component.
Definition: Template.h:1038
void SetPositioning(PositionType value)
Changes the positioning method of the component.
Definition: Template.h:925
~Template()
Destructor.
Definition: Template.h:416
@ CaretTag
Definition: Template.h:875
@ ModifyYAndWidth
Modifies Y position and width.
Definition: Template.h:760
@ Container
Definition: Template.h:165
@ TitleIsSet
Data effect of the component is set.
Definition: Template.h:319
Point GetPosition() const
Returns the current position of the component.
Definition: Template.h:929
ValueModification
Which property will the value of the widget affect.
Definition: Template.h:689
void SetCenter(int x, int y, Dimension::Unit unit=Dimension::Pixel)
Changes the center coordinate that will be used in rotation.
Definition: Template.h:935
@ UseFirst
Definition: Template.h:773
@ HScrollTag
Definition: Template.h:856
@ Text
Works only for TextholderTemplate, data will affect the text that is displayed.
Definition: Template.h:651
void SetShadowExtent(int hor, int ver)
Changes the shadow extent of the component.
Definition: Template.h:1718
bool reversible
Definition: Template.h:1286
ValueModification valuemod
The property of the component that will be affected by the value.
Definition: Template.h:1300
@ Placeholder
Definition: Template.h:162
Anchor previous
Anchor point of the previous component that this component will be attached to.
Definition: Template.h:1344
@ None
This anchor position should is only used to denote object will not be anchored to a previous object,...
Definition: Template.h:38
T_ Top
Top margin.
Definition: Margin.h:170
SizeMode GetYSizing() const
Returns the sizing mode.
Definition: Template.h:503
Event< ComponentTemplate > ChangedEvent
This event will be fired whenever any property is changed.
Definition: Template.h:1279
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
This class represents a 2D geometric size.
Definition: Size.h:23
RepeatMode GetRepeatMode() const
Returns the repeat mode of this component.
Definition: Template.h:1164
@ UseT
Theta for polar coordinates.
Definition: Template.h:784
void SetSizing(SizingMode hor, SizingMode vert)
Changes the sizing mode of the component.
Definition: Template.h:977
ComponentCondition condition
Condition when this component will be visible.
Definition: Template.h:1290
@ ValueText3IsSet
Data effect of the component is set.
Definition: Template.h:331
@ ModifyYAndHeight
Modifies Y position and height.
Definition: Template.h:763
@ UseB
Definition: Template.h:788
void SetMargin(Dimension hor, Dimension ver)
Changes the margin of the component.
Definition: Template.h:1018
int GetSpacing() const
Returns the spacing required for this template.
Definition: Template.h:578
@ UseRA
Definition: Template.h:825
int GetCount() const
Returns the number of components in the template.
Definition: Template.h:474
void SetPadding(Geometry::Margin value, Dimension::Unit unit=Dimension::Pixel)
Changes the padding of the component. Padding is the minimum spacing inside the component.
Definition: Template.h:1670
virtual Animation & CreateAnimation(Gorgon::Animation::ControllerBase &timer) const override=0
This function should create a new animation with the given controller and if owner parameter is set t...
@ ModifyXAndHeight
Modifies X position and height.
Definition: Template.h:757
VisualProvider(Event< ComponentTemplate > &changed)
Definition: Template.h:1498
@ ValueText4IsSet
Data effect of the component is set.
Definition: Template.h:334
void SetDrawable(const Graphics::Drawable &value)
Sets the content from a drawable.
Definition: Template.h:1553
ComponentTemplate & operator[](int index) const
Returns the component at the given index.
Definition: Template.h:486
void SetOverlayExtent(int left, int top, int right, int bottom)
Changes the overlay extent of the component.
Definition: Template.h:1743
void SetPosition(Dimension x, Dimension y)
Changes the coordinates of the component to the given position.
Definition: Template.h:919
bool IsBottom(Anchor a)
Returns if the given anchor is at bottom.
Definition: Template.h:135
@ UseBA
Definition: Template.h:826
@ Major
Definition: Template.h:890
@ ModifyColor
Value modifies the color of the component.
Definition: Template.h:713
void SetPosition(Point value)
Changes the coordinates of the component to the given position.
Definition: Template.h:922
Template & operator=(Template &&)=default
float GetValueRange(int channel) const
Returns the range of the value scale.
Definition: Template.h:1186
void SetReportMouse(bool value)
Mouse reporting allows component stack to report mouse events over this container to be reported sepa...
const Graphics::Drawable & GetDrawable() const
Returns the content as a drawable.
Definition: Template.h:1533
@ UseGrayAlpha
Definition: Template.h:840
void SetIndent(Margin value)
Changes the indent of the component.
Definition: Template.h:1068
int baseline
Manually set baseline for this component. When 0, it will not be effective.
Definition: Template.h:1355
void SetTargetColor(Graphics::RGBAf value)
Sets the target tint color for BlendColor value modification.
Definition: Template.h:1632
@ ViewPortTag
Definition: Template.h:873
@ UseY
Definition: Template.h:780
@ ValueText2IsSet
Data effect of the component is set.
Definition: Template.h:328
@ TopRight
Top right.
Definition: Template.h:45
@ VScrollTag
Definition: Template.h:857
void SetShadowExtent(Geometry::Margin value)
Changes the shadow extent of the component.
Definition: Template.h:1726
Anchor container
Anchor point of the container that this component will be attached to, if it is attaching to its pare...
Definition: Template.h:1348
@ UseThird
Definition: Template.h:786
@ Default
This widget is the default widget of its container.
Definition: Template.h:305
@ ListTag
Definition: Template.h:879
#define ASSERT(expression, message,...)
Replaces regular assert to allow messages and backtrace.
Definition: Assert.h:161
void SetMargin(Dimension left, Dimension top, Dimension right, Dimension bottom)
Changes the margin of the component.
Definition: Template.h:1022
Size GetSize() const
Returns the size of the component.
Definition: Template.h:981
@ VScroll
There is space vertically to be scrolled.
Definition: Template.h:251
void SetCenter(Dimension x, Dimension y)
Changes the center coordinate that will be used in rotation.
Definition: Template.h:941
int GetWidth() const
Returns the size of the template.
Definition: Template.h:525
@ BottomLeft
Bottom left.
Definition: Template.h:56
virtual ComponentType GetType() const noexcept override
Returns the type of the component.
Definition: Template.h:1432
bool IsTop(Anchor a)
Returns if the given anchor is at top.
Definition: Template.h:121
Collection is a container for reference typed objects.
Definition: Collection.h:21
@ DragTag
Definition: Template.h:858
void SetRenderer(const Graphics::TextRenderer &value)
Changes the renderer.
Definition: Template.h:1440
Margin GetMargin() const
Returns the margin.
Definition: Template.h:1029
@ ModifyAnimation
Data will affect the progress of the animation.
Definition: Template.h:729
@ DragBarTag
Definition: Template.h:860
void SetSize(Geometry::Size value)
Changes the size of the template.
Definition: Template.h:514
PlaceholderTemplate & AddPlaceholder(int index, ComponentCondition cond)
This will create a new placeholder and return it.
Definition: Template.h:422
@ AutoStart
Definition: Template.h:674
Graphics::Orientation GetOrientation() const
Returns the current orientation of the container.
Definition: Template.h:1756
@ State4TextIsSet
Data effect of the component is set.
Definition: Template.h:346
ComponentType
Types of components, see respective classes for details.
Definition: Template.h:161
std::array< int, 4 > valueordering
Changes the ordering of the value source.
Definition: Template.h:1306
@ LastBaselineRight
Baseline right, for text, this aligns to the baseline of the last line.
Definition: Template.h:77
Template(Template &&)=default
@ UseH
Hue.
Definition: Template.h:801
@ YMajorGrid
Definition: Template.h:901
virtual ComponentType GetType() const noexcept override
Returns the type of the component.
Definition: Template.h:1798
@ UseGBA
Definition: Template.h:834
bool GetFillArea() const
Returns whether this graphics will fill the component area.
Definition: Template.h:1615
@ AutoEnd
Definition: Template.h:675
const Graphics::Drawable & Instantiate(Animation::ControllerBase &controller) const
Definition: Template.h:1541
GraphicsTemplate()
Default constructor.
Definition: Template.h:1584
ValueSource
Which data channels should be used as the value, common combinations are listed, however,...
Definition: Template.h:772
#define ENUMCLASS
Definition: Types.h:173
@ BlendColor
In text and graphics templates, this setting will blend the color to target color.
Definition: Template.h:720
void SetOverlayExtent(int hor, int ver)
Changes the overlay extent of the component.
Definition: Template.h:1739
RepeatMode
Some components are repeated along some axis, this property controls how they will be repeated.
Definition: Template.h:886
@ ModifyX
Modifies the X coordinate of the component regardless of the container direction.
Definition: Template.h:701
SizingMode
Controls how the size is affected from the contents of the object.
Definition: Template.h:629
@ UseXYZ
Definition: Template.h:829
@ BottomCenter
Bottom center.
Definition: Template.h:58
void SetBorderSize(int left, int top, int right, int bottom)
Changes the border size of the component.
Definition: Template.h:1702
@ ModifyPositionAndSize
This is a combined modification of position and size.
Definition: Template.h:751
@ UseRGBA
Definition: Template.h:845
GraphicsTemplate(const Graphics::Drawable &content)
Filling constructor, might cause ambiguous call due to most drawables being AnimationProviders as wel...
Definition: Template.h:1591
Tag GetTag() const
Returns the tag of the component.
Definition: Template.h:1151
void SetPadding(Dimension value)
Changes the padding of the component. Padding is the minimum spacing inside the component.
Definition: Template.h:1676
void SetCenter(Point value)
Changes the center coordinate that will be used in rotation.
Definition: Template.h:944
@ State3Text
Definition: Template.h:671
@ BottomTag
Definition: Template.h:869
void SetAnimation(const Graphics::AnimationProvider &value)
Sets the content from an animation provider.
Definition: Template.h:1561
@ UseLC
Definition: Template.h:837
Anchor GetContainerAnchor() const
Returns the anchor point of the container that this component will attach to.
Definition: Template.h:1215
@ Ch2V1
Channel 2 value is 1, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:278
T_ Bottom
Bottom margin.
Definition: Margin.h:176
void SetPadding(int hor, int ver, Dimension::Unit unit=Dimension::Pixel)
Changes the padding of the component. Padding is the minimum spacing inside the component.
Definition: Template.h:1661
@ Ch1V0
Channel 1 value is 0, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:258
@ ModifyPosition
Position of this component will be affected by the data.
Definition: Template.h:697
ContainerTemplate & AddContainer(int index, ComponentCondition cond)
This will create a new drawable and return it.
Definition: Template.h:450
This class represents a 2D point.
Definition: Point.h:32
@ Fixed
The given size is absolute, it is not affected by the contents.
Definition: Template.h:631
void SetSizing(SizingMode value)
Changes the sizing mode of the component.
Definition: Template.h:974
@ NoRepeat
Definition: Template.h:887
@ ModifyHeight
Height of this component will be affected.
Definition: Template.h:744
@ UseA
Definition: Template.h:791
This class allows printing text on the screen.
Definition: Font.h:152
@ ValueText4
Definition: Template.h:667
SizingMode sizingw
Sizing mode.
Definition: Template.h:1326
void SetAnchor(Anchor previous, Anchor container, Anchor my)
Changes the anchor of the component to the given values.
Definition: Template.h:1201
@ ModifySize
Size of this component will be affected.
Definition: Template.h:734
void SetFillArea(bool value)
TODO: add size controller.
Definition: Template.h:1608
void SetShadowExtent(int left, int top, int right, int bottom)
Changes the shadow extent of the component.
Definition: Template.h:1722
void SetValueSource(ValueSource value)
Returns the value source that will be used.
Definition: Template.h:1132
bool IsMiddle(Anchor a)
Returns if the given anchor is at middle vertically.
Definition: Template.h:149
void SetReversible(bool value)
Sets whether the component transition can be reversed. Can be used to simplify from - to - from anima...
Definition: Template.h:1257
Margin GetIndent() const
Returns the current indent.
Definition: Template.h:1071
@ UseX
Definition: Template.h:774
@ YTick
Definition: Template.h:896
@ UseL
Lightness.
Definition: Template.h:798
ComponentCondition
Controls the condition when the components are visible.
Definition: Template.h:174
void SetSizing(SizeMode x, SizeMode y)
Changes the size mode of the template.
Definition: Template.h:491
@ UseLCHA
Definition: Template.h:843
bool GetClip() const
Returns whether currently clipping the contents.
Definition: Template.h:1272
bool IsReady() const
Returns if this text holder can perform rendering.
Definition: Template.cpp:457
int GetIndex() const
Returns the component index.
Definition: Template.h:1235
bool clip
If set to true, will clip the contents of the component to the bounds.
Definition: Template.h:1284
bool IsTransition() const
Returns whether this component is a transition component.
Definition: Template.h:1254
Geometry::Margin GetShadowExtent() const
Returns the shadow extent.
Definition: Template.h:1729
@ Active
This is for widgets that can be activated, like a count down timer.
Definition: Template.h:245
bool IsMouseRelated(ComponentCondition condition)
Returns if the given condition is related to mouse events.
Definition: Template.h:371
GraphicsTemplate(const Graphics::AnimationProvider &content)
Filling constructor, might cause ambiguous call due to most drawables being AnimationProviders as wel...
Definition: Template.h:1596
@ MiddleRight
Middle right.
Definition: Template.h:53
void SetPadding(Dimension hor, Dimension ver)
Changes the padding of the component. Padding is the minimum spacing inside the component.
Definition: Template.h:1679
void SetAdditionalSize(int w, int h)
Changes the additional size of the template.
Definition: Template.h:536
SizeMode GetXSizing() const
Returns the sizing mode.
Definition: Template.h:498
ValueSource source
The value that will be used for this component.
Definition: Template.h:1303
ComponentCondition condition_to
Condition when this component will be visible, setting condition_to will create a transition componen...
Definition: Template.h:1294
void SetPosition(int x, int y, Dimension::Unit unit=Dimension::Pixel)
Changes the coordinates of the component to the given position.
Definition: Template.h:913
@ State2
Second state of the widget, first state is Always.
Definition: Template.h:201
@ ValueText2
Definition: Template.h:661
@ UseGB
Definition: Template.h:819
bool IsCenter(Anchor a)
Returns if an anchor is centered horizontally.
Definition: Template.h:109
Graphics::RGBAf GetColor() const
Returns current color.
Definition: Template.h:1459
@ XMinorTick
Definition: Template.h:903
T_ Right
Right margin.
Definition: Margin.h:173
void Assume(ComponentTemplate &component)
Adds a previously created component to the template, the ownership of the object is transferred to th...
Definition: Template.cpp:446
@ Graphics
Definition: Template.h:164
@ Ch1V1
Channel 1 value is 1, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:266
@ Icon2IsSet
Data effect of the component is set.
Definition: Template.h:352
void SetIndent(Geometry::Margin value, Dimension::Unit unit=Dimension::Pixel)
Changes the indent of the component.
Definition: Template.h:1049
@ Free
This template can be freely resized.
Definition: Template.h:398
void SetColor(Graphics::RGBAf value)
Changes the color that will set tint of the drawn graphics.
Definition: Template.h:1620
@ StateIcon1IsSet
Data effect of the component is set.
Definition: Template.h:355
int GetHeight() const
Returns the size of the template.
Definition: Template.h:530
@ UseRG
Definition: Template.h:816
@ ShrinkOnly
Given size is the maximum, if the contents are smaller, the object be resized.
Definition: Template.h:642
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.
Definition: Template.h:952
@ NoTag
Definition: Template.h:851
@ YMinorGrid
Definition: Template.h:899
bool IsDrawable() const
Of this drawable template has drawable content.
Definition: Template.h:1519
void SetTag(Tag value)
Changes the tag of this component.
Definition: Template.h:1144
@ YMinorTick
Definition: Template.h:904
int GetConditionDuration(ComponentCondition from, ComponentCondition to) const
Returns the duration of the component condition.
Definition: Template.h:562
@ UseGray
Grayscale value of color.
Definition: Template.h:795
@ State4Text
Definition: Template.h:672
@ UseFourth
Definition: Template.h:790
SizingMode sizingh
Definition: Template.h:1326
@ HVScroll
There is space both horizontally and vertically to be scrolled.
Definition: Template.h:254
void SetIndent(int left, int top, int right, int bottom, Dimension::Unit unit=Dimension::Pixel)
Changes the indent of the component.
Definition: Template.h:1042
@ Focused
Widget has the focus.
Definition: Template.h:190
@ AbsoluteSliding
Absolute positioning, coordinates will start from the container, percent based movement will move to ...
Definition: Template.h:615
void SetShadowExtent(int value)
Changes the shadow extent of the component.
Definition: Template.h:1714
@ SecondDragTag
Definition: Template.h:859
@ MiddleCenter
Middle center, using this position ensures that the components will be inside each other.
Definition: Template.h:51
T_ Y
Y coordinate.
Definition: Point.h:371
@ UseRGB
Definition: Template.h:830
float GetValueMin(int channel) const
Returns the value scale minimum.
Definition: Template.h:1179
@ State2Text
Definition: Template.h:670
@ StateIcon2IsSet
Data effect of the component is set.
Definition: Template.h:358
Point center
Center point for rotation.
Definition: Template.h:1339
Defines a visual component.
Definition: Template.h:1580
T_ Width
Width of this size object.
Definition: Size.h:258
Represents a drawable object, that can be drawn to the given point.
Definition: Drawables.h:17
virtual ComponentType GetType() const noexcept override
Returns the type of the component.
Definition: Template.h:1379
@ Ignored
Definition: Template.h:166
This component type will be ignored by ComponentStack, effectively erasing Always when necessary.
Definition: Template.h:1408
std::array< float, 4 > GetValueRange() const
Returns the range of the value scale.
Definition: Template.h:1173
ComponentTemplate & Release(int index)
Releases the component and its ownership.
Definition: Template.cpp:432
VisualProvider(Event< ComponentTemplate > &changed, const Graphics::AnimationProvider &content)
Definition: Template.h:1500
@ State1Icon
Definition: Template.h:681
@ ItemTag
Definition: Template.h:876
IgnoredTemplate & AddIgnored(int index, ComponentCondition cond)
This will create a new ignored template.
Definition: Template.h:434
ComponentCondition GetTargetCondition() const
Returns the target component condition.
Definition: Template.h:1251
Container class that defines an area according to the Box Model.
Definition: Template.h:1655
Point GetCenter() const
Returns the center point that would be used for rotation.
Definition: Template.h:947
@ Ch3V05
Channel 3 value is 0.5, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:286
@ FirstBaselineLeft
Baseline left, for text, this aligns to the baseline of the first line.
Definition: Template.h:64
const Graphics::TextRenderer & GetRenderer() const
Returns the renderer for this textholder.
Definition: Template.h:1445
@ Never
Component is always disabled.
Definition: Template.h:179
@ UseWidth
Definition: Template.h:775
Event< Template > ChangedEvent
This event is fired whenever template or its components are changed.
Definition: Template.h:584
@ XMajorTick
Definition: Template.h:905
@ Ch3V1
Channel 3 value is 1, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:290
This file contains UI component template system.
PositionType
Controls where the component will be placed.
Definition: Template.h:607
@ Textholder
Definition: Template.h:163
@ State2TextIsSet
Data effect of the component is set.
Definition: Template.h:340
This class defines Margin of an object or an area.
Definition: Margin.h:22
void SetMargin(Geometry::Margin value, Dimension::Unit unit=Dimension::Pixel)
Changes the margin of the component.
Definition: Template.h:1007
virtual ComponentType GetType() const noexcept=0
Returns the type of the component.
void SetIndent(Dimension hor, Dimension ver)
Changes the indent of the component.
Definition: Template.h:1060
@ Title
Definition: Template.h:653
@ UseXW
Definition: Template.h:824
SizingMode GetVerticalSizing() const
Returns the horizontal sizing mode of the component.
Definition: Template.h:987
@ XMinorGrid
Definition: Template.h:898
@ Minor
Definition: Template.h:889
@ Icon2
Definition: Template.h:680
void SetOrientation(Graphics::Orientation value)
Changes the orientation of the template.
Definition: Template.h:1753
@ TickTag
Definition: Template.h:855
PositionType positioning
Positioning mode.
Definition: Template.h:1320
Graphics::RGBAf GetTargetColor() const
Returns the target tint color that will be used for BlendColor value modification.
Definition: Template.h:1639
@ ValueText1
Definition: Template.h:658
virtual ComponentType GetType() const noexcept override
Returns the type of the component.
Definition: Template.h:1412
@ IncrementTag
Definition: Template.h:864
void SetAdditionalSize(Geometry::Size value)
Changes the additional size of the template.
Definition: Template.h:543
@ StateIcon3IsSet
Data effect of the component is set.
Definition: Template.h:361
bool IsLeft(Anchor a)
Returns if an anchor is on the left.
Definition: Template.h:81
bool HasContent() const
If this drawable has any content.
Definition: Template.h:1509
void SetBorderSize(Geometry::Margin value)
Changes the border size of the component.
Definition: Template.h:1706
@ Max
Do not use this condition, this is to size the arrays.
Definition: Template.h:367
@ UseRGA
Definition: Template.h:832
void SetOverlayExtent(int value)
Changes the overlay extent of the component.
Definition: Template.h:1735
void SetTemplate(const Template &value)
Sets the sub template for this placeholder.
Definition: Template.h:1384
@ State3TextIsSet
Data effect of the component is set.
Definition: Template.h:343
@ Icon1
Definition: Template.h:679
Anchor
Anchor position.
Definition: Template.h:32
bool HasTemplate() const
Returns if this placeholder has a sub template.
Definition: Template.h:1390
@ Reversed
For widgets that can have reversed state.
Definition: Template.h:224
@ UseXZ
Definition: Template.h:821
@ ValueText1IsSet
Data effect of the component is set.
Definition: Template.h:325
@ UseXY
Definition: Template.h:814
VisualProvider Content
Graphical representation of the template.
Definition: Template.h:1644
@ Alone
In a list this denotes the item alone.
Definition: Template.h:242
@ UseZ
Definition: Template.h:787
void SetIndent(Dimension value)
Changes the indent of the component.
Definition: Template.h:1056
SizeMode
Size mode of the template, will be applied separately to X and Y dimensions.
Definition: Template.h:396
@ LeftTag
Definition: Template.h:866
VisualProvider Overlay
Overlay graphics, overlay will be drawn on top of the contents.
Definition: Template.h:1813
void SetCondition(ComponentCondition from, ComponentCondition to)
Sets the condition when this component will be visible. This variant will create a transition conditi...
Definition: Template.h:1245
Tag
Tags mark a component to be modified in a way meaningful to specific widgets.
Definition: Template.h:850
DataEffect
Which property will the data of the widget affect.
Definition: Template.h:646
void SetTargetColor(Graphics::RGBAf value)
Sets the target color for BlendColor value modification.
Definition: Template.h:1465
void SetCenter(Geometry::Point pos, Dimension::Unit unit=Dimension::Pixel)
Changes the center coordinate that will be used in rotation.
Definition: Template.h:938
ValueModification GetValueModification() const
Returns which property of this component will be modified by the value.
Definition: Template.h:1129
@ MinimapTag
Definition: Template.h:863
ComponentTemplate::ValueSource operator|(ComponentTemplate::ValueSource l, ComponentTemplate::ValueSource r)
Definition: Template.h:1364
@ Ch4V05
Channel 4 value is 0.5, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:298
void SetSpacing(int value)
Sets the spacing required for this template.
Definition: Template.h:571
@ State3
Third state of the widget, first state is Always.
Definition: Template.h:204
@ Cancel
This widget is the cancel widget of its container.
Definition: Template.h:308
@ Always
Component is always active.
Definition: Template.h:176
void SetPadding(Dimension left, Dimension top, Dimension right, Dimension bottom)
Changes the padding of the component. Padding is the minimum spacing inside the component.
Definition: Template.h:1682
Unit
Unit for dimensions.
Definition: Dimension.h:16
DataEffect GetDataEffect() const
Returns how the data will affect this component.
Definition: Template.h:1083
void SetMargin(int hor, int ver, Dimension::Unit unit=Dimension::Pixel)
Changes the margin of the component.
Definition: Template.h:996
@ Icon1IsSet
Data effect of the component is set.
Definition: Template.h:349
@ Ch1V05
Channel 1 value is 0.5, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:262
std::array< float, 4 > valuemin
If required, can be used to scale incoming data.
Definition: Template.h:1309
@ Readonly
Component is visible when the widget is readonly.
Definition: Template.h:187
void SetColor(Graphics::RGBAf value)
Changes the color that will override default color of the text drawn.
Definition: Template.h:1452
@ YGrid
Definition: Template.h:893
void SetPadding(int value, Dimension::Unit unit=Dimension::Pixel)
Changes the padding of the component. Padding is the minimum spacing inside the component.
Definition: Template.h:1658
void RemoveIndexAt(int index)
Removes the index at the given position.
Definition: Template.h:1777
void SetSize(Size size)
Changes the size of the component. If sizing mode is automatic, it will be set to fixed.
Definition: Template.h:961
@ Percent
Dimension will be relative to the parent and given in percent.
Definition: Dimension.h:22
@ ExpandTag
Definition: Template.h:870