 |
Gorgon Game Engine
|
Go to the documentation of this file.
6 #include "../Containers/Hashmap.h"
7 #include "../Input/Layer.h"
8 #include "../Geometry/Point3D.h"
13 namespace Gorgon {
namespace UI {
61 return conditions.count(condition);
78 return stringdata.count(effect) ? stringdata[effect] :
"";
83 return imagedata.Exists(effect) ? &imagedata[effect] :
nullptr;
98 void SetValue(
float first,
float second) {
SetValue(first, second, value[2], value[3]); }
103 void SetValue(
float first,
float second,
float third) {
SetValue(first, second, third, value[3]); }
108 void SetValue(
float first,
float second,
float third,
float fourth,
bool instant =
false);
123 std::array<float, 4>
GetValue()
const {
return returntarget ? targetvalue : value; }
137 returntarget =
false;
154 valuetotext = handler;
172 repeats[mode] = std::move(data);
173 checkrepeatupdate(mode);
188 AddRepeat(mode, first, second, third, 0);
193 repeats[mode].push_back({{first, second, third, fourth}});
194 checkrepeatupdate(mode);
221 checkrepeatupdate(mode);
228 if(repeatconditions[mode][index] != condition) {
229 repeatconditions[mode][index] = condition;
230 checkrepeatupdate(mode);
236 repeatconditions[mode].clear();
237 checkrepeatupdate(mode);
271 void Update(
bool immediate);
283 transitions.count({ComponentCondition::Disabled, ComponentCondition::Always});
352 return Between(ind, 0, indices) && stacksizes[ind];
363 taglocations[tag] = location;
368 auto f = taglocations.find(tag);
370 if(f == taglocations.end())
378 taglocations.erase(tag);
383 tagsizes[tag] = size;
388 auto f = tagsizes.find(tag);
390 if(f == tagsizes.end())
403 tagnowrap.erase(tag);
408 tagnowrap.insert(tag);
419 beforeupdate_fn = handler;
434 frame_fn = std::function<void()>();
439 beforeupdate_fn = std::function<void()>();
444 update_fn = std::function<void()>();
449 render_fn = std::function<void()>();
468 for(
auto stack : substacks) {
481 for(
auto stack : substacks) {
493 for(
auto stack : substacks) {
511 for(
auto stack : substacks) {
524 for(
auto stack : substacks) {
538 for(
auto stack : substacks) {
559 Component &get(
int ind,
int stack = -1)
const {
563 stack = stacksizes[ind]-1;
566 return data[ind + stack * indices];
586 void update(
Component &
parent,
const std::array<float, 4> &value,
int ind,
int textwidth = -1);
603 int gettextheight(
const Component &comp);
606 float calculatevalue(
int channel,
const Component &comp)
const {
return calculatevalue(value, channel, comp); }
609 float calculatevalue(
const std::array<float, 4> &data,
int channel,
const Component &comp)
const;
635 Component *data =
nullptr;
638 std::vector<int> stacksizes;
641 std::set<ComponentCondition> disabled;
644 std::set<ComponentCondition> conditions;
648 std::map<ComponentCondition, ComponentCondition> future_transitions;
651 std::map<std::pair<ComponentCondition, ComponentCondition>,
unsigned long> transitions;
654 std::map<ComponentTemplate::DataEffect, std::string> stringdata;
660 std::map<ComponentTemplate::RepeatMode, std::vector<std::array<float, 4>>> repeats;
663 std::map<ComponentTemplate::RepeatMode, std::map<int, ComponentCondition>> repeatconditions;
666 std::array<float, 4> value ={{0.f, 0.f, 0.f, 0.f}};
669 std::array<float, 4> targetvalue = {{0.f, 0.f, 0.f, 0.f}};
672 std::array<float, 4> valuespeed = {{0.f, 0.f, 0.f, 0.f}};
675 bool returntarget =
false;
678 int stackcapacity = 3;
684 bool updaterequired =
false;
687 bool handlingmouse =
false;
693 const Template &temp;
696 Containers::Hashmap<const ComponentTemplate *, ComponentStack> substacks;
698 std::map<const ComponentTemplate*, ComponentStorage*> storage;
699 std::map<const ComponentTemplate*, std::vector<Component>> repeated;
700 std::map<ComponentTemplate::Tag, Geometry::Size> tagsizes;
701 std::map<ComponentTemplate::Tag, Geometry::Point> taglocations;
702 std::set<ComponentTemplate::Tag> tagnowrap;
704 Animation::Timer controller;
706 Graphics::Layer base;
718 std::function<void()> value_fn;
719 std::function<void()> frame_fn;
720 std::function<void()> beforeupdate_fn;
721 std::function<void()> update_fn;
722 std::function<void()> render_fn;
725 Containers::Hashmap<const ComponentTemplate *, Widget> widgets;
729 LayerAdapter adapter;
@ Disabled
Component is visible when the widget is disabled.
Definition: Template.h:184
virtual void Resize(const Geometry::Size &size)
Resizes the layer to the given size.
Definition: Layer.h:337
ComponentTemplate & Get(int index) const
Returns the component at the given index.
Definition: Template.h:480
@ NoModification
Nothing will be modified.
Definition: Template.h:691
@ UseLH
Definition: Template.h:836
Orientation
2D orientation constants
Definition: Graphics.h:39
@ Automatic
Given size is not used, object is sized to its contents.
Definition: Template.h:634
This class represents boundaries of 2D objects.
Definition: Bounds.h:27
@ ValueSourceMaxPower
Maximum power of two.
Definition: Template.h:812
@ UseC
Chromacity.
Definition: Template.h:804
bool IsRight(Anchor a)
Returns if an anchor is on the right.
Definition: Template.h:95
virtual void Resize(const Geometry::Size &size)
Resizes the layer to the given size.
Definition: Layer.h:337
void swap(Event< Source_, Args_... > &l, Event< Source_, Args_... > &r)
Swaps two events.
Definition: Event.h:351
void DisableTagWrap(ComponentTemplate::Tag tag)
Disables text wrapping on a specific tag, default is enabled.
Definition: ComponentStack.h:407
@ UseSecond
Definition: Template.h:779
This class represents a color information.
Definition: Color.h:91
bool IsInside(const basic_Bounds< T_ > &b, const basic_Point< T_ > &p)
Checks whether the given point is inside this bounds.
Definition: Bounds.h:514
void AddRepeat(ComponentTemplate::RepeatMode mode, Graphics::RGBA color)
Adds a new repeating point to the given mode.
Definition: ComponentStack.h:213
This class is an instance of a component.
Definition: Component.h:15
T_ Y
Definition: Point3D.h:67
int ClickThreshold
The maximum distance allowed for mouse to move between the press of the button and the release for cl...
Definition: Config.cpp:13
Textholder is designed to hold text data.
Definition: Template.h:1422
virtual void Clear() override
Clears drawing buffer, in layer architecture this request only affects the layer itself,...
Definition: Layer.h:269
@ UseLCH
Definition: Template.h:842
void AddRepeat(ComponentTemplate::RepeatMode mode, Graphics::RGBAf color)
Adds a new repeating point to the given mode.
Definition: ComponentStack.h:208
void Move(const basic_Point< T_ > &p)
Changes the position of the bounds.
Definition: Bounds.h:212
void SetData(ComponentTemplate::DataEffect effect, const std::string &text)
Sets the data for a specific data effect.
Definition: ComponentStack.cpp:725
@ FirstBaselineRight
Baseline right, for text, this aligns to the baseline of the first line.
Definition: Template.h:67
Component stack is the backbone of a widget.
Definition: ComponentStack.h:25
@ UseTransition
This channel will give the progress of a transition.
Definition: Template.h:809
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
void Add(Layer &layer)
Adds the given layer as a child.
Definition: Layer.cpp:23
void RemoveAllConditionsOf(ComponentTemplate::RepeatMode mode)
Removes all conditions for a repeat mode.
Definition: ComponentStack.h:235
void AddRepeat(ComponentTemplate::RepeatMode mode, float first, float second, float third, float fourth)
Adds a new repeating point to the given mode.
Definition: ComponentStack.h:192
void SetMouseOverEvent(std::function< void(ComponentTemplate::Tag)> handler)
Sets the mouse over event that is fired when the mouse moves over the component stack or a substack.
Definition: ComponentStack.h:521
Geometry::Point Convert(const Point &p, const Geometry::Size &parent, int emwidth=10)
Converts a dimension based point to pixel based point.
Definition: Dimension.h:125
This class is a reference based hashmap.
Definition: Hashmap.h:35
@ 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
void SetValue(float first, float second)
Sets the value for this stack.
Definition: ComponentStack.h:98
void ReturnTransitionalValue()
Whether GetValue returns the current transitional value, this will also enable value event to be call...
Definition: ComponentStack.h:136
int ComponentAt(Geometry::Point location)
Returns the index of the component at the given location.
Definition: ComponentStack.h:339
This class stores visual information about a widget template.
Definition: Template.h:392
Layer & GetLayerOf(int ind)
Returns the layer of the given component index.
Definition: ComponentStack.cpp:1356
Marks an object that can be updated.
Definition: Types.h:142
Controllers are required to progress animations.
Definition: Animation.h:65
@ 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
T_ Z
Definition: Point3D.h:68
void SetValueTransitionSpeed(std::array< float, 4 > val)
Changes the value transition speed.
Definition: ComponentStack.h:130
@ Ch3V0
Channel 3 value is 0, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:282
void AddRepeat(ComponentTemplate::RepeatMode mode, Geometry::Point3D pos)
Adds a new repeating point to the given mode. Empty values will be set as 0.
Definition: ComponentStack.h:203
T_ X
X coordinate.
Definition: Point.h:368
void SetMouseMoveEvent(std::function< void(ComponentTemplate::Tag, Geometry::Point)> handler)
Sets the mouse mvoe event.
Definition: ComponentStack.h:503
@ UseRBA
Definition: Template.h:833
void SetValue(float first, float second, float third)
Sets the value for this stack.
Definition: ComponentStack.h:103
@ Ch4V1
Channel 4 value is 1, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:302
@ 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
T_ Width() const
Calculates and returns the width of the bounds.
Definition: Bounds.h:130
bool ComponentExists(int ind) const
Returns if a component at ind exists.
Definition: ComponentStack.h:351
ComponentCondition GetCondition() const
Returns the current component condition.
Definition: Template.h:1248
Layer * parent
Parent layer, could be nullptr.
Definition: Layer.h:504
@ UseGA
Definition: Template.h:827
@ ModifyRotation
Data affects the rotation of the component.
Definition: Template.h:725
void SetRepeat(ComponentTemplate::RepeatMode mode, std::vector< std::array< float, 4 >> data)
Sets the repeat with the given mode to the given vector.
Definition: ComponentStack.h:171
@ UseYZ
Definition: Template.h:818
@ TopLeft
Top left.
Definition: Template.h:41
bool HasCondition(ComponentCondition condition)
Returns if the given condition is in effect.
Definition: ComponentStack.h:60
@ LastBaselineLeft
Baseline left, for text, this aligns to the baseline of the last line.
Definition: Template.h:72
ComponentStack(const Template &temp, Geometry::Size size, std::map< ComponentTemplate::Tag, std::function< Widget *(const Template &)>> generators={})
Initializes a component stack with the given size.
Definition: ComponentStack.cpp:37
@ 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
bool TagHasSubStack(ComponentTemplate::Tag tag) const
Returns whether the component marked with the tag has a substack.
Definition: ComponentStack.cpp:1033
Represents a four channel 32 bit float per channel color information.
Definition: Color.h:373
@ BottomRight
Bottom right.
Definition: Template.h:60
const Template & GetTemplate() const
Returns the sub template of this placeholder.
Definition: Template.h:1397
T_ Height() const
Calculates and returns the height of the bounds.
Definition: Bounds.h:135
@ UseCH
Definition: Template.h:838
basic_Size< int > Size
Definition: Size.h:385
Geometry::Bounds TagBounds(ComponentTemplate::Tag tag)
Returns the boundaries of the component marked with the given tag.
Definition: ComponentStack.cpp:1297
@ UnknownTag
Do not use this tag for regular components, it is used to identify substacks without a tag.
Definition: Template.h:854
unsigned long DeltaTime()
Returns the time passed since the last frame.
Definition: Time.h:258
This layer allows drawing texture images on.
Definition: Layer.h:169
Defines an object according to the Box Model.
Definition: Template.h:600
@ DataEffectStart
Do not use this value.
Definition: Template.h:313
virtual void Update() override
Updates the layout of the component stack.
Definition: ComponentStack.h:268
@ ModifyWidth
Width of this component will be affected.
Definition: Template.h:739
std::array< float, 4 > GetTargetValue() const
Returns the value of the stack.
Definition: ComponentStack.h:126
void RemoveCondition(ComponentCondition condition, bool transition=true)
Removes a condition and its associated components.
Definition: ComponentStack.h:54
void RemoveData(ComponentTemplate::DataEffect effect)
Removes the data associated with data effect.
Definition: ComponentStack.cpp:759
const ComponentTemplate & GetTemplate(int ind) const
Returns the template at the given index.
Definition: ComponentStack.h:357
@ Container
Definition: Template.h:165
@ UseFirst
Definition: Template.h:773
T_ Left
Left-most boundary.
Definition: Bounds.h:399
@ Placeholder
Definition: Template.h:162
void SetValue(Geometry::Pointf pos)
Sets the value for the stack using a point in coordinate system.
Definition: ComponentStack.h:111
void AddToStack(const ComponentTemplate &temp, bool reversed)
Adds the given component to the top of the stack.
Definition: ComponentStack.cpp:182
This class is a timer that has its progression strictly controlled.
Definition: ControlledTimer.h:19
Geometry::Bounds BoundsOf(int ind)
Returns the boundaries of the component with the given index. The bounds are from the top level.
Definition: ComponentStack.cpp:1312
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
basic_Margin< int > Margin
Definition: Margin.h:289
void SetFrameEvent(std::function< void()> handler)
Sets a function to be called before update check.
Definition: ComponentStack.h:413
void AddRepeat(ComponentTemplate::RepeatMode mode, float first, float second)
Adds a new repeating point to the given mode. Empty values will be set as 0.
Definition: ComponentStack.h:182
@ UseRA
Definition: Template.h:825
Geometry::Bounds bounds
Bounds of this layer.
Definition: Layer.h:507
int GetCount() const
Returns the number of components in the template.
Definition: Template.h:474
float R
Red channel.
Definition: Color.h:588
Event< ComponentStack > ConditionChanged
Definition: ComponentStack.h:552
bool Between(T_ v, T_ min, T_ max)
Returns if the given number is within the given range including min but excluding max.
Definition: Types.h:108
std::string GetTextData(ComponentTemplate::DataEffect effect)
Returns the text data. If data is not set, this will return empty string.
Definition: ComponentStack.h:77
bool IsBottom(Anchor a)
Returns if the given anchor is at bottom.
Definition: Template.h:135
This class stores component related data.
Definition: Component.h:50
@ UseBA
Definition: Template.h:826
void ReturnTargetValue()
Whether GetValue returns the target value. This is the default mode.
Definition: ComponentStack.h:141
void AddRepeat(ComponentTemplate::RepeatMode mode, float first)
Adds a new repeating point to the given mode. Empty values will be set as 0.
Definition: ComponentStack.h:177
void SetOtherMouseEvent(std::function< bool(ComponentTemplate::Tag, Input::Mouse::EventType, Geometry::Point, float)> handler)
Sets the handler for scroll (HScroll or VScroll), zoom and rotate events.
Definition: ComponentStack.cpp:1531
@ UseGrayAlpha
Definition: Template.h:840
@ TopRight
Top right.
Definition: Template.h:45
void SetValue(Graphics::RGBAf color)
Sets the value for the stack using a color.
Definition: ComponentStack.h:117
@ UseThird
Definition: Template.h:786
#define ASSERT(expression, message,...)
Replaces regular assert to allow messages and backtrace.
Definition: Assert.h:161
std::array< float, 4 > CoordinateToValue(ComponentTemplate::Tag tag, Geometry::Point location, bool relative=false)
Translates the given coordinates back to values using value scaling and channel mapping.
Definition: ComponentStack.cpp:1042
virtual void Resize(const Geometry::Size &value) override
Notifies the stack about a size change.
Definition: ComponentStack.h:245
void RemoveBeforeUpdateEvent()
Removes the function that will be called before every update.
Definition: ComponentStack.h:438
void SetValue(float first)
Sets the value for this stack.
Definition: ComponentStack.h:93
@ BottomLeft
Bottom left.
Definition: Template.h:56
bool IsTop(Anchor a)
Returns if the given anchor is at top.
Definition: Template.h:121
basic_Point< int > Point
Definition: Point.h:598
@ ModifyAnimation
Data will affect the progress of the animation.
Definition: Template.h:729
bool reversed
Definition: Component.h:39
@ AutoStart
Definition: Template.h:674
Graphics::Orientation GetOrientation() const
Returns the current orientation of the container.
Definition: Template.h:1756
@ LastBaselineRight
Baseline right, for text, this aligns to the baseline of the last line.
Definition: Template.h:77
float G
Green channel.
Definition: Color.h:591
@ UseH
Hue.
Definition: Template.h:801
std::array< float, 4 > GetValue() const
Returns the value of the stack.
Definition: ComponentStack.h:123
const Graphics::Drawable * GetImageData(ComponentTemplate::DataEffect effect)
Returns the image data. If data is not set, this will return nullptr.
Definition: ComponentStack.h:82
T_ X
Definition: Point3D.h:66
bool IsIn(Anchor left, Anchor right)
Definition: ComponentStack.cpp:27
@ UseGBA
Definition: Template.h:834
int IndexOfTag(ComponentTemplate::Tag tag)
Returns the index of the component with the specified tag.
Definition: ComponentStack.cpp:1437
@ AutoEnd
Definition: Template.h:675
virtual void Render()
Renders the current layer, default handling is to pass the request to the sub-layers....
Definition: Layer.cpp:51
void ReplaceCondition(ComponentCondition from, ComponentCondition to, bool transition=true)
Replaces a condition with another one.
Definition: ComponentStack.cpp:574
ValueSource
Which data channels should be used as the value, common combinations are listed, however,...
Definition: Template.h:772
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
@ UseXYZ
Definition: Template.h:829
@ BottomCenter
Bottom center.
Definition: Template.h:58
@ ModifyPositionAndSize
This is a combined modification of position and size.
Definition: Template.h:751
@ UseRGBA
Definition: Template.h:845
int calculatemargin(int l, int r)
Definition: ComponentStack.cpp:2184
basic_Point< Float > Pointf
Definition: Point.h:601
void Render() override
Renders the current layer, default handling is to pass the request to the sub-layers....
Definition: ComponentStack.cpp:883
@ UseLC
Definition: Template.h:837
void SetValueEvent(std::function< void()> handler)
Sets the function that will be called whenever the value is changed.
Definition: ComponentStack.h:146
@ Ch2V1
Channel 2 value is 1, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:278
Float Distance(const basic_Point &target) const
Calculates Euclidean distance from this point to the given target.
Definition: Point.h:276
virtual int GetEMSize() const =0
Returns the size of the EM dash.
void RemoveFrameEvent()
Removes the function that will be called before update check.
Definition: ComponentStack.h:433
This class is the base class for all layer types.
Definition: Layer.h:79
@ 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
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
@ NoRepeat
Definition: Template.h:887
@ ModifyHeight
Height of this component will be affected.
Definition: Template.h:744
void SetValue(Geometry::Point3D pos)
Sets the value for the stack using a point in coordinate system.
Definition: ComponentStack.h:114
@ BasisPoint
Dimension will be relative to the parent and given in 1/10000.
Definition: Dimension.h:29
void AddCondition(ComponentCondition condition, bool transition=true)
Adds a condition and its associated components to the stack.
Definition: ComponentStack.h:48
@ ModifySize
Size of this component will be affected.
Definition: Template.h:734
bool IsMiddle(Anchor a)
Returns if the given anchor is at middle vertically.
Definition: Template.h:149
void RemoveUpdateEvent()
Removes the function that will be called after every update before rendering.
Definition: ComponentStack.h:443
@ UseL
Lightness.
Definition: Template.h:798
ComponentCondition
Controls the condition when the components are visible.
Definition: Template.h:174
@ UseLCHA
Definition: Template.h:843
bool GetClip() const
Returns whether currently clipping the contents.
Definition: Template.h:1272
void SetClickEvent(std::function< void(ComponentTemplate::Tag, Geometry::Point, Input::Mouse::Button)> handler)
Sets the mouse down event.
Definition: ComponentStack.h:490
Widget * GetWidget(ComponentTemplate::Tag tag)
Returns the widget associated with the tag.
Definition: ComponentStack.cpp:3610
int GetIndex() const
Returns the component index.
Definition: Template.h:1235
float B
Blue channel.
Definition: Color.h:594
int Sign(T_ val)
Definition: Types.h:126
void SetValue(Graphics::RGBA color)
Sets the value for the stack using a color.
Definition: ComponentStack.h:120
bool IsMouseRelated(ComponentCondition condition)
Returns if the given condition is related to mouse events.
Definition: Template.h:371
@ MiddleRight
Middle right.
Definition: Template.h:53
Geometry::Point location
Definition: Component.h:24
ComponentStack(const Template &temp)
Initiates a component stack with default size.
Definition: ComponentStack.h:34
virtual void Reset() override
Resets the timer, basically starting the animation from the start.
Definition: Animation.h:135
void SetMouseOutEvent(std::function< void(ComponentTemplate::Tag)> handler)
Sets the mouse out event that is fired when the mouse moves over the component stack or a substack.
Definition: ComponentStack.h:535
void EnableTagWrap(ComponentTemplate::Tag tag)
Enables text wrapping on a specific tag, default is enabled.
Definition: ComponentStack.h:402
T_ Right
Right-most boundary.
Definition: Bounds.h:405
bool IsCenter(Anchor a)
Returns if an anchor is centered horizontally.
Definition: Template.h:109
Geometry::Pointf TransformCoordinates(ComponentTemplate::Tag tag, Geometry::Point location)
Translates the given coordinates to component space from 0 to 1.
Definition: ComponentStack.cpp:1422
@ 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
void RemoveRepeats(ComponentTemplate::RepeatMode mode)
Removes all repeat points from the given mode.
Definition: ComponentStack.h:219
@ ShrinkOnly
Given size is the maximum, if the contents are smaller, the object be resized.
Definition: Template.h:642
@ NoTag
Definition: Template.h:851
void RemoveTagSize(ComponentTemplate::Tag tag)
Removes the fixed size for a set tagged component.
Definition: ComponentStack.h:397
Geometry::Point GetTagLocation(ComponentTemplate::Tag tag) const
Definition: ComponentStack.h:367
Geometry::Size GetTagSize(ComponentTemplate::Tag tag) const
Definition: ComponentStack.h:387
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
void ResetAnimation()
Definition: ComponentStack.h:275
@ UseFourth
Definition: Template.h:790
T_ Bottom
Bottom-most boundary.
Definition: Bounds.h:408
const ComponentTemplate & GetTemplate() const
Returns the template, component should have a template at all times.
Definition: Component.h:20
void SetRenderEvent(std::function< void()> handler)
Sets a function to be called after every render.
Definition: ComponentStack.h:428
@ AbsoluteSliding
Absolute positioning, coordinates will start from the container, percent based movement will move to ...
Definition: Template.h:615
void SetConditionOf(ComponentTemplate::RepeatMode mode, int index, ComponentCondition condition)
Sets the condition of a specific repeat index.
Definition: ComponentStack.h:227
@ 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
void AddRepeat(ComponentTemplate::RepeatMode mode, float first, float second, float third)
Adds a new repeating point to the given mode. Empty values will be set as 0.
Definition: ComponentStack.h:187
basic_Point< T_ > TopLeft() const
Returns top left corner.
Definition: Bounds.h:105
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
@ Ignored
Definition: Template.h:166
void RemoveRenderEvent()
Removes the function that will be called after every render.
Definition: ComponentStack.h:448
basic_Size< T_ > GetSize() const
Returns the size of the bounds object.
Definition: Bounds.h:141
Container class that defines an area according to the Box Model.
Definition: Template.h:1655
@ 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
void RemoveTagLocation(ComponentTemplate::Tag tag)
Removes the fixed location for a set tagged component.
Definition: ComponentStack.h:377
int parent
Definition: Component.h:41
std::string Concat(const P_ &... rest)
Streams the given parameters into a stringstream and returns the result, effectively concatinating al...
Definition: String.h:560
void AddRepeat(ComponentTemplate::RepeatMode mode, Geometry::Pointf pos)
Adds a new repeating point to the given mode. Empty values will be set as 0.
Definition: ComponentStack.h:198
@ 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.
@ Textholder
Definition: Template.h:163
This class defines Margin of an object or an area.
Definition: Margin.h:22
virtual ComponentType GetType() const noexcept=0
Returns the type of the component.
virtual ~ComponentStack()
Destructor.
Definition: ComponentStack.cpp:169
const Template & GetTemplate() const
Returns the template used by this stack.
Definition: ComponentStack.h:256
Geometry::Point TranslateCoordinates(ComponentTemplate::Tag tag, Geometry::Point location)
Translates the given coordinates to component space in pixels.
Definition: ComponentStack.cpp:1387
float A
Alpha channel.
Definition: Color.h:597
bool IsLeft(Anchor a)
Returns if an anchor is on the left.
Definition: Template.h:81
@ UseRGA
Definition: Template.h:832
void SetTagLocation(ComponentTemplate::Tag tag, Geometry::Point location)
Set a fixed location for a tagged component.
Definition: ComponentStack.h:362
unsigned long FrameStart()
Returns start time of the current frame in milliseconds.
Definition: Time.h:252
Anchor
Anchor position.
Definition: Template.h:32
void SetEMSize(int value)
Changes the default emsize of 10. This value can be overridden.
Definition: ComponentStack.h:287
void HandleMouse(Input::Mouse::Button accepted=Input::Mouse::Button::All)
This function instructs stack to handle mouse to automatically change hover/down states,...
Definition: ComponentStack.cpp:1023
void SetBeforeUpdateEvent(std::function< void()> handler)
Sets a function to be called before every update.
Definition: ComponentStack.h:418
void SetMouseDownEvent(std::function< void(ComponentTemplate::Tag, Geometry::Point, Input::Mouse::Button)> handler)
Sets the mouse down event.
Definition: ComponentStack.h:465
@ UseXZ
Definition: Template.h:821
@ UseXY
Definition: Template.h:814
void SetTagSize(ComponentTemplate::Tag tag, Geometry::Size size)
Set a fixed size for a tagged component.
Definition: ComponentStack.h:382
void FinalizeTransitions()
Finalizes on-going transitions immediately.
Definition: ComponentStack.cpp:666
bool IsDisabled() const
Returns if this component stack is disabled. Both disabling and enabling animations are counted as di...
Definition: ComponentStack.h:280
void SetUpdateEvent(std::function< void()> handler)
Sets a function to be called after every update before rendering.
Definition: ComponentStack.h:423
int NumberOfSetBits(uint32_t i)
Returns the number of bits that are 1 in a number.
Definition: Types.h:70
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
ValueModification GetValueModification() const
Returns which property of this component will be modified by the value.
Definition: Template.h:1129
Geometry::Size size
Definition: Component.h:26
@ Ch4V05
Channel 4 value is 0.5, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:298
@ Always
Component is always active.
Definition: Template.h:176
DataEffect GetDataEffect() const
Returns how the data will affect this component.
Definition: Template.h:1083
T_ Top
Top-most boundary.
Definition: Bounds.h:402
void SetValueToText(std::function< std::string(int, ComponentTemplate::DataEffect, const std::array< float, 4 > &)> handler)
Sets the function that will be used to convert a value to a string.
Definition: ComponentStack.h:153
bool HasLayer(int ind) const
Returns if the component at the given index has a layer.
Definition: ComponentStack.cpp:1344
@ Ch1V05
Channel 1 value is 0.5, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:262
Geometry::Size GetSize() const
Returns the size of the layer.
Definition: Layer.h:362
Geometry::Rectangle range
Definition: Component.h:32
void SetMouseUpEvent(std::function< void(ComponentTemplate::Tag, Geometry::Point, Input::Mouse::Button)> handler)
Sets the mouse up event.
Definition: ComponentStack.h:478