Gorgon Game Engine
ComponentStack.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Template.h"
4 #include "Component.h"
5 #include "LayerAdapter.h"
6 #include "../Containers/Hashmap.h"
7 #include "../Input/Layer.h"
8 #include "../Geometry/Point3D.h"
9 
10 #include <set>
11 #include <vector>
12 
13 namespace Gorgon { namespace UI {
14 
15  class Widget;
16 
25  class ComponentStack : public Layer, public Updatable {
26  public:
27 
31  ComponentStack(const Template &temp, Geometry::Size size, std::map<ComponentTemplate::Tag, std::function<Widget *(const Template &)>> generators = {});
32 
34  explicit ComponentStack(const Template &temp) : ComponentStack(temp, temp.GetSize())
35  { }
36 
38  virtual ~ComponentStack();
39 
42  void AddToStack(const ComponentTemplate &temp, bool reversed);
43 
45  void ReplaceCondition(ComponentCondition from, ComponentCondition to, bool transition = true);
46 
48  void AddCondition(ComponentCondition condition, bool transition = true) {
49  //redirect to replace condition
50  ReplaceCondition(ComponentCondition::Always, condition, transition);
51  }
52 
54  void RemoveCondition(ComponentCondition condition, bool transition = true) {
55  //redirect to replace condition
56  ReplaceCondition(condition, ComponentCondition::Always, transition);
57  }
58 
60  bool HasCondition(ComponentCondition condition) {
61  return conditions.count(condition);
62  }
63 
65  void FinalizeTransitions();
66 
69  void SetData(ComponentTemplate::DataEffect effect, const std::string &text);
70 
74  void SetData(ComponentTemplate::DataEffect effect, const Graphics::Drawable &image);
75 
78  return stringdata.count(effect) ? stringdata[effect] : "";
79  }
80 
83  return imagedata.Exists(effect) ? &imagedata[effect] : nullptr;
84  }
85 
89 
93  void SetValue(float first) { SetValue(first, value[1], value[2], value[3]); }
94 
98  void SetValue(float first, float second) { SetValue(first, second, value[2], value[3]); }
99 
103  void SetValue(float first, float second, float third) { SetValue(first, second, third, value[3]); }
104 
108  void SetValue(float first, float second, float third, float fourth, bool instant = false);
109 
111  void SetValue(Geometry::Pointf pos) { SetValue(pos.X, pos.Y); }
112 
114  void SetValue(Geometry::Point3D pos) { SetValue(pos.X, pos.Y, pos.Z); }
115 
117  void SetValue(Graphics::RGBAf color) { SetValue(color.R, color.G, color.B, color.A); }
118 
121 
123  std::array<float, 4> GetValue() const { return returntarget ? targetvalue : value; }
124 
126  std::array<float, 4> GetTargetValue() const { return targetvalue; }
127 
130  void SetValueTransitionSpeed(std::array<float, 4> val) {
131  valuespeed = val;
132  }
133 
137  returntarget = false;
138  }
139 
142  returntarget = true;
143  }
144 
146  void SetValueEvent(std::function<void()> handler) {
147  value_fn = handler;
148  }
149 
150 
153  void SetValueToText(std::function<std::string(int, ComponentTemplate::DataEffect, const std::array<float, 4> &)> handler) {
154  valuetotext = handler;
155  }
156 
169  void SetRepeat(ComponentTemplate::RepeatMode mode, std::vector<std::array<float, 4>> data) {
172  repeats[mode] = std::move(data);
173  checkrepeatupdate(mode);
174  }
175 
177  void AddRepeat(ComponentTemplate::RepeatMode mode, float first) {
178  AddRepeat(mode, first, 0, 0, 0);
179  }
180 
182  void AddRepeat(ComponentTemplate::RepeatMode mode, float first, float second) {
183  AddRepeat(mode, first, second, 0, 0);
184  }
185 
187  void AddRepeat(ComponentTemplate::RepeatMode mode, float first, float second, float third) {
188  AddRepeat(mode, first, second, third, 0);
189  }
190 
192  void AddRepeat(ComponentTemplate::RepeatMode mode, float first, float second, float third, float fourth) {
193  repeats[mode].push_back({{first, second, third, fourth}});
194  checkrepeatupdate(mode);
195  }
196 
199  AddRepeat(mode, pos.X, pos.Y, 0, 0);
200  }
201 
204  AddRepeat(mode, pos.X, pos.Y, pos.Z, 0);
205  }
206 
209  AddRepeat(mode, color.R, color.G, color.B, color.A);
210  }
211 
214  AddRepeat(mode, (Graphics::RGBAf)color);
215  }
216 
220  repeats.erase(mode);
221  checkrepeatupdate(mode);
222  }
223 
228  if(repeatconditions[mode][index] != condition) {
229  repeatconditions[mode][index] = condition;
230  checkrepeatupdate(mode);
231  }
232  }
233 
236  repeatconditions[mode].clear();
237  checkrepeatupdate(mode);
238  }
239 
241 
242  using Layer::Resize;
243 
245  virtual void Resize(const Geometry::Size &value) override {
246  Layer::Resize(value);
247  mouse.Resize(value);
248 
249  if(size != value) {
250  size = value;
251  Update();
252  }
253  }
254 
256  const Template &GetTemplate() const {
257  return temp;
258  }
259 
262 
266 
268  virtual void Update() override { Update(false); }
269 
271  void Update(bool immediate);
272 
273  void Render() override;
274 
275  void ResetAnimation() {
276  controller.Reset();
277  }
278 
280  bool IsDisabled() const {
281  return conditions.count(ComponentCondition::Disabled) ||
283  transitions.count({ComponentCondition::Disabled, ComponentCondition::Always});
284  }
285 
287  void SetEMSize(int value) {
288  emsize = value;
289  }
290 
294 
298  bool TagHasSubStack(ComponentTemplate::Tag tag) const;
299 
305  std::array<float, 4> CoordinateToValue(ComponentTemplate::Tag tag, Geometry::Point location, bool relative = false);
306 
309 
312 
315 
318 
322 
326 
328  bool HasLayer(int ind) const;
329 
333  Layer &GetLayerOf(int ind);
334 
336  Geometry::Bounds BoundsOf(int ind);
337 
339  int ComponentAt(Geometry::Point location) {
341 
342  return ComponentAt(location, b);
343  }
344 
348 
351  bool ComponentExists(int ind) const {
352  return Between(ind, 0, indices) && stacksizes[ind];
353  }
354 
357  const ComponentTemplate &GetTemplate(int ind) const {
358  return get(ind).GetTemplate();
359  }
360 
363  taglocations[tag] = location;
364  Update();
365  }
366 
368  auto f = taglocations.find(tag);
369 
370  if(f == taglocations.end())
371  return {0, 0};
372  else
373  return f->second;
374  }
375 
378  taglocations.erase(tag);
379  }
380 
383  tagsizes[tag] = size;
384  Update();
385  }
386 
388  auto f = tagsizes.find(tag);
389 
390  if(f == tagsizes.end())
391  return {0, 0};
392  else
393  return f->second;
394  }
395 
398  tagsizes.erase(tag);
399  }
400 
403  tagnowrap.erase(tag);
404  }
405 
408  tagnowrap.insert(tag);
409  }
410 
411 
413  void SetFrameEvent(std::function<void()> handler) {
414  frame_fn = handler;
415  }
416 
418  void SetBeforeUpdateEvent(std::function<void()> handler) {
419  beforeupdate_fn = handler;
420  }
421 
423  void SetUpdateEvent(std::function<void()> handler) {
424  update_fn = handler;
425  }
426 
428  void SetRenderEvent(std::function<void()> handler) {
429  render_fn = handler;
430  }
431 
434  frame_fn = std::function<void()>();
435  }
436 
439  beforeupdate_fn = std::function<void()>();
440  }
441 
444  update_fn = std::function<void()>();
445  }
446 
449  render_fn = std::function<void()>();
450  }
451 
466  down_fn = handler;
467 
468  for(auto stack : substacks) {
469  stack.second.SetMouseDownEvent([stack, this](ComponentTemplate::Tag tag, Geometry::Point point, Input::Mouse::Button btn) {
470  down_fn(stack.first->GetTag() == ComponentTemplate::NoTag ? ComponentTemplate::UnknownTag : stack.first->GetTag(), point, btn);
471  });
472  }
473  }
474 
479  up_fn = handler;
480 
481  for(auto stack : substacks) {
482  stack.second.SetMouseUpEvent([stack, this](ComponentTemplate::Tag tag, Geometry::Point point, Input::Mouse::Button btn) {
483  up_fn(stack.first->GetTag() == ComponentTemplate::NoTag ? ComponentTemplate::UnknownTag : stack.first->GetTag(), point, btn);
484  });
485  }
486  }
487 
491  click_fn = handler;
492 
493  for(auto stack : substacks) {
494  stack.second.SetClickEvent([stack, this](ComponentTemplate::Tag tag, Geometry::Point point, Input::Mouse::Button btn) {
495  click_fn(stack.first->GetTag() == ComponentTemplate::NoTag ? ComponentTemplate::UnknownTag : stack.first->GetTag(), point, btn);
496  });
497  }
498  }
499 
503  void SetMouseMoveEvent(std::function<void(ComponentTemplate::Tag, Geometry::Point)> handler) {
504  move_fn = handler;
505 
506  mouse.SetMove([this] (Geometry::Point location){
507  if(move_fn)
508  move_fn(ComponentTemplate::NoTag, location);
509  });
510 
511  for(auto stack : substacks) {
512  stack.second.SetMouseMoveEvent([stack, this](ComponentTemplate::Tag tag, Geometry::Point point) {
513  move_fn(stack.first->GetTag() == ComponentTemplate::NoTag ? ComponentTemplate::UnknownTag : stack.first->GetTag(), point);
514  });
515  }
516  }
517 
521  void SetMouseOverEvent(std::function<void(ComponentTemplate::Tag)> handler) {
522  over_fn = handler;
523 
524  for(auto stack : substacks) {
525  stack.second.SetMouseOverEvent([stack, this](ComponentTemplate::Tag tag) {
526  over_fn(stack.first->GetTag() == ComponentTemplate::NoTag ? ComponentTemplate::UnknownTag : stack.first->GetTag());
527  });
528  }
529  }
530 
535  void SetMouseOutEvent(std::function<void(ComponentTemplate::Tag)> handler) {
536  out_fn = handler;
537 
538  for(auto stack : substacks) {
539  stack.second.SetMouseOutEvent([stack, this](ComponentTemplate::Tag tag) {
540  out_fn(stack.first->GetTag() == ComponentTemplate::NoTag ? ComponentTemplate::UnknownTag : stack.first->GetTag());
541  });
542  }
543  }
544 
547  void SetOtherMouseEvent(std::function<bool(ComponentTemplate::Tag, Input::Mouse::EventType, Geometry::Point, float)> handler);
548 
549 
551 
553 
554 
555  private:
559  Component &get(int ind, int stack = -1) const {
560  ASSERT(stacksizes[ind], String::Concat("Stack for index ", ind, " is empty"));
561 
562  if(stack == -1) {
563  stack = stacksizes[ind]-1;
564  }
565 
566  return data[ind + stack * indices];
567  }
568 
570  Component &get(int ind, ComponentCondition condition) const;
571 
574  void anchortoparent(Component &parent, Component &comp, const ComponentTemplate &temp,
575  Geometry::Point offset, Geometry::Margin margin, Geometry::Size maxsize);
576 
577 
579  void anchortoother(Component &comp, const ComponentTemplate &temp,
580  Geometry::Point offset, Geometry::Margin margin, Component &other, Graphics::Orientation orientation);
581 
583  void update();
584 
586  void update(Component &parent, const std::array<float, 4> &value, int ind, int textwidth = -1);
587 
591  void render(Component &component, Graphics::Layer &parentlayer, Geometry::Point offset, const std::array<float, 4> &value, Graphics::RGBAf color = 1.f, int ind = -1);
592 
594  void grow();
595 
597  int getemsize(const Component &comp);
598 
600  int getbaseline(const Component &comp);
601 
603  int gettextheight(const Component &comp);
604 
606  float calculatevalue(int channel, const Component &comp) const { return calculatevalue(value, channel, comp); }
607 
609  float calculatevalue(const std::array<float, 4> &data, int channel, const Component &comp) const;
610 
612  void checkrepeatupdate(ComponentTemplate::RepeatMode mode);
613 
617 
620  bool removecondition(ComponentCondition from, ComponentCondition to);
621 
623  Component *gettag(ComponentTemplate::Tag tag) const;
624 
626  int emsize = 0;
627 
629  int baseline = 0;
630 
632  int textheight = 0;
633 
635  Component *data = nullptr;
636 
638  std::vector<int> stacksizes;
639 
641  std::set<ComponentCondition> disabled;
642 
644  std::set<ComponentCondition> conditions;
645 
648  std::map<ComponentCondition, ComponentCondition> future_transitions;
649 
651  std::map<std::pair<ComponentCondition, ComponentCondition>, unsigned long> transitions;
652 
654  std::map<ComponentTemplate::DataEffect, std::string> stringdata;
655 
658 
660  std::map<ComponentTemplate::RepeatMode, std::vector<std::array<float, 4>>> repeats;
661 
663  std::map<ComponentTemplate::RepeatMode, std::map<int, ComponentCondition>> repeatconditions;
664 
666  std::array<float, 4> value ={{0.f, 0.f, 0.f, 0.f}};
667 
669  std::array<float, 4> targetvalue = {{0.f, 0.f, 0.f, 0.f}};
670 
672  std::array<float, 4> valuespeed = {{0.f, 0.f, 0.f, 0.f}};
673 
675  bool returntarget = false;
676 
678  int stackcapacity = 3;
679 
681  int indices = 0;
682 
684  bool updaterequired = false;
685 
687  bool handlingmouse = false;
688 
690  Geometry::Size size;
691 
693  const Template &temp;
694 
696  Containers::Hashmap<const ComponentTemplate *, ComponentStack> substacks;
697 
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;
703 
704  Animation::Timer controller;
705 
706  Graphics::Layer base;
707  Input::Layer mouse;
708  Input::Mouse::Button mousebuttonaccepted;
709  Geometry::Point downlocation;
710 
711  std::function<void(ComponentTemplate::Tag, Geometry::Point, Input::Mouse::Button)> down_fn;
712  std::function<void(ComponentTemplate::Tag, Geometry::Point, Input::Mouse::Button)> click_fn;
713  std::function<void(ComponentTemplate::Tag, Geometry::Point, Input::Mouse::Button)> up_fn;
714  std::function<void(ComponentTemplate::Tag, Geometry::Point)> move_fn;
715  std::function<void(ComponentTemplate::Tag)> over_fn;
716  std::function<void(ComponentTemplate::Tag)> out_fn;
717  std::function<bool(ComponentTemplate::Tag, Input::Mouse::EventType, Geometry::Point, float)> other_fn; //scroll, zoom, rotate
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;
723 
724  std::map<ComponentTemplate::Tag, std::function<Widget *(const Template &)>> widgetgenerators;
725  Containers::Hashmap<const ComponentTemplate *, Widget> widgets;
726 
727  std::function<std::string(int ind, ComponentTemplate::DataEffect, const std::array<float, 4> &value)> valuetotext;
728 
729  LayerAdapter adapter;
730  };
731 
732 }}
Gorgon::UI::Disabled
@ Disabled
Component is visible when the widget is disabled.
Definition: Template.h:184
Gorgon::Layer::Resize
virtual void Resize(const Geometry::Size &size)
Resizes the layer to the given size.
Definition: Layer.h:337
Gorgon::UI::Template::Get
ComponentTemplate & Get(int index) const
Returns the component at the given index.
Definition: Template.h:480
Gorgon::Input::Layer::SetMove
void SetMove(std::function< void(Layer &, Geometry::Point)> fn)
Sets mouse move handler.
Definition: Layer.h:620
Gorgon::UI::ComponentTemplate::NoModification
@ NoModification
Nothing will be modified.
Definition: Template.h:691
Gorgon::UI::ComponentTemplate::UseLH
@ UseLH
Definition: Template.h:836
Gorgon::Graphics::Orientation
Orientation
2D orientation constants
Definition: Graphics.h:39
Gorgon::UI::ComponentTemplate::Automatic
@ Automatic
Given size is not used, object is sized to its contents.
Definition: Template.h:634
Gorgon::Geometry::basic_Bounds
This class represents boundaries of 2D objects.
Definition: Bounds.h:27
Gorgon::UI::ComponentTemplate::ValueSourceMaxPower
@ ValueSourceMaxPower
Maximum power of two.
Definition: Template.h:812
Gorgon::UI::ComponentTemplate::UseC
@ UseC
Chromacity.
Definition: Template.h:804
Gorgon::Input::Mouse::None
@ None
Definition: Mouse.h:32
Gorgon::UI::IsRight
bool IsRight(Anchor a)
Returns if an anchor is on the right.
Definition: Template.h:95
Gorgon::UI::ComponentStack::Resize
virtual void Resize(const Geometry::Size &size)
Resizes the layer to the given size.
Definition: Layer.h:337
Gorgon::swap
void swap(Event< Source_, Args_... > &l, Event< Source_, Args_... > &r)
Swaps two events.
Definition: Event.h:351
Gorgon::UI::ComponentStack::DisableTagWrap
void DisableTagWrap(ComponentTemplate::Tag tag)
Disables text wrapping on a specific tag, default is enabled.
Definition: ComponentStack.h:407
Gorgon::UI::WidgetContainer::Add
bool Add(Widget &widget)
Adds the given widget to this container.
Definition: WidgetContainer.cpp:5
Widget.h
Gorgon::UI::ComponentTemplate::UseSecond
@ UseSecond
Definition: Template.h:779
Gorgon::Graphics::RGBA
This class represents a color information.
Definition: Color.h:91
Gorgon::Input::Mouse::Rotate
@ Rotate
Definition: Mouse.h:27
Gorgon::Geometry::IsInside
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
Gorgon::UI::ComponentStack::AddRepeat
void AddRepeat(ComponentTemplate::RepeatMode mode, Graphics::RGBA color)
Adds a new repeating point to the given mode.
Definition: ComponentStack.h:213
Gorgon::UI::Component
This class is an instance of a component.
Definition: Component.h:15
Gorgon::Geometry::basic_Point3D::Y
T_ Y
Definition: Point3D.h:67
Gorgon::WindowManager::ClickThreshold
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
Gorgon::UI::TextholderTemplate
Textholder is designed to hold text data.
Definition: Template.h:1422
Gorgon::Graphics::Layer::Clear
virtual void Clear() override
Clears drawing buffer, in layer architecture this request only affects the layer itself,...
Definition: Layer.h:269
Gorgon::UI::ComponentTemplate::UseLCH
@ UseLCH
Definition: Template.h:842
Gorgon::UI::ComponentStack::AddRepeat
void AddRepeat(ComponentTemplate::RepeatMode mode, Graphics::RGBAf color)
Adds a new repeating point to the given mode.
Definition: ComponentStack.h:208
Gorgon::Input::Layer::SetRotate
void SetRotate(std::function< bool(Layer &, Geometry::Point, float)> fn)
Sets rotate handler.
Definition: Layer.h:966
Gorgon::Geometry::basic_Bounds::Move
void Move(const basic_Point< T_ > &p)
Changes the position of the bounds.
Definition: Bounds.h:212
Gorgon::UI::ComponentStack::SetData
void SetData(ComponentTemplate::DataEffect effect, const std::string &text)
Sets the data for a specific data effect.
Definition: ComponentStack.cpp:725
Gorgon::UI::FirstBaselineRight
@ FirstBaselineRight
Baseline right, for text, this aligns to the baseline of the first line.
Definition: Template.h:67
Gorgon::Input::Mouse::Scroll_Hor
@ Scroll_Hor
Definition: Mouse.h:25
Gorgon::UI::ComponentStack
Component stack is the backbone of a widget.
Definition: ComponentStack.h:25
Gorgon::UI::ComponentTemplate::UseTransition
@ UseTransition
This channel will give the progress of a transition.
Definition: Template.h:809
Gorgon::UI::PlaceholderTemplate
Defines a placeholder according to the Box Model.
Definition: Template.h:1370
Gorgon::UI::Ch2V0
@ Ch2V0
Channel 2 value is 0, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:270
Gorgon::Event
This class provides event mechanism.
Definition: Event.h:134
Gorgon::Layer::Add
void Add(Layer &layer)
Adds the given layer as a child.
Definition: Layer.cpp:23
ComponentStack.h
Gorgon::UI::ComponentStack::RemoveAllConditionsOf
void RemoveAllConditionsOf(ComponentTemplate::RepeatMode mode)
Removes all conditions for a repeat mode.
Definition: ComponentStack.h:235
Gorgon::UI::ComponentStack::AddRepeat
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
Gorgon::UI::ComponentStack::SetMouseOverEvent
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
Gorgon::UI::Convert
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
Gorgon::Containers::Hashmap
This class is a reference based hashmap.
Definition: Hashmap.h:35
Gorgon::UI::Ch2V05
@ Ch2V05
Channel 2 value is 0.5, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:274
Gorgon::UI::MiddleLeft
@ MiddleLeft
Middle left.
Definition: Template.h:48
Gorgon::UI::ComponentStack::SetValue
void SetValue(float first, float second)
Sets the value for this stack.
Definition: ComponentStack.h:98
Gorgon::UI::ComponentStack::ReturnTransitionalValue
void ReturnTransitionalValue()
Whether GetValue returns the current transitional value, this will also enable value event to be call...
Definition: ComponentStack.h:136
Gorgon::UI::ComponentStack::ComponentAt
int ComponentAt(Geometry::Point location)
Returns the index of the component at the given location.
Definition: ComponentStack.h:339
Gorgon::UI::Template
This class stores visual information about a widget template.
Definition: Template.h:392
Gorgon::UI::ComponentStack::GetLayerOf
Layer & GetLayerOf(int ind)
Returns the layer of the given component index.
Definition: ComponentStack.cpp:1356
Gorgon::Updatable
Marks an object that can be updated.
Definition: Types.h:142
Gorgon::Animation::ControllerBase
Controllers are required to progress animations.
Definition: Animation.h:65
Gorgon::UI::TopCenter
@ TopCenter
Top center.
Definition: Template.h:43
Gorgon::UI::Ch4V0
@ Ch4V0
Channel 4 value is 0, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:294
Gorgon::Geometry::basic_Point3D::Z
T_ Z
Definition: Point3D.h:68
Gorgon::UI::ComponentStack::SetValueTransitionSpeed
void SetValueTransitionSpeed(std::array< float, 4 > val)
Changes the value transition speed.
Definition: ComponentStack.h:130
Gorgon::UI::Ch3V0
@ Ch3V0
Channel 3 value is 0, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:282
Gorgon::UI::ComponentStack::AddRepeat
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
Gorgon::Geometry::basic_Point::X
T_ X
X coordinate.
Definition: Point.h:368
Gorgon::UI::ComponentStack::SetMouseMoveEvent
void SetMouseMoveEvent(std::function< void(ComponentTemplate::Tag, Geometry::Point)> handler)
Sets the mouse mvoe event.
Definition: ComponentStack.h:503
Gorgon::UI::ComponentTemplate::UseRBA
@ UseRBA
Definition: Template.h:833
Gorgon::UI::ComponentStack::SetValue
void SetValue(float first, float second, float third)
Sets the value for this stack.
Definition: ComponentStack.h:103
Component.h
Gorgon::UI::Ch4V1
@ Ch4V1
Channel 4 value is 1, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:302
Gorgon::UI::Hover
@ Hover
Mouse is over the widget, or over a particular repeat.
Definition: Template.h:193
Gorgon::Geometry::basic_Size::Height
T_ Height
Height of this size object.
Definition: Size.h:261
Gorgon::Geometry::basic_Bounds::Width
T_ Width() const
Calculates and returns the width of the bounds.
Definition: Bounds.h:130
Gorgon::UI::ComponentStack::ComponentExists
bool ComponentExists(int ind) const
Returns if a component at ind exists.
Definition: ComponentStack.h:351
Gorgon::UI::ComponentTemplate::GetCondition
ComponentCondition GetCondition() const
Returns the current component condition.
Definition: Template.h:1248
Gorgon::Layer::parent
Layer * parent
Parent layer, could be nullptr.
Definition: Layer.h:504
Gorgon::UI::ComponentTemplate::UseGA
@ UseGA
Definition: Template.h:827
Gorgon::UI::ComponentTemplate::ModifyRotation
@ ModifyRotation
Data affects the rotation of the component.
Definition: Template.h:725
Gorgon::UI::ComponentStack::SetRepeat
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
Gorgon::UI::ComponentTemplate::UseYZ
@ UseYZ
Definition: Template.h:818
Gorgon::Geometry::basic_Point3D
Definition: Point3D.h:12
Gorgon::UI::TopLeft
@ TopLeft
Top left.
Definition: Template.h:41
Gorgon::UI::ComponentStack::HasCondition
bool HasCondition(ComponentCondition condition)
Returns if the given condition is in effect.
Definition: ComponentStack.h:60
Gorgon::UI::LastBaselineLeft
@ LastBaselineLeft
Baseline left, for text, this aligns to the baseline of the last line.
Definition: Template.h:72
Gorgon::UI::ComponentStack::ComponentStack
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
Gorgon::UI::ComponentTemplate::ModifyY
@ ModifyY
Modifies the Y coordinate of the component regardless of the container direction.
Definition: Template.h:705
Gorgon::UI::ComponentTemplate::GrowOnly
@ GrowOnly
Given size is the minimum, if the contents are bigger, the object be resized to fit.
Definition: Template.h:638
Gorgon::UI::ComponentStack::TagHasSubStack
bool TagHasSubStack(ComponentTemplate::Tag tag) const
Returns whether the component marked with the tag has a substack.
Definition: ComponentStack.cpp:1033
Gorgon::Graphics::RGBAf
Represents a four channel 32 bit float per channel color information.
Definition: Color.h:373
Gorgon::UI::BottomRight
@ BottomRight
Bottom right.
Definition: Template.h:60
Gorgon::UI::PlaceholderTemplate::GetTemplate
const Template & GetTemplate() const
Returns the sub template of this placeholder.
Definition: Template.h:1397
Gorgon::Geometry::basic_Bounds::Height
T_ Height() const
Calculates and returns the height of the bounds.
Definition: Bounds.h:135
Gorgon::UI::ComponentTemplate::UseCH
@ UseCH
Definition: Template.h:838
Gorgon::Geometry::Size
basic_Size< int > Size
Definition: Size.h:385
Gorgon::UI::ComponentStack::TagBounds
Geometry::Bounds TagBounds(ComponentTemplate::Tag tag)
Returns the boundaries of the component marked with the given tag.
Definition: ComponentStack.cpp:1297
Gorgon::UI::ComponentTemplate::UnknownTag
@ UnknownTag
Do not use this tag for regular components, it is used to identify substacks without a tag.
Definition: Template.h:854
Gorgon::Time::DeltaTime
unsigned long DeltaTime()
Returns the time passed since the last frame.
Definition: Time.h:258
Gorgon::Graphics::Layer
This layer allows drawing texture images on.
Definition: Layer.h:169
Gorgon::UI::ComponentTemplate
Defines an object according to the Box Model.
Definition: Template.h:600
Gorgon::UI::DataEffectStart
@ DataEffectStart
Do not use this value.
Definition: Template.h:313
Gorgon::UI::ComponentStack::Update
virtual void Update() override
Updates the layout of the component stack.
Definition: ComponentStack.h:268
Gorgon::UI::ComponentTemplate::ModifyWidth
@ ModifyWidth
Width of this component will be affected.
Definition: Template.h:739
Gorgon::UI::ComponentStack::GetTargetValue
std::array< float, 4 > GetTargetValue() const
Returns the value of the stack.
Definition: ComponentStack.h:126
Gorgon::UI::ComponentStack::RemoveCondition
void RemoveCondition(ComponentCondition condition, bool transition=true)
Removes a condition and its associated components.
Definition: ComponentStack.h:54
Gorgon::UI::ComponentStack::RemoveData
void RemoveData(ComponentTemplate::DataEffect effect)
Removes the data associated with data effect.
Definition: ComponentStack.cpp:759
Gorgon::UI::ComponentStack::GetTemplate
const ComponentTemplate & GetTemplate(int ind) const
Returns the template at the given index.
Definition: ComponentStack.h:357
Gorgon::UI::Container
@ Container
Definition: Template.h:165
Gorgon::UI::ComponentTemplate::UseFirst
@ UseFirst
Definition: Template.h:773
Gorgon::Geometry::basic_Bounds::Left
T_ Left
Left-most boundary.
Definition: Bounds.h:399
Gorgon::UI::Placeholder
@ Placeholder
Definition: Template.h:162
Gorgon::Input::Layer::SetOver
void SetOver(std::function< void(Layer &)> fn)
Sets mouse over handler.
Definition: Layer.h:1057
Gorgon::UI::ComponentStack::SetValue
void SetValue(Geometry::Pointf pos)
Sets the value for the stack using a point in coordinate system.
Definition: ComponentStack.h:111
Gorgon::UI::ComponentStack::AddToStack
void AddToStack(const ComponentTemplate &temp, bool reversed)
Adds the given component to the top of the stack.
Definition: ComponentStack.cpp:182
Gorgon::Animation::ControlledTimer
This class is a timer that has its progression strictly controlled.
Definition: ControlledTimer.h:19
Gorgon::UI::ComponentStack::BoundsOf
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
Gorgon
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Gorgon::Geometry::basic_Size
This class represents a 2D geometric size.
Definition: Size.h:23
Gorgon::UI::ComponentTemplate::GetRepeatMode
RepeatMode GetRepeatMode() const
Returns the repeat mode of this component.
Definition: Template.h:1164
Gorgon::Geometry::Margin
basic_Margin< int > Margin
Definition: Margin.h:289
Gorgon::UI::ComponentStack::SetFrameEvent
void SetFrameEvent(std::function< void()> handler)
Sets a function to be called before update check.
Definition: ComponentStack.h:413
Gorgon::Input::Mouse::Scroll_Vert
@ Scroll_Vert
Definition: Mouse.h:24
Gorgon::UI::ComponentStack::AddRepeat
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
Gorgon::UI::ComponentTemplate::UseRA
@ UseRA
Definition: Template.h:825
Gorgon::Layer::bounds
Geometry::Bounds bounds
Bounds of this layer.
Definition: Layer.h:507
Gorgon::UI::Template::GetCount
int GetCount() const
Returns the number of components in the template.
Definition: Template.h:474
Gorgon::Graphics::RGBAf::R
float R
Red channel.
Definition: Color.h:588
Gorgon::UI::ComponentStack::ConditionChanged
Event< ComponentStack > ConditionChanged
Definition: ComponentStack.h:552
Gorgon::Between
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
Gorgon::UI::ComponentStack::GetTextData
std::string GetTextData(ComponentTemplate::DataEffect effect)
Returns the text data. If data is not set, this will return empty string.
Definition: ComponentStack.h:77
Gorgon::UI::IsBottom
bool IsBottom(Anchor a)
Returns if the given anchor is at bottom.
Definition: Template.h:135
Gorgon::UI::ComponentStorage
This class stores component related data.
Definition: Component.h:50
Gorgon::UI::ComponentTemplate::UseBA
@ UseBA
Definition: Template.h:826
Gorgon::UI::ComponentStack::ReturnTargetValue
void ReturnTargetValue()
Whether GetValue returns the target value. This is the default mode.
Definition: ComponentStack.h:141
Gorgon::Input::Layer::SetScroll
void SetScroll(std::function< bool(Layer &, Geometry::Point, float)> fn)
Sets scroll handler.
Definition: Layer.h:670
Gorgon::UI::ComponentStack::AddRepeat
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
Gorgon::UI::ComponentStack::SetOtherMouseEvent
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
Gorgon::UI::ComponentTemplate::UseGrayAlpha
@ UseGrayAlpha
Definition: Template.h:840
Gorgon::Input::Mouse::All
@ All
Definition: Mouse.h:42
Gorgon::UI::TopRight
@ TopRight
Top right.
Definition: Template.h:45
Gorgon::UI::ComponentStack::SetValue
void SetValue(Graphics::RGBAf color)
Sets the value for the stack using a color.
Definition: ComponentStack.h:117
Gorgon::Input::Mouse::Zoom
@ Zoom
Definition: Mouse.h:26
Gorgon::UI::ComponentTemplate::UseThird
@ UseThird
Definition: Template.h:786
ASSERT
#define ASSERT(expression, message,...)
Replaces regular assert to allow messages and backtrace.
Definition: Assert.h:161
Gorgon::UI::ComponentStack::CoordinateToValue
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
Gorgon::Input::Layer::SetHScroll
void SetHScroll(std::function< bool(Layer &, Geometry::Point, float)> fn)
Sets horizontal scroll handler.
Definition: Layer.h:773
Gorgon::UI::ComponentStack::Resize
virtual void Resize(const Geometry::Size &value) override
Notifies the stack about a size change.
Definition: ComponentStack.h:245
Gorgon::UI::ComponentStack::RemoveBeforeUpdateEvent
void RemoveBeforeUpdateEvent()
Removes the function that will be called before every update.
Definition: ComponentStack.h:438
Gorgon::UI::ComponentStack::SetValue
void SetValue(float first)
Sets the value for this stack.
Definition: ComponentStack.h:93
Gorgon::UI::BottomLeft
@ BottomLeft
Bottom left.
Definition: Template.h:56
Gorgon::UI::IsTop
bool IsTop(Anchor a)
Returns if the given anchor is at top.
Definition: Template.h:121
Gorgon::Geometry::Point
basic_Point< int > Point
Definition: Point.h:598
Gorgon::Input::Layer::SetZoom
void SetZoom(std::function< bool(Layer &, Geometry::Point, float)> fn)
Sets zoom handler.
Definition: Layer.h:875
Gorgon::UI::ComponentTemplate::ModifyAnimation
@ ModifyAnimation
Data will affect the progress of the animation.
Definition: Template.h:729
Gorgon::UI::Component::reversed
bool reversed
Definition: Component.h:39
Gorgon::UI::ComponentTemplate::AutoStart
@ AutoStart
Definition: Template.h:674
Gorgon::UI::ContainerTemplate::GetOrientation
Graphics::Orientation GetOrientation() const
Returns the current orientation of the container.
Definition: Template.h:1756
Gorgon::UI::LastBaselineRight
@ LastBaselineRight
Baseline right, for text, this aligns to the baseline of the last line.
Definition: Template.h:77
Gorgon::Graphics::RGBAf::G
float G
Green channel.
Definition: Color.h:591
Gorgon::Input::Layer::SetDown
void SetDown(std::function< void(Layer &, Geometry::Point, Input::Mouse::Button)> fn)
Sets mouse down handler.
Definition: Layer.h:270
Gorgon::UI::ComponentTemplate::UseH
@ UseH
Hue.
Definition: Template.h:801
Gorgon::UI::ComponentStack::GetValue
std::array< float, 4 > GetValue() const
Returns the value of the stack.
Definition: ComponentStack.h:123
Gorgon::UI::ComponentStack::GetImageData
const Graphics::Drawable * GetImageData(ComponentTemplate::DataEffect effect)
Returns the image data. If data is not set, this will return nullptr.
Definition: ComponentStack.h:82
Gorgon::Geometry::basic_Point3D::X
T_ X
Definition: Point3D.h:66
Gorgon::UI::IsIn
bool IsIn(Anchor left, Anchor right)
Definition: ComponentStack.cpp:27
Gorgon::UI::ComponentTemplate::UseGBA
@ UseGBA
Definition: Template.h:834
Gorgon::UI::ComponentStack::IndexOfTag
int IndexOfTag(ComponentTemplate::Tag tag)
Returns the index of the component with the specified tag.
Definition: ComponentStack.cpp:1437
Gorgon::UI::ComponentTemplate::AutoEnd
@ AutoEnd
Definition: Template.h:675
Gorgon::Layer::Render
virtual void Render()
Renders the current layer, default handling is to pass the request to the sub-layers....
Definition: Layer.cpp:51
Gorgon::UI::ComponentStack::ReplaceCondition
void ReplaceCondition(ComponentCondition from, ComponentCondition to, bool transition=true)
Replaces a condition with another one.
Definition: ComponentStack.cpp:574
Gorgon::UI::ComponentTemplate::ValueSource
ValueSource
Which data channels should be used as the value, common combinations are listed, however,...
Definition: Template.h:772
Gorgon::UI::ComponentTemplate::RepeatMode
RepeatMode
Some components are repeated along some axis, this property controls how they will be repeated.
Definition: Template.h:886
Gorgon::UI::ComponentTemplate::ModifyX
@ ModifyX
Modifies the X coordinate of the component regardless of the container direction.
Definition: Template.h:701
Gorgon::UI::ComponentTemplate::UseXYZ
@ UseXYZ
Definition: Template.h:829
Gorgon::UI::BottomCenter
@ BottomCenter
Bottom center.
Definition: Template.h:58
Gorgon::UI::ComponentTemplate::ModifyPositionAndSize
@ ModifyPositionAndSize
This is a combined modification of position and size.
Definition: Template.h:751
Gorgon::UI::ComponentTemplate::UseRGBA
@ UseRGBA
Definition: Template.h:845
Gorgon::UI::calculatemargin
int calculatemargin(int l, int r)
Definition: ComponentStack.cpp:2184
Gorgon::Geometry::Pointf
basic_Point< Float > Pointf
Definition: Point.h:601
Gorgon::UI::ComponentStack::Render
void Render() override
Renders the current layer, default handling is to pass the request to the sub-layers....
Definition: ComponentStack.cpp:883
Gorgon::UI::ComponentTemplate::UseLC
@ UseLC
Definition: Template.h:837
Gorgon::UI::ComponentStack::SetValueEvent
void SetValueEvent(std::function< void()> handler)
Sets the function that will be called whenever the value is changed.
Definition: ComponentStack.h:146
Gorgon::UI::Ch2V1
@ Ch2V1
Channel 2 value is 1, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:278
Gorgon::Geometry::basic_Point::Distance
Float Distance(const basic_Point &target) const
Calculates Euclidean distance from this point to the given target.
Definition: Point.h:276
Gorgon::Graphics::TextRenderer::GetEMSize
virtual int GetEMSize() const =0
Returns the size of the EM dash.
Gorgon::UI::ComponentStack::RemoveFrameEvent
void RemoveFrameEvent()
Removes the function that will be called before update check.
Definition: ComponentStack.h:433
Gorgon::Layer
This class is the base class for all layer types.
Definition: Layer.h:79
Gorgon::UI::Ch1V0
@ Ch1V0
Channel 1 value is 0, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:258
Gorgon::Graphics::Orientation::Vertical
@ Vertical
Gorgon::UI::ComponentTemplate::ModifyPosition
@ ModifyPosition
Position of this component will be affected by the data.
Definition: Template.h:697
Gorgon::Geometry::basic_Point
This class represents a 2D point.
Definition: Point.h:32
Gorgon::UI::ComponentTemplate::Fixed
@ Fixed
The given size is absolute, it is not affected by the contents.
Definition: Template.h:631
Gorgon::UI::ComponentTemplate::NoRepeat
@ NoRepeat
Definition: Template.h:887
Gorgon::UI::ComponentTemplate::ModifyHeight
@ ModifyHeight
Height of this component will be affected.
Definition: Template.h:744
Gorgon::UI::ComponentStack::SetValue
void SetValue(Geometry::Point3D pos)
Sets the value for the stack using a point in coordinate system.
Definition: ComponentStack.h:114
Gorgon::UI::Dimension::BasisPoint
@ BasisPoint
Dimension will be relative to the parent and given in 1/10000.
Definition: Dimension.h:29
Gorgon::UI::ComponentStack::AddCondition
void AddCondition(ComponentCondition condition, bool transition=true)
Adds a condition and its associated components to the stack.
Definition: ComponentStack.h:48
Gorgon::UI::ComponentTemplate::ModifySize
@ ModifySize
Size of this component will be affected.
Definition: Template.h:734
Gorgon::UI::IsMiddle
bool IsMiddle(Anchor a)
Returns if the given anchor is at middle vertically.
Definition: Template.h:149
Gorgon::UI::ComponentStack::RemoveUpdateEvent
void RemoveUpdateEvent()
Removes the function that will be called after every update before rendering.
Definition: ComponentStack.h:443
Gorgon::UI::ComponentTemplate::UseL
@ UseL
Lightness.
Definition: Template.h:798
Gorgon::UI::ComponentCondition
ComponentCondition
Controls the condition when the components are visible.
Definition: Template.h:174
Gorgon::UI::ComponentTemplate::UseLCHA
@ UseLCHA
Definition: Template.h:843
Gorgon::UI::ComponentTemplate::GetClip
bool GetClip() const
Returns whether currently clipping the contents.
Definition: Template.h:1272
Gorgon::Input::Mouse::EventType
EventType
The type of a mouse event.
Definition: Mouse.h:14
Gorgon::UI::ComponentStack::SetClickEvent
void SetClickEvent(std::function< void(ComponentTemplate::Tag, Geometry::Point, Input::Mouse::Button)> handler)
Sets the mouse down event.
Definition: ComponentStack.h:490
Gorgon::UI::ComponentStack::GetWidget
Widget * GetWidget(ComponentTemplate::Tag tag)
Returns the widget associated with the tag.
Definition: ComponentStack.cpp:3610
Gorgon::UI::ComponentTemplate::GetIndex
int GetIndex() const
Returns the component index.
Definition: Template.h:1235
LayerAdapter.h
Gorgon::Graphics::RGBAf::B
float B
Blue channel.
Definition: Color.h:594
Gorgon::Sign
int Sign(T_ val)
Definition: Types.h:126
Gorgon::Graphics::Orientation::Horizontal
@ Horizontal
Gorgon::UI::ComponentStack::SetValue
void SetValue(Graphics::RGBA color)
Sets the value for the stack using a color.
Definition: ComponentStack.h:120
Gorgon::UI::IsMouseRelated
bool IsMouseRelated(ComponentCondition condition)
Returns if the given condition is related to mouse events.
Definition: Template.h:371
Gorgon::UI::MiddleRight
@ MiddleRight
Middle right.
Definition: Template.h:53
Gorgon::UI::Component::location
Geometry::Point location
Definition: Component.h:24
Gorgon::UI::ComponentStack::ComponentStack
ComponentStack(const Template &temp)
Initiates a component stack with default size.
Definition: ComponentStack.h:34
Gorgon::Animation::Timer::Reset
virtual void Reset() override
Resets the timer, basically starting the animation from the start.
Definition: Animation.h:135
Gorgon::UI::ComponentStack::SetMouseOutEvent
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
Gorgon::UI::ComponentStack::EnableTagWrap
void EnableTagWrap(ComponentTemplate::Tag tag)
Enables text wrapping on a specific tag, default is enabled.
Definition: ComponentStack.h:402
Gorgon::Geometry::basic_Bounds::Right
T_ Right
Right-most boundary.
Definition: Bounds.h:405
Gorgon::UI::IsCenter
bool IsCenter(Anchor a)
Returns if an anchor is centered horizontally.
Definition: Template.h:109
Gorgon::UI::ComponentStack::TransformCoordinates
Geometry::Pointf TransformCoordinates(ComponentTemplate::Tag tag, Geometry::Point location)
Translates the given coordinates to component space from 0 to 1.
Definition: ComponentStack.cpp:1422
Gorgon::UI::Graphics
@ Graphics
Definition: Template.h:164
Gorgon::UI::Ch1V1
@ Ch1V1
Channel 1 value is 1, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:266
Gorgon::UI::WidgetContainer::Remove
bool Remove(Widget &widget)
Removes the given widget from this container.
Definition: WidgetContainer.cpp:57
Gorgon::UI::ComponentStack::RemoveRepeats
void RemoveRepeats(ComponentTemplate::RepeatMode mode)
Removes all repeat points from the given mode.
Definition: ComponentStack.h:219
Gorgon::UI::ComponentTemplate::ShrinkOnly
@ ShrinkOnly
Given size is the maximum, if the contents are smaller, the object be resized.
Definition: Template.h:642
Gorgon::UI::ComponentTemplate::NoTag
@ NoTag
Definition: Template.h:851
Gorgon::UI::ComponentStack::RemoveTagSize
void RemoveTagSize(ComponentTemplate::Tag tag)
Removes the fixed size for a set tagged component.
Definition: ComponentStack.h:397
Gorgon::UI::ComponentStack::GetTagLocation
Geometry::Point GetTagLocation(ComponentTemplate::Tag tag) const
Definition: ComponentStack.h:367
Gorgon::UI::ComponentStack::GetTagSize
Geometry::Size GetTagSize(ComponentTemplate::Tag tag) const
Definition: ComponentStack.h:387
Gorgon::UI::Template::GetConditionDuration
int GetConditionDuration(ComponentCondition from, ComponentCondition to) const
Returns the duration of the component condition.
Definition: Template.h:562
Gorgon::UI::ComponentTemplate::UseGray
@ UseGray
Grayscale value of color.
Definition: Template.h:795
Gorgon::UI::ComponentStack::ResetAnimation
void ResetAnimation()
Definition: ComponentStack.h:275
Gorgon::UI::ComponentTemplate::UseFourth
@ UseFourth
Definition: Template.h:790
Gorgon::Geometry::basic_Bounds::Bottom
T_ Bottom
Bottom-most boundary.
Definition: Bounds.h:408
Gorgon::UI::Component::GetTemplate
const ComponentTemplate & GetTemplate() const
Returns the template, component should have a template at all times.
Definition: Component.h:20
Gorgon::UI::ComponentStack::SetRenderEvent
void SetRenderEvent(std::function< void()> handler)
Sets a function to be called after every render.
Definition: ComponentStack.h:428
Gorgon::UI::ComponentTemplate::AbsoluteSliding
@ AbsoluteSliding
Absolute positioning, coordinates will start from the container, percent based movement will move to ...
Definition: Template.h:615
Gorgon::UI::ComponentStack::SetConditionOf
void SetConditionOf(ComponentTemplate::RepeatMode mode, int index, ComponentCondition condition)
Sets the condition of a specific repeat index.
Definition: ComponentStack.h:227
Gorgon::Input::Layer::SetUp
void SetUp(std::function< void(Layer &, Geometry::Point, Input::Mouse::Button)> fn)
Sets mouse up handler.
Definition: Layer.h:445
Gorgon::UI::MiddleCenter
@ MiddleCenter
Middle center, using this position ensures that the components will be inside each other.
Definition: Template.h:51
Gorgon::Geometry::basic_Point::Y
T_ Y
Y coordinate.
Definition: Point.h:371
Gorgon::UI::ComponentStack::AddRepeat
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
Gorgon::Geometry::basic_Bounds::TopLeft
basic_Point< T_ > TopLeft() const
Returns top left corner.
Definition: Bounds.h:105
Gorgon::UI::GraphicsTemplate
Defines a visual component.
Definition: Template.h:1580
Gorgon::Geometry::basic_Size::Width
T_ Width
Width of this size object.
Definition: Size.h:258
Gorgon::Graphics::Drawable
Represents a drawable object, that can be drawn to the given point.
Definition: Drawables.h:17
Gorgon::UI::Ignored
@ Ignored
Definition: Template.h:166
Gorgon::UI::ComponentStack::RemoveRenderEvent
void RemoveRenderEvent()
Removes the function that will be called after every render.
Definition: ComponentStack.h:448
Gorgon::Geometry::basic_Bounds::GetSize
basic_Size< T_ > GetSize() const
Returns the size of the bounds object.
Definition: Bounds.h:141
Gorgon::UI::ContainerTemplate
Container class that defines an area according to the Box Model.
Definition: Template.h:1655
Gorgon::UI::Ch3V05
@ Ch3V05
Channel 3 value is 0.5, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:286
Gorgon::Input::Mouse::Button
Button
Lists the mouse button constants.
Definition: Mouse.h:31
Gorgon::UI::FirstBaselineLeft
@ FirstBaselineLeft
Baseline left, for text, this aligns to the baseline of the first line.
Definition: Template.h:64
Gorgon::UI::TextholderTemplate::GetRenderer
const Graphics::TextRenderer & GetRenderer() const
Returns the renderer for this textholder.
Definition: Template.h:1445
Gorgon::UI::Never
@ Never
Component is always disabled.
Definition: Template.h:179
Gorgon::UI::ComponentStack::RemoveTagLocation
void RemoveTagLocation(ComponentTemplate::Tag tag)
Removes the fixed location for a set tagged component.
Definition: ComponentStack.h:377
Gorgon::UI::Component::parent
int parent
Definition: Component.h:41
Gorgon::String::Concat
std::string Concat(const P_ &... rest)
Streams the given parameters into a stringstream and returns the result, effectively concatinating al...
Definition: String.h:560
Gorgon::UI::ComponentStack::AddRepeat
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
Gorgon::UI::Ch3V1
@ Ch3V1
Channel 3 value is 1, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:290
Template.h
This file contains UI component template system.
Gorgon::UI::Textholder
@ Textholder
Definition: Template.h:163
Gorgon::Geometry::basic_Margin
This class defines Margin of an object or an area.
Definition: Margin.h:22
Gorgon::UI::ComponentTemplate::GetType
virtual ComponentType GetType() const noexcept=0
Returns the type of the component.
Gorgon::UI::ComponentStack::~ComponentStack
virtual ~ComponentStack()
Destructor.
Definition: ComponentStack.cpp:169
Gorgon::Input::Layer::SetOut
void SetOut(std::function< void(Layer &)> fn)
Sets mouse out handler.
Definition: Layer.h:1105
Gorgon::UI::ComponentStack::GetTemplate
const Template & GetTemplate() const
Returns the template used by this stack.
Definition: ComponentStack.h:256
Gorgon::UI::ComponentStack::TranslateCoordinates
Geometry::Point TranslateCoordinates(ComponentTemplate::Tag tag, Geometry::Point location)
Translates the given coordinates to component space in pixels.
Definition: ComponentStack.cpp:1387
Gorgon::Graphics::RGBAf::A
float A
Alpha channel.
Definition: Color.h:597
Gorgon::UI::IsLeft
bool IsLeft(Anchor a)
Returns if an anchor is on the left.
Definition: Template.h:81
Gorgon::UI::ComponentTemplate::UseRGA
@ UseRGA
Definition: Template.h:832
Gorgon::UI::ComponentStack::SetTagLocation
void SetTagLocation(ComponentTemplate::Tag tag, Geometry::Point location)
Set a fixed location for a tagged component.
Definition: ComponentStack.h:362
Gorgon::Time::FrameStart
unsigned long FrameStart()
Returns start time of the current frame in milliseconds.
Definition: Time.h:252
Gorgon::UI::Anchor
Anchor
Anchor position.
Definition: Template.h:32
Gorgon::UI::ComponentStack::SetEMSize
void SetEMSize(int value)
Changes the default emsize of 10. This value can be overridden.
Definition: ComponentStack.h:287
Gorgon::UI::ComponentStack::HandleMouse
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
Gorgon::UI::ComponentStack::SetBeforeUpdateEvent
void SetBeforeUpdateEvent(std::function< void()> handler)
Sets a function to be called before every update.
Definition: ComponentStack.h:418
Gorgon::UI::ComponentStack::SetMouseDownEvent
void SetMouseDownEvent(std::function< void(ComponentTemplate::Tag, Geometry::Point, Input::Mouse::Button)> handler)
Sets the mouse down event.
Definition: ComponentStack.h:465
Gorgon::UI::ComponentTemplate::UseXZ
@ UseXZ
Definition: Template.h:821
Gorgon::UI::ComponentTemplate::UseXY
@ UseXY
Definition: Template.h:814
Gorgon::UI::ComponentStack::SetTagSize
void SetTagSize(ComponentTemplate::Tag tag, Geometry::Size size)
Set a fixed size for a tagged component.
Definition: ComponentStack.h:382
Gorgon::UI::ComponentStack::FinalizeTransitions
void FinalizeTransitions()
Finalizes on-going transitions immediately.
Definition: ComponentStack.cpp:666
Gorgon::UI::ComponentStack::IsDisabled
bool IsDisabled() const
Returns if this component stack is disabled. Both disabling and enabling animations are counted as di...
Definition: ComponentStack.h:280
Gorgon::UI::ComponentStack::SetUpdateEvent
void SetUpdateEvent(std::function< void()> handler)
Sets a function to be called after every update before rendering.
Definition: ComponentStack.h:423
Gorgon::NumberOfSetBits
int NumberOfSetBits(uint32_t i)
Returns the number of bits that are 1 in a number.
Definition: Types.h:70
Gorgon::UI::ComponentTemplate::Tag
Tag
Tags mark a component to be modified in a way meaningful to specific widgets.
Definition: Template.h:850
Gorgon::UI::ComponentTemplate::DataEffect
DataEffect
Which property will the data of the widget affect.
Definition: Template.h:646
Gorgon::UI::ComponentTemplate::GetValueModification
ValueModification GetValueModification() const
Returns which property of this component will be modified by the value.
Definition: Template.h:1129
Gorgon::UI::Component::size
Geometry::Size size
Definition: Component.h:26
Gorgon::UI::Ch4V05
@ Ch4V05
Channel 4 value is 0.5, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:298
Gorgon::UI::Always
@ Always
Component is always active.
Definition: Template.h:176
Gorgon::UI::ComponentTemplate::GetDataEffect
DataEffect GetDataEffect() const
Returns how the data will affect this component.
Definition: Template.h:1083
Gorgon::Geometry::basic_Bounds::Top
T_ Top
Top-most boundary.
Definition: Bounds.h:402
Gorgon::UI::ComponentStack::SetValueToText
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
Gorgon::UI::ComponentStack::HasLayer
bool HasLayer(int ind) const
Returns if the component at the given index has a layer.
Definition: ComponentStack.cpp:1344
Gorgon::UI::Ch1V05
@ Ch1V05
Channel 1 value is 0.5, the value will be rounded to 4 decimal points before comparison.
Definition: Template.h:262
Gorgon::Layer::GetSize
Geometry::Size GetSize() const
Returns the size of the layer.
Definition: Layer.h:362
Gorgon::UI::Widget
This class is the base for all widgets.
Definition: Widget.h:16
Gorgon::UI::Component::range
Geometry::Rectangle range
Definition: Component.h:32
Gorgon::Input::Keyboard::Keycodes::Down
constexpr Key Down
Definition: Keyboard.h:65
Gorgon::UI::ComponentStack::SetMouseUpEvent
void SetMouseUpEvent(std::function< void(ComponentTemplate::Tag, Geometry::Point, Input::Mouse::Button)> handler)
Sets the mouse up event.
Definition: ComponentStack.h:478