![]() |
Gorgon Game Engine
|
This class acts as a widget base that uses component stack to handle rendering, resizing and other operations. More...
Public Member Functions | |
ComponentStackWidget (ComponentStackWidget &&)=default | |
ComponentStackWidget (const Template &temp, std::map< ComponentTemplate::Tag, std::function< Widget *(const Template &)>> generators={}) | |
virtual | ~ComponentStackWidget () |
virtual Geometry::Point | GetLocation () const override |
Returns the location of the widget. More... | |
virtual Geometry::Size | GetSize () const override |
Returns the size of the widget. More... | |
virtual bool | IsEnabled () const override |
Returns whether the widget is enabled. More... | |
virtual void | Move (const Geometry::Point &location) override |
Moves this widget to the given position. More... | |
virtual void | Move (const Geometry::Point &location)=0 |
Moves this widget to the given position. More... | |
void | Move (int x, int y) |
Moves this widget to the given position. More... | |
virtual void | Resize (const Geometry::Size &size) override |
Changes the size of the widget. More... | |
virtual void | Resize (const Geometry::Size &size)=0 |
Changes the size of the widget. More... | |
virtual void | Resize (int w, int h) |
Changes the size of the widget. More... | |
virtual void | SetEnabled (bool value) override |
Sets the enabled state of the widget. More... | |
![]() | |
Widget () | |
Widget (Widget &&)=default | |
virtual | ~Widget () |
virtual bool | Activate ()=0 |
Activates the widget. More... | |
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... | |
virtual bool | KeyEvent (Input::Key, float) |
This function should be called whenever a key is pressed or released. 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 void | addto (Layer &layer) override |
When called, widget should locate itself on to this layer. More... | |
virtual void | focused () override |
This is called after the focus is transferred to this widget. More... | |
virtual void | focuslost () override |
This is called after the focus is lost. More... | |
virtual void | parentenabledchanged (bool state) override |
This function is called when the parent's enabled state changes. More... | |
virtual void | removed () override |
Called after this widget is removed from its parent. More... | |
virtual void | removefrom (Layer &layer) override |
When called, widget should remove itself from the given layer. 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 bool | allowfocus () const |
Should return true if the widget can be focused. 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 bool | removingfrom () |
Called before this widget is removed from its parent. More... | |
Protected Attributes | |
bool | enabled |
bool | parentenabled |
ComponentStack & | stack |
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 |
This class acts as a widget base that uses component stack to handle rendering, resizing and other operations.
ComponentStackWidget | ( | const Template & | temp, |
std::map< ComponentTemplate::Tag, std::function< Widget *(const Template &)>> | generators = {} |
||
) |
|
default |
|
virtual |
References ComponentStackWidget::stack.
|
overrideprotectedvirtual |
When called, widget should locate itself on to this layer.
Implements Widget.
References Layer::Add(), and ComponentStackWidget::stack.
|
overrideprotectedvirtual |
This is called after the focus is transferred to this widget.
Reimplemented from Widget.
Reimplemented in Panel, ListboxWidgetBase< T_, W_, TRF_, STR_, SELTR_, useisvisible, TW_ >, ListboxWidgetBase< T_, ListItem, internal::LBTRF_ListItem< T_, ListItem, MultiCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSTR_Collection< T_, ListItem, MultiCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSELTR_Multi< T_, ListItem, MultiCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, false, internal::SetTextUsingFrom< T_, ListItem > >, ListboxWidgetBase< T_, ListItem, internal::LBTRF_ListItem< T_, ListItem, SimpleListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSTR_STLVector< T_, ListItem, std::vector< T_ >, SimpleListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSELTR_Single< T_, ListItem, SimpleListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, false, internal::SetTextUsingFrom< T_, ListItem > >, ListboxWidgetBase< T_, ListItem, internal::LBTRF_ListItem< T_, ListItem, MultiListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSTR_STLVector< T_, ListItem, std::vector< T_ >, MultiListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSELTR_Multi< T_, ListItem, MultiListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, false, internal::SetTextUsingFrom< T_, ListItem > >, and ListboxWidgetBase< T_, ListItem, internal::LBTRF_ListItem< T_, ListItem, SimpleCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSTR_Collection< T_, ListItem, SimpleCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSELTR_Single< T_, ListItem, SimpleCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, false, internal::SetTextUsingFrom< T_, ListItem > >.
References ComponentStack::AddCondition(), Gorgon::UI::Focused, Widget::focused(), Widget::FocusEvent, and ComponentStackWidget::stack.
|
overrideprotectedvirtual |
This is called after the focus is lost.
This is called even if focus removal is forced.
Reimplemented from Widget.
Reimplemented in Panel, ListboxWidgetBase< T_, W_, TRF_, STR_, SELTR_, useisvisible, TW_ >, ListboxWidgetBase< T_, ListItem, internal::LBTRF_ListItem< T_, ListItem, MultiCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSTR_Collection< T_, ListItem, MultiCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSELTR_Multi< T_, ListItem, MultiCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, false, internal::SetTextUsingFrom< T_, ListItem > >, ListboxWidgetBase< T_, ListItem, internal::LBTRF_ListItem< T_, ListItem, SimpleListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSTR_STLVector< T_, ListItem, std::vector< T_ >, SimpleListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSELTR_Single< T_, ListItem, SimpleListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, false, internal::SetTextUsingFrom< T_, ListItem > >, ListboxWidgetBase< T_, ListItem, internal::LBTRF_ListItem< T_, ListItem, MultiListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSTR_STLVector< T_, ListItem, std::vector< T_ >, MultiListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSELTR_Multi< T_, ListItem, MultiListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, false, internal::SetTextUsingFrom< T_, ListItem > >, and ListboxWidgetBase< T_, ListItem, internal::LBTRF_ListItem< T_, ListItem, SimpleCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSTR_Collection< T_, ListItem, SimpleCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, internal::LBSELTR_Single< T_, ListItem, SimpleCollectionbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >, false, internal::SetTextUsingFrom< T_, ListItem > >.
References Gorgon::UI::Focused, Widget::FocusEvent, Widget::focuslost(), ComponentStack::RemoveCondition(), and ComponentStackWidget::stack.
|
overridevirtual |
Returns the location of the widget.
Implements Widget.
References Layer::GetLocation(), and ComponentStackWidget::stack.
|
overridevirtual |
Returns the size of the widget.
Implements Widget.
References Layer::GetSize(), and ComponentStackWidget::stack.
|
overridevirtual |
Returns whether the widget is enabled.
Implements Widget.
Reimplemented in Panel.
References ComponentStackWidget::enabled.
|
overridevirtual |
Moves this widget to the given position.
Implements Widget.
Reimplemented in Panel.
References Widget::boundschanged(), Widget::HasParent(), Widget::IsVisible(), Layer::Move(), and ComponentStackWidget::stack.
virtual void Move |
Moves this widget to the given position.
void Move |
Moves this widget to the given position.
References Widget::Move().
|
overrideprotectedvirtual |
This function is called when the parent's enabled state changes.
Reimplemented from Widget.
Reimplemented in Panel.
References ComponentStack::AddCondition(), Gorgon::UI::Disabled, ComponentStackWidget::enabled, ComponentStackWidget::parentenabled, ComponentStack::RemoveCondition(), and ComponentStackWidget::stack.
|
overrideprotectedvirtual |
Called after this widget is removed from its parent.
Reimplemented from Widget.
References ComponentStack::FinalizeTransitions(), Widget::removed(), and ComponentStackWidget::stack.
|
overrideprotectedvirtual |
When called, widget should remove itself from the given layer.
Implements Widget.
References Layer::Remove(), and ComponentStackWidget::stack.
|
overridevirtual |
Changes the size of the widget.
Implements Widget.
Reimplemented in Panel.
References Widget::boundschanged(), Widget::HasParent(), Widget::IsVisible(), ComponentStack::Resize(), and ComponentStackWidget::stack.
virtual void Resize |
Changes the size of the widget.
virtual void Resize |
Changes the size of the widget.
References Widget::Resize().
|
overridevirtual |
Sets the enabled state of the widget.
Implements Widget.
Reimplemented in Panel.
References ComponentStack::AddCondition(), Gorgon::UI::Disabled, ComponentStackWidget::enabled, WidgetContainer::FocusNext(), WidgetContainer::ForceRemoveFocus(), Widget::GetParent(), Widget::HasParent(), ComponentStackWidget::IsEnabled(), Widget::IsFocused(), ComponentStack::RemoveCondition(), and ComponentStackWidget::stack.
|
overrideprotectedvirtual |
When called, widget should reorder itself in layer hierarchy.
Implements Widget.
References Layer::PlaceBefore(), and ComponentStackWidget::stack.
|
protected |
|
protected |
|
protected |