![]() |
Gorgon Game Engine
|
Allows the use of radio buttons working together. More...
Public Member Functions | |
RadioButtons (const UI::Template &temp) | |
RadioButtons (Registry::TemplateType type=Registry::Radio_Regular) | |
virtual bool | Activate () override |
Activates the widget. More... | |
void | Add (const T_ value) |
void | Add (const T_ value, std::string text) |
void | ChangeValue (const T_ &before, const T_ &after) |
Changes the value of the given element. More... | |
void | Disable (const T_ &value) |
Disables the given element. More... | |
void | Enable (const T_ &value) |
Enables the given element. More... | |
bool | EnsureVisible (const UI::Widget &) override |
Ensures the widget is visible. More... | |
Geometry::Size | GetInteriorSize () const override |
Should return the interior (usable) size of the container. More... | |
Geometry::Point | GetLocation () const override |
Returns the location of the widget. More... | |
Geometry::Size | GetSize () const override |
Returns the size of the widget. More... | |
virtual bool | IsEnabled () const override |
Returns whether the widget is enabled. More... | |
bool | IsEnabled (const T_ &value) const |
Returns if given element is enabled. More... | |
bool | IsVisible () const override |
Should return whether the container is visible. More... | |
bool | KeyEvent (Input::Key key, float state) override |
This function should be called whenever a key is pressed or released. More... | |
void | Move (const Geometry::Point &location) override |
Moves this widget to the given position. More... | |
RadioButtons & | operator= (const T_ value) |
Assigns a new value to the radio control. More... | |
virtual void | Resize (const Geometry::Size &size) override |
Radio buttons height is automatically adjusted. Only width will be used. More... | |
bool | ResizeInterior (Geometry::Size size) override |
Should resize the interior (usable) size of the container. More... | |
void | SetColumns (int value) |
Changes the number of columns. More... | |
virtual void | SetEnabled (bool value) override |
Sets the enabled state of the widget. More... | |
void | SetEnabled (const T_ &value, bool state) |
Sets the enabled state the given element. More... | |
void | SetSpacing (int value) |
void | ToggleEnabled (const T_ &value) |
Toggles enabled state of the given element. More... | |
![]() | |
Widget () | |
Widget (Widget &&)=default | |
virtual | ~Widget () |
bool | AllowFocus () const |
If this widget can be focused currently. More... | |
virtual bool | CharacterEvent (Char) |
This function should be called whenever a character is received from operating system. More... | |
bool | Defocus () |
Removes the focus from this widget if this widget is focused. More... | |
void | Disable () |
Disables the widget so that the user cannot interact with it. More... | |
virtual bool | Done () |
For widgets that supports it, this will trigger finalization the user interaction. More... | |
void | Enable () |
Enables the widget so that the user can interact with it. More... | |
bool | EnsureVisible () const |
Ensures this widget is visible in its container by scrolling it into view. More... | |
bool | Focus () |
Transfers the focus to this widget. More... | |
Geometry::Bounds | GetBounds () const |
Returns the bounds of the widget. More... | |
int | GetHeight () const |
Returns the height of the widget. More... | |
WidgetContainer & | GetParent () const |
Returns the parent of this widget, throws if it does not have a parent. More... | |
int | GetWidth () const |
Returns the width of the widget. More... | |
bool | HasParent () const |
Returns if this widget has a parent. More... | |
void | Hide () |
Hides this widget, when hidden, widgets cannot gain focus. More... | |
bool | IsFloating () const |
Returns floating status of this widget. More... | |
bool | IsFocused () const |
Returns if this widget is focused. More... | |
bool | IsVisible () const |
Returns if the widget is visible. More... | |
void | Move (int x, int y) |
Moves this widget to the given position. More... | |
bool | Remove () |
Removes the widget from its parent. More... | |
virtual void | Resize (int w, int h) |
Changes the size of the widget. More... | |
void | SetHeight (int height) |
Sets the height of the widget. More... | |
virtual void | SetIsFloating (bool value) |
Sets floating status of this widget. More... | |
void | setname (std::string value) |
This is a debug feature. More... | |
void | SetVisible (bool value) |
Changes the visibility of the widget. More... | |
void | SetWidth (int width) |
Sets the width of the widget. More... | |
void | Show () |
Shows this widget, widgets are visible by default. More... | |
void | ToggleEnabled () |
Toggles enabled state of the widget. More... | |
void | ToggleVisible () |
Toggles the visibility state of the widget. More... | |
Protected Member Functions | |
virtual bool | addingwidget (Widget &widget) override |
virtual void | addto (Layer &layer) override |
When called, widget should locate itself on to this layer. More... | |
virtual bool | allowfocus () const override |
Should return true if the widget can be focused. More... | |
virtual void | focused () override |
This is called after the focus is transferred to this widget. More... | |
Gorgon::Layer & | getlayer () override |
Returns the layer that will be used to place the contained widgets. More... | |
virtual void | parentenabledchanged (bool state) override |
This function is called when the parent's enabled state changes. More... | |
void | rearrange () |
virtual void | removefrom (Layer &layer) override |
When called, widget should remove itself from the given layer. More... | |
virtual bool | removingwidget (Widget &) override |
UI::ExtenderRequestResponse | RequestExtender (const Layer &self) override |
This function will return a container that will act as an extender. More... | |
virtual void | setlayerorder (Layer &, int order) override |
When called, widget should reorder itself in layer hierarchy. More... | |
![]() | |
virtual void | addedto (WidgetContainer &container) |
Called when this widget added to the given container. More... | |
virtual bool | addingto (WidgetContainer &) |
Called when it is about to be added to the given container. More... | |
virtual void | boundschanged () |
Call this function when the widget bounds is changed. More... | |
virtual bool | canloosefocus () const |
Should return true if the widget can loose the focus right now. More... | |
virtual void | displaced () |
Call this function when the widget container causes it to be displaced. More... | |
virtual void | removed () |
Called after this widget is removed from its parent. More... | |
virtual bool | removingfrom () |
Called before this widget is removed from its parent. More... | |
![]() | |
void | changing (TwoStateControl &control, bool state, bool &allow) |
void | clearall () |
virtual void | elementadded (const T_ &index) |
RadioControl () | |
Default constructor. Use filling constructor if possible. More... | |
RadioControl (const RadioControl &)=delete | |
No copying. More... | |
RadioControl (std::initializer_list< std::pair< const T_, Checkbox & >> elm, T_ current=T_()) | |
Filling constructor that prepares RadioControl from the start. More... | |
RadioControl (std::initializer_list< std::pair< const T_, Checkbox * >> elm, T_ current=T_()) | |
Filling constructor that prepares RadioControl from the start. More... | |
virtual | ~RadioControl () |
void | Add (const T_ value, Checkbox &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... | |
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... | |
![]() | |
virtual bool | addingwidget (Widget &) |
This function can return false to prevent the given widget from getting added to the container. More... | |
virtual void | childboundschanged (Widget *source) |
The boundary of any of the children is changed. Source could be nullptr. More... | |
bool | distributecharevent (Char c) |
Distributes a pressed character to the focused widget. More... | |
bool | distributekeyevent (Input::Key key, float state, bool handlestandard) |
Distributes the pressed key to the focused widget. More... | |
void | distributeparentenabled (bool state) |
Distributes a enabled state to children. More... | |
bool | handlestandardkey (Input::Key key) |
Performs the standard operations (tab/enter/escape) More... | |
virtual bool | removingwidget (Widget &) |
This function is called before removing a widget. More... | |
virtual void | widgetadded (Widget &) |
This function is called after a widget is added. More... | |
virtual void | widgetremoved (Widget &) |
This function is called after a widget is removed. More... | |
WidgetContainer ()=default | |
WidgetContainer (WidgetContainer &&)=default | |
virtual | ~WidgetContainer () |
Virtual destructor. More... | |
bool | Add (Widget &widget) |
Adds the given widget to this container. More... | |
void | AttachOrganizer (Organizers::Base &organizer) |
Attaches an organizer to this container. More... | |
auto | begin () |
Returns the begin iterator for the contained widgets. More... | |
auto | begin () const |
Returns the begin iterator for the contained widgets. More... | |
void | ChangeFocusOrder (Widget &widget, int order) |
Changes the focus order of the given widget. More... | |
void | ChangeZorder (Widget &widget, int order) |
Changes the z-order of the widget. More... | |
virtual bool | CharacterEvent (Char c) |
This function should be called whenever a character is received from operating system. More... | |
template<class O_ , class ... Args_> | |
O_ & | CreateOrganizer (Args_ &&... args) |
Creates a new organizer that lives with this container. More... | |
FocusStrategy | CurrentFocusStrategy () const |
Returns the active focus strategy. This function will not return Inherit. More... | |
void | Disable () |
Disables the container, disallowing interactions of all widgets in it. More... | |
void | DisableTabSwitch () |
Disable tab switching. More... | |
void | Displaced () |
Call this function if the container or widgets in it is moved without move function is called. More... | |
void | Enable () |
Enables the container, allowing interaction with the widgets in it. More... | |
void | EnableTabSwitch () |
Enable tab switching. More... | |
auto | end () |
Returns the end iterator for the contained widgets. More... | |
auto | end () const |
Returns the end iterator for the contained widgets. More... | |
bool | FocusFirst () |
Focuses the first widget that accepts focus. More... | |
bool | FocusLast () |
Focuses the last widget in the container. More... | |
bool | FocusNext () |
Focuses the next widget that accepts focus. More... | |
bool | FocusNext (const Widget &widget) |
Focuses the next widget that accepts focus starting from the given focus index. More... | |
bool | FocusNext (int after) |
Focuses the next widget that accepts focus starting from the given focus index. More... | |
bool | FocusPrevious () |
Focuses the previous widget that accepts focus. More... | |
bool | FocusPrevious (const Widget &widget) |
Focuses the previous widget that accepts focus. More... | |
bool | FocusPrevious (int before) |
Focuses the previous widget that accepts focus. More... | |
void | ForceRemove (Widget &widget) |
Forcefully removes the given widget from this container. More... | |
void | ForceRemoveFocus () |
Forcefully removes the focus from the focused widget. More... | |
virtual Widget & | GetCancel () const |
Returns the cancel element of the container which is called when the use presses escape key. More... | |
int | GetCount () const |
Returns the number of widgets in this container. More... | |
virtual Widget & | GetDefault () const |
Returns the default element of the container. More... | |
Widget & | GetFocus () const |
Returns the focused widget. More... | |
int | GetFocusOrder (const Widget &widget) const |
FocusStrategy | GetFocusStrategy () const |
Returns the focus strategy set to this container. More... | |
Organizers::Base & | GetOrganizer () const |
Returns the organizer controlling this container. More... | |
virtual bool | HasCancel () const |
Returns if this container has a cancel widget. More... | |
virtual bool | HasDefault () const |
Returns if this container has a default object. More... | |
bool | HasFocusedWidget () const |
Returns if this container has a focused widget. More... | |
bool | HasOrganizer () const |
Returns if this container has an organizer. More... | |
bool | Insert (Widget &widget, int index) |
Add the given widget to this container. More... | |
virtual bool | IsTabSwitchEnabled () const |
Check if tab switch is enabled. More... | |
WidgetContainer & | operator= (WidgetContainer &&)=default |
Widget & | operator[] (int ind) |
Returns the widget at the given index. More... | |
const Widget & | operator[] (int ind) const |
Returns the widget at the given index. More... | |
bool | Remove (Widget &widget) |
Removes the given widget from this container. More... | |
virtual void | RemoveCancel () |
Removes the cancel widget of this container. More... | |
virtual void | RemoveDefault () |
Removes the default widget of this container. More... | |
bool | RemoveFocus () |
Removes the focus from the focused widget. More... | |
void | RemoveOrganizer () |
Removes the organizer from this container. More... | |
virtual void | SetCancel (Widget &widget) |
Sets the cancel widget of the container. More... | |
virtual void | SetDefault (Widget &widget) |
Sets the default object of the container. More... | |
void | SetFocusStrategy (FocusStrategy value) |
Sets the focus strategy, see FocusStrategy. More... | |
bool | SetFocusTo (Widget &widget) |
Sets the focus to the given widget. More... | |
virtual void | SetTabSwitchEnabledState (bool state) |
Sets the state of tab switching. More... | |
void | ToggleEnabled () |
Toggles the enabled state of this container. More... | |
void | ToggleTabSwitchEnabledState () |
Toggles the state of tab switching. More... | |
Protected Attributes | |
bool | enabled |
Geometry::Point | location |
int | spacing |
const UI::Template & | temp |
![]() | |
int | columns |
T_ | current |
Containers::Hashmap< T_, Checkbox > | elements |
bool | own |
std::map< Checkbox *, T_ > | reverse |
Event< RadioControl, T_ > | ChangedEvent |
![]() | |
Containers::Collection< Widget > | widgets |
This container is sorted by the focus order. More... | |
Additional Inherited Members | |
![]() | |
Event< Widget > | BoundsChangedEvent |
This event will be fired when the area that the widget occupies on its container is changed. More... | |
std::string | dbgname |
Event< Widget > | FocusEvent |
This event will be fired when the widget receives or looses focus. More... | |
Geometry::PointProperty< Widget, &Widget::getlocation, &Widget::move > | Location |
Geometry::SizeProperty< Widget, &Widget::getsize, &Widget::resize > | Size |
![]() | |
enum | FocusStrategy { Inherit, AllowAll, Selective, Strict, Deny } |
Defines focus strategy for the container. Default is Inherit. More... | |
Allows the use of radio buttons working together.
This widget acts as a container for checkboxes that work together. Manually adding/removing widgets will fail. Attaching an organizer to this widget might cause unexpected behavior. All other container functionality should work as intended.
|
explicit |
|
explicit |
|
overridevirtual |
Activates the widget.
This might perform the action if the widget is a button, forward the focus if it is a label or focus if it is an input field.
Implements Widget.
void Add | ( | const T_ | value | ) |
References Gorgon::String::From().
void Add | ( | const T_ | value, |
std::string | text | ||
) |
References RadioControl< T_, CT_ >::Add(), Widget::boundschanged(), WidgetContainer::childboundschanged(), Hashmap< K_, T_, KeyFn, M_, C_ >::Delete(), RadioControl< T_, Checkbox >::elements, RadioControl< T_, Checkbox >::Exists(), WidgetContainer::ForceRemove(), RadioControl< T_, Checkbox >::Get(), RadioControl< T_, Checkbox >::GetColumns(), Widget::GetWidth(), RadioButtons< T_, W_ >::IsVisible(), RadioControl< T_, Checkbox >::PlaceIn(), Layer::SetHeight(), RadioButtons< T_, W_ >::spacing, RadioButtons< T_, W_ >::temp, and WidgetContainer::widgets.
|
overrideprotectedvirtual |
References RadioControl< T_, Checkbox >::elements.
|
overrideprotectedvirtual |
When called, widget should locate itself on to this layer.
Implements Widget.
References Layer::Add().
|
overrideprotectedvirtual |
Should return true if the widget can be focused.
Reimplemented from Widget.
References WidgetContainer::AllowAll, WidgetContainer::CurrentFocusStrategy(), Widget::GetParent(), and Widget::HasParent().
void ChangeValue | ( | const T_ & | before, |
const T_ & | after | ||
) |
Changes the value of the given element.
References Hashmap< K_, T_, KeyFn, M_, C_ >::Add(), Widget::boundschanged(), WidgetContainer::childboundschanged(), Hashmap< K_, T_, KeyFn, M_, C_ >::Delete(), RadioControl< T_, Checkbox >::elements, RadioControl< T_, Checkbox >::Exists(), WidgetContainer::ForceRemove(), RadioControl< T_, Checkbox >::Get(), RadioButtons< T_, W_ >::IsVisible(), RadioControl< T_, Checkbox >::PlaceIn(), Hashmap< K_, T_, KeyFn, M_, C_ >::Remove(), RadioControl< T_, Checkbox >::reverse, Layer::SetHeight(), RadioButtons< T_, W_ >::spacing, and WidgetContainer::widgets.
void Disable | ( | const T_ & | value | ) |
Disables the given element.
References RadioButtons< T_, W_ >::SetEnabled().
void Enable | ( | const T_ & | value | ) |
Enables the given element.
References RadioButtons< T_, W_ >::SetEnabled().
|
overridevirtual |
Ensures the widget is visible.
Returns true if the container can be scroll to make sure the given widget is visible. This function cannot be expected to take outside factors into account, such as occlusion. This function does not change the visibility of the widget and will return false if the widget is not visible.
Implements WidgetContainer.
References Widget::EnsureVisible().
|
overrideprotectedvirtual |
This is called after the focus is transferred to this widget.
Reimplemented from Widget.
References WidgetContainer::FocusFirst(), and WidgetContainer::HasFocusedWidget().
|
overridevirtual |
Should return the interior (usable) size of the container.
Implements WidgetContainer.
References RadioButtons< T_, W_ >::GetSize().
|
overrideprotectedvirtual |
Returns the layer that will be used to place the contained widgets.
Implements WidgetContainer.
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
Returns whether the widget is enabled.
Implements Widget.
References RadioButtons< T_, W_ >::enabled.
bool IsEnabled | ( | const T_ & | value | ) | const |
Returns if given element is enabled.
Returns false if the element is not found.
References RadioControl< T_, Checkbox >::elements.
|
overridevirtual |
Should return whether the container is visible.
Due to different container designs and capabilities, setting visibility depends on the particular container
Implements WidgetContainer.
References Layer::IsVisible().
|
overridevirtual |
This function should be called whenever a key is pressed or released.
Reimplemented from Widget.
References WidgetContainer::KeyEvent().
|
overridevirtual |
Moves this widget to the given position.
Implements Widget.
References RadioButtons< T_, W_ >::location, and Layer::Move().
RadioButtons& 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.
References RadioControl< T_, Checkbox >::Set().
|
overrideprotectedvirtual |
This function is called when the parent's enabled state changes.
Reimplemented from Widget.
References WidgetContainer::distributeparentenabled(), and RadioButtons< T_, W_ >::IsEnabled().
|
protected |
|
overrideprotectedvirtual |
When called, widget should remove itself from the given layer.
Implements Widget.
References Layer::Remove().
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
This function will return a container that will act as an extender.
Implements WidgetContainer.
References ExtenderRequestResponse::CoordinatesInExtender, RadioButtons< T_, W_ >::GetLocation(), Widget::GetParent(), Widget::HasParent(), and WidgetContainer::RequestExtender().
|
overridevirtual |
Radio buttons height is automatically adjusted. Only width will be used.
Implements Widget.
References RadioControl< T_, Checkbox >::elements, RadioControl< T_, Checkbox >::GetColumns(), Widget::GetWidth(), Layer::SetWidth(), RadioButtons< T_, W_ >::spacing, and basic_Size< T_ >::Width.
|
overridevirtual |
Should resize the interior (usable) size of the container.
If resize operation cannot set the size exactly to the requested size, this function returns false.
Implements WidgetContainer.
References RadioButtons< T_, W_ >::GetSize(), and RadioButtons< T_, W_ >::Resize().
void SetColumns | ( | int | value | ) |
Changes the number of columns.
References RadioButtons< T_, W_ >::rearrange(), and RadioControl< T_, CT_ >::SetColumns().
|
overridevirtual |
Sets the enabled state of the widget.
Implements Widget.
References WidgetContainer::distributeparentenabled(), RadioButtons< T_, W_ >::enabled, WidgetContainer::FocusNext(), WidgetContainer::ForceRemoveFocus(), Widget::GetParent(), Widget::HasParent(), and Widget::IsFocused().
void SetEnabled | ( | const T_ & | value, |
bool | state | ||
) |
Sets the enabled state the given element.
References RadioControl< T_, Checkbox >::elements.
|
overrideprotectedvirtual |
When called, widget should reorder itself in layer hierarchy.
Implements Widget.
References Layer::PlaceBefore().
void SetSpacing | ( | int | value | ) |
References RadioButtons< T_, W_ >::rearrange(), and RadioButtons< T_, W_ >::spacing.
void ToggleEnabled | ( | const T_ & | value | ) |
Toggles enabled state of the given element.
References RadioButtons< T_, W_ >::IsEnabled(), and RadioButtons< T_, W_ >::SetEnabled().
|
protected |
|
protected |
|
protected |
|
protected |