 |
Gorgon Game Engine
|
Go to the documentation of this file.
4 #include "../Containers/Hashmap.h"
6 namespace Gorgon {
namespace UI {
32 template<
class T_ =
int,
class CT_ = TwoStateControl>
49 p.second.SetState(
false,
true);
50 reverse.insert({&p.second, p.first});
70 p.second.SetState(
false,
true);
71 reverse.insert({&p.second, p.first});
104 bool Set(
const T_ value) {
135 void Add(
const T_ value, CT_ &control) {
141 reverse.insert({&control, value});
151 throw std::runtime_error(
"Element does not exist");
159 if(before == this->
Get())
165 this->
reverse.insert({&elm, after});
167 if(after == this->
Get())
181 auto w =
dynamic_cast<Widget*
>(&p.second);
193 loc.Y += w->GetSize().Height + spacing;
197 loc.X += w->GetSize().Width + spacing;
252 p.second.SetState(
false,
true);
bool own
Definition: RadioControl.h:261
Containers::Hashmap< T_, CT_ > elements
Definition: RadioControl.h:258
RadioControl(std::initializer_list< std::pair< const T_, CT_ * >> elm, T_ current=T_())
Filling constructor that prepares RadioControl from the start.
Definition: RadioControl.h:64
This class provides event mechanism.
Definition: Event.h:134
T_ current
Definition: RadioControl.h:263
This class is designed to turn any group of two state widgets to a radio button group,...
Definition: RadioControl.h:33
This class is a reference based hashmap.
Definition: Hashmap.h:35
int columns
Definition: RadioControl.h:265
auto begin() const
For iteration.
Definition: RadioControl.h:213
void ChangeValue(const T_ &before, const T_ &after)
Changes the value of the given element.
Definition: RadioControl.h:146
T_ Get() const
Returns the current value.
Definition: RadioControl.h:125
T_ X
X coordinate.
Definition: Point.h:368
RadioControl(const RadioControl &)=delete
No copying.
bool Exists(const T_ value) const
Returns if the given element exists.
Definition: RadioControl.h:130
auto begin()
For iteration.
Definition: RadioControl.h:203
void clearall()
Definition: RadioControl.h:250
int GetColumns() const
Returns the number of columns when placing the widgets.
Definition: RadioControl.h:228
std::map< CT_ *, T_ > reverse
Definition: RadioControl.h:259
void changing(TwoStateControl &control, bool state, bool &allow)
Definition: RadioControl.h:235
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
auto end() const
For iteration.
Definition: RadioControl.h:218
void SetColumns(int value)
Changes the number of columns when placing the widgets.
Definition: RadioControl.h:223
Event< RadioControl, T_ > ChangedEvent
Definition: RadioControl.h:232
This class represents a 2D point.
Definition: Point.h:32
RadioControl()
Default constructor. Use filling constructor if possible.
Definition: RadioControl.h:36
This class is designed to be the interface class for all checkbox like UI elements.
Definition: TwoStateControl.h:13
auto end()
For iteration.
Definition: RadioControl.h:208
virtual void elementadded(const T_ &index)
Definition: RadioControl.h:256
virtual ~RadioControl()
Definition: RadioControl.h:85
RadioControl(std::initializer_list< std::pair< const T_, CT_ & >> elm, T_ current=T_())
Filling constructor that prepares RadioControl from the start.
Definition: RadioControl.h:43
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
bool Set(const T_ value)
Assigns a new value to the radio control.
Definition: RadioControl.h:104
RadioControl & operator=(const T_ value)
Assigns a new value to the radio control.
Definition: RadioControl.h:92
void Add(const T_ value, CT_ &control)
Adds the given element to this controller.
Definition: RadioControl.h:135