 |
Gorgon Game Engine
|
Go to the documentation of this file.
5 #include "../UI/ComponentStackWidget.h"
6 #include "../UI/RadioControl.h"
7 #include "../Property.h"
9 #include "../UI/WidgetContainer.h"
12 namespace Gorgon {
namespace Widgets {
19 template<
class T_,
class W_ = Checkbox>
54 void Add(
const T_ value) {
58 void Add(
const T_ value, std::string text) {
64 auto &c = *
new W_(
temp, text);
69 if(value == this->
Get())
87 throw std::runtime_error(
"Element does not exist");
104 if(before == this->
Get())
110 this->
reverse.insert({&elm, after});
112 if(after == this->
Get())
116 using Widget::Enable;
123 using Widget::Disable;
131 using Widget::ToggleEnabled;
143 p.second.SetEnabled(state);
152 return p.second.IsEnabled();
188 using Widget::EnsureVisible;
210 using Widget::IsVisible;
288 if(&p.second == &widget)
298 int total = 0, col = 0;
301 total += p.second.GetHeight() +
spacing;
307 if(total > 0) total -=
spacing;
319 if(!ans.Transformed) {
327 return {
false,
this,
self.GetLocation()};
336 virtual void show()
override {
340 virtual void hide()
override {
353 virtual void focuschanged()
override {
360 virtual void focuslost()
override {
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::string >::type From(const T_ &e)
Definition: Enum.h:303
bool own
Definition: RadioControl.h:261
Containers::Hashmap< T_, Checkbox > elements
Definition: RadioControl.h:258
void Add(Layer &layer)
Adds the given layer as a child.
Definition: Layer.cpp:23
Geometry::Point GetLocation() const
Returns the current location of the layer.
Definition: Layer.h:403
This class is designed to turn any group of two state widgets to a radio button group,...
Definition: RadioControl.h:33
This class stores visual information about a widget template.
Definition: Template.h:392
T_ Get() const
Returns the current value.
Definition: RadioControl.h:125
bool Exists(const T_ value) const
Returns if the given element exists.
Definition: RadioControl.h:130
int GetColumns() const
Returns the number of columns when placing the widgets.
Definition: RadioControl.h:228
std::map< Checkbox *, T_ > reverse
Definition: RadioControl.h:259
void Add(const K_ &key, T_ &obj, bool deleteprev=false)
Adds the given item with the related key.
Definition: Hashmap.h:264
virtual bool IsVisible() const
Returns whether this layer is effectively visible.
Definition: Layer.h:459
This layer allows drawing texture images on.
Definition: Layer.h:169
void Delete(const K_ &key)
Removes the item with the given key from the mapping and deletes it.
Definition: Hashmap.h:332
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
This class represents a 2D geometric size.
Definition: Size.h:23
int GetSpacing() const
Returns the spacing required for this template.
Definition: Template.h:578
void PlaceBefore(int before)
Places this layer before the given index.
Definition: Layer.h:290
int GetWidth() const
Returns the size of the template.
Definition: Template.h:525
void SetColumns(int value)
Changes the number of columns when placing the widgets.
Definition: RadioControl.h:223
virtual void Move(const Geometry::Point &location)
Moves this layer to the given location.
Definition: Layer.h:327
This structure is used to transfer extender request response.
Definition: WidgetContainer.h:15
void Remove(Layer &layer)
Removes the given layer.
Definition: Layer.h:203
This class is the base class for all layer types.
Definition: Layer.h:79
Geometry::Point CoordinatesInExtender
Coordinates of the given point in the extender container.
Definition: WidgetContainer.h:24
This class represents a 2D point.
Definition: Point.h:32
void SetWidth(int width)
Resizes the layer to the given size.
Definition: Layer.h:347
void Remove(const K_ &key)
Removes the item with the given key from the mapping.
Definition: Hashmap.h:326
@ Active
This is for widgets that can be activated, like a count down timer.
Definition: Template.h:245
virtual void Hide()
Hides this layer.
Definition: Layer.h:456
virtual void Show()
Displays this layer.
Definition: Layer.h:453
T_ Width
Width of this size object.
Definition: Size.h:258
void PlaceIn(C_ &container, Geometry::Point start, int spacing)
This function will add all widgets in this controller to the given container.
Definition: RadioControl.h:176
void Resize(const Geometry::Size &size)
Resizes the active context.
Definition: OpenGL.cpp:273
bool Set(const T_ value)
Assigns a new value to the radio control.
Definition: RadioControl.h:104
void SetHeight(int height)
Resizes the layer to the given size.
Definition: Layer.h:352
Geometry::Size GetSize() const
Returns the size of the layer.
Definition: Layer.h:362
void Add(const T_ value, CT_ &control)
Adds the given element to this controller.
Definition: RadioControl.h:135