![]() |
Gorgon Game Engine
|
This class turns a layer into a widget container. More...
Public Member Functions | |
LayerAdapter () | |
This constructor will leave the LayerAdapter in an invalid state. More... | |
LayerAdapter (Layer &base) | |
Constructor requires the base layer. More... | |
virtual bool | EnsureVisible (const Gorgon::UI::Widget &widget) override |
Ensures the widget is visible. More... | |
virtual Geometry::Size | GetInteriorSize () const override |
Should return the interior (usable) size of the container. More... | |
Gorgon::Layer & | GetLayer () const |
bool | IsReady () const |
virtual bool | IsVisible () const override |
Should return whether the container is visible. More... | |
virtual ExtenderRequestResponse | RequestExtender (const Gorgon::Layer &self) override |
This function will return a container that will act as an extender. More... | |
virtual bool | ResizeInterior (Geometry::Size size) override |
Should resize the interior (usable) size of the container. More... | |
void | SetLayer (Gorgon::Layer &value) |
![]() | |
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 | IsEnabled () const |
Returns whether container is enabled. More... | |
virtual bool | IsTabSwitchEnabled () const |
Check if tab switch is enabled. More... | |
virtual bool | KeyEvent (Input::Key key, float state) |
This function should be called whenever a key is pressed or released. 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... | |
virtual void | SetEnabled (bool value) |
Sets the enabled state of this 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 Member Functions | |
virtual Gorgon::Layer & | getlayer () override |
Returns the layer that will be used to place the contained 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... | |
virtual void | focuschanged () |
This function is called when the focus is changed. More... | |
virtual FocusStrategy | getparentfocusstrategy () const |
If this widget is not top level, return the current strategy used by the parent. 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... | |
Protected Attributes | |
Layer * | base |
![]() | |
Containers::Collection< Widget > | widgets |
This container is sorted by the focus order. More... | |
Additional Inherited Members | |
![]() | |
enum | FocusStrategy { Inherit, AllowAll, Selective, Strict, Deny } |
Defines focus strategy for the container. Default is Inherit. More... | |
This class turns a layer into a widget container.
This class does not receive keyboard events automatically. Default focus strategy of LayerAdapter is Deny.
LayerAdapter | ( | ) |
This constructor will leave the LayerAdapter in an invalid state.
You must use SetLayer before calling any other functions.
LayerAdapter | ( | Layer & | base | ) |
Constructor requires the base layer.
References WidgetContainer::Deny, and WidgetContainer::SetFocusStrategy().
|
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.
|
overridevirtual |
Should return the interior (usable) size of the container.
Implements WidgetContainer.
References LayerAdapter::base, and Layer::GetCalculatedSize().
Gorgon::Layer& GetLayer | ( | ) | const |
References LayerAdapter::base.
|
overrideprotectedvirtual |
Returns the layer that will be used to place the contained widgets.
Implements WidgetContainer.
References LayerAdapter::base.
bool IsReady | ( | ) | const |
References LayerAdapter::base.
|
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 LayerAdapter::base, and Layer::IsVisible().
|
overridevirtual |
This function will return a container that will act as an extender.
Implements WidgetContainer.
References LayerAdapter::GetInteriorSize(), and Window::RequestExtender().
|
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 LayerAdapter::base, and Layer::Resize().
void SetLayer | ( | Gorgon::Layer & | value | ) |
References LayerAdapter::base.
|
protected |