![]() |
Gorgon Game Engine
|
This class is designed to turn any group of two state widgets to a radio button group, only allowing one of them to be checked at the same time. More...
Public Member Functions | |
RadioControl () | |
Default constructor. Use filling constructor if possible. More... | |
RadioControl (const RadioControl &)=delete | |
No copying. More... | |
RadioControl (std::initializer_list< std::pair< const T_, CT_ & >> elm, T_ current=T_()) | |
Filling constructor that prepares RadioControl from the start. More... | |
RadioControl (std::initializer_list< std::pair< const T_, CT_ * >> elm, T_ current=T_()) | |
Filling constructor that prepares RadioControl from the start. More... | |
virtual | ~RadioControl () |
void | Add (const T_ value, CT_ &control) |
Adds the given element to this controller. More... | |
auto | begin () |
For iteration. More... | |
auto | begin () const |
For iteration. More... | |
void | ChangeValue (const T_ &before, const T_ &after) |
Changes the value of the given element. More... | |
auto | end () |
For iteration. More... | |
auto | end () const |
For iteration. More... | |
bool | Exists (const T_ value) const |
Returns if the given element exists. More... | |
T_ | Get () const |
Returns the current value. More... | |
int | GetColumns () const |
Returns the number of columns when placing the widgets. More... | |
operator T_ () const | |
Returns the current value. More... | |
RadioControl & | operator= (const T_ value) |
Assigns a new value to the radio control. More... | |
template<class C_ > | |
void | PlaceIn (C_ &container, Geometry::Point start, int spacing) |
This function will add all widgets in this controller to the given container. More... | |
bool | Set (const T_ value) |
Assigns a new value to the radio control. More... | |
void | SetColumns (int value) |
Changes the number of columns when placing the widgets. More... | |
Public Attributes | |
Event< RadioControl, T_ > | ChangedEvent |
Protected Member Functions | |
void | changing (TwoStateControl &control, bool state, bool &allow) |
void | clearall () |
virtual void | elementadded (const T_ &index) |
Protected Attributes | |
int | columns |
T_ | current |
Containers::Hashmap< T_, CT_ > | elements |
bool | own |
std::map< CT_ *, T_ > | reverse |
This class is designed to turn any group of two state widgets to a radio button group, only allowing one of them to be checked at the same time.
Additionally, it allows setting and retrieving the selected option through as single value. Below is an example that shows how to use RadioControl with Checkbox
RadioControl | ( | ) |
Default constructor. Use filling constructor if possible.
|
delete |
No copying.
|
explicit |
Filling constructor that prepares RadioControl from the start.
This variant will not own its children.
|
explicit |
Filling constructor that prepares RadioControl from the start.
This variant will own its children.
|
virtual |
void Add | ( | const T_ | value, |
CT_ & | control | ||
) |
Adds the given element to this controller.
auto begin | ( | ) |
For iteration.
auto begin | ( | ) | const |
For iteration.
void ChangeValue | ( | const T_ & | before, |
const T_ & | after | ||
) |
Changes the value of the given element.
|
protected |
|
protected |
|
protectedvirtual |
auto end | ( | ) |
For iteration.
auto end | ( | ) | const |
For iteration.
bool Exists | ( | const T_ | value | ) | const |
Returns if the given element exists.
T_ Get | ( | ) | const |
Returns the current value.
int GetColumns | ( | ) | const |
Returns the number of columns when placing the widgets.
operator T_ | ( | ) | const |
Returns the current value.
RadioControl& operator= | ( | const T_ | value | ) |
Assigns a new value to the radio control.
If the specified value exists in the, it will be selected, if not, nothing will be selected.
void PlaceIn | ( | C_ & | container, |
Geometry::Point | start, | ||
int | spacing | ||
) |
This function will add all widgets in this controller to the given container.
If any member is not a widget, it will be ignored.
bool Set | ( | const T_ | value | ) |
Assigns a new value to the radio control.
If the specified value exists in the, it will be selected, if not, nothing will be selected and this function will return false.
void SetColumns | ( | int | value | ) |
Changes the number of columns when placing the widgets.
Event<RadioControl, T_> ChangedEvent |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |