Gorgon Game Engine
DropdownBase< T_, TW_, L_ > Class Template Reference

This is the dropdown base for all dropdown lists, including ones that are not for item selection (e.g., DropdownChecklist). More...

Inheritance diagram for DropdownBase< T_, TW_, L_ >:
[legend]

Public Types

using ListType = L_
 

Public Member Functions

template<class ... A_>
 DropdownBase (A_ &&... elms, Registry::TemplateType type=Registry::Dropdown_Regular)
 
 DropdownBase (const UI::Template &temp)
 
template<class ... A_>
 DropdownBase (const UI::Template &temp, A_ &&... elms)
 
 DropdownBase (Registry::TemplateType type=Registry::Dropdown_Regular)
 
void Close ()
 Closes the list. More...
 
bool IsOpened () const
 Returns whether the dropdown is opened. More...
 
bool IsReversed () const
 Retuns if the list will be opened above the dropdown instead of below. More...
 
void Open ()
 Opens the list. More...
 
virtual void Refresh ()
 Refreshes the dropdown. More...
 
void Toggle ()
 Toggles open/close state of the dropdown. More...
 
- Public Member Functions inherited from ComponentStackWidget
 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...
 
- Public Member Functions inherited from Widget
 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...
 
WidgetContainerGetParent () 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...
 

Public Attributes

ListType::ListBase & List
 
- Public Attributes inherited from Widget
Event< WidgetBoundsChangedEvent
 This event will be fired when the area that the widget occupies on its container is changed. More...
 
std::string dbgname
 
Event< WidgetFocusEvent
 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
 

Protected Member Functions

virtual void boundschanged () override
 Call this function when the widget bounds is changed. More...
 
void checkfocus ()
 
virtual void displaced () override
 Call this function when the widget container causes it to be displaced. More...
 
- Protected Member Functions inherited from ComponentStackWidget
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...
 
- Protected Member Functions inherited from Widget
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 canloosefocus () const
 Should return true if the widget can loose the focus right now. More...
 
virtual bool removingfrom ()
 Called before this widget is removed from its parent. More...
 
- Protected Member Functions inherited from ListItem
virtual bool allowfocus () const override
 Should return true if the widget can be focused. More...
 
 ListItem (const UI::Template &temp)
 Constructor requires template. ListItem. More...
 
virtual bool Activate () override
 Activates the widget. More...
 
const Graphics::AnimationGetIcon () const
 Returns the icon on the label. More...
 
int GetIndex () const
 Returns the index of the Item in the Listbox. More...
 
YesNoUnset GetOpened () const
 Returns whether the item is opened and displaying subitems. More...
 
Parity GetParity () const
 Returns the odd/even parity. More...
 
ItemPosition GetPosition () const
 Returns the position of this item in the list. This is not automated. More...
 
bool GetSelected () const
 Return selection status. More...
 
std::string GetText () const
 Returns the currently displayed text. More...
 
bool HasIcon () const
 Returns if the label has an icon. More...
 
void OwnIcon ()
 Transfers the ownership of the current icon. More...
 
void OwnIcon (const Graphics::Animation &value)
 Sets the icon while transferring the ownership. More...
 
void OwnIcon (Graphics::Bitmap &&value)
 Moves the given animation to the icon of the label. More...
 
void RemoveIcon ()
 Removes the icon on the label. More...
 
void SetIcon (const Graphics::Animation &value)
 Changes the icon on the label. More...
 
void SetIcon (const Graphics::Bitmap &value)
 Changes the icon on the label. More...
 
void SetIconProvider (const Graphics::AnimationProvider &value)
 Changes the icon on the label. More...
 
void SetIconProvider (Graphics::AnimationProvider &&provider)
 Changes the icon on the label. More...
 
void SetIndex (long value)
 Sets the index of the ListItem in the Listbox. More...
 
void SetOpened (YesNoUnset value)
 Sets whether the item is opened and displaying subitems. More...
 
void SetParity (Parity value)
 Set odd/even parity of the widget. More...
 
void SetPosition (ItemPosition value)
 Sets the position of this item in the list. More...
 
void SetSelected (bool value)
 Sets selection status of the widget. More...
 
void SetText (const std::string &value)
 Changes the text displayed. More...
 

Protected Attributes

ListType list
 
bool opened
 
bool refresh
 
- Protected Attributes inherited from ComponentStackWidget
bool enabled
 
bool parentenabled
 
ComponentStackstack
 
- Protected Attributes inherited from ListItem
Event< ListItemClickEvent
 Fired when the item is clicked. This includes clicks to toggle area. More...
 
Event< ListItemToggleEvent
 If template has a ToggleTag, this will be raised only if that component is clicked. More...
 

Detailed Description

template<class T_, void(*)(const T_ &, ListItem &) TW_, class L_>
class Gorgon::Widgets::DropdownBase< T_, TW_, L_ >

This is the dropdown base for all dropdown lists, including ones that are not for item selection (e.g., DropdownChecklist).

Member Typedef Documentation

◆ ListType

using ListType = L_

Constructor & Destructor Documentation

◆ DropdownBase() [1/4]

◆ DropdownBase() [2/4]

◆ DropdownBase() [3/4]

DropdownBase ( const UI::Template temp)
explicit

◆ DropdownBase() [4/4]

DropdownBase ( const UI::Template temp,
A_ &&...  elms 
)
explicit

Member Function Documentation

◆ boundschanged()

virtual void boundschanged ( )
overrideprotectedvirtual

Call this function when the widget bounds is changed.

Reimplemented from Widget.

References DropdownBase< T_, TW_, L_ >::Close().

◆ checkfocus()

void checkfocus ( )
protected

◆ Close()

◆ displaced()

virtual void displaced ( )
overrideprotectedvirtual

Call this function when the widget container causes it to be displaced.

This function will not be called when the widget is moved on parent.

Reimplemented from Widget.

References DropdownBase< T_, TW_, L_ >::Close().

◆ IsOpened()

bool IsOpened ( ) const

Returns whether the dropdown is opened.

References DropdownBase< T_, TW_, L_ >::opened.

◆ IsReversed()

bool IsReversed ( ) const

Retuns if the list will be opened above the dropdown instead of below.

This can happen if there is not enough space below.

References Gorgon::Utils::NotImplemented().

◆ Open()

◆ Refresh()

virtual void Refresh ( )
virtual

Refreshes the dropdown.

Normally this is not required unless references of the data contained within the list is updated without any modification to the dropdown. This is intended to be overloaded.

Reimplemented in SingleSelectionDropdown< T_, TW_, L_ >.

References DropdownBase< T_, TW_, L_ >::list, DropdownBase< T_, TW_, L_ >::opened, and DropdownBase< T_, TW_, L_ >::refresh.

◆ Toggle()

void Toggle ( )

Member Data Documentation

◆ list

ListType list
protected

◆ List

ListType::ListBase& List

◆ opened

bool opened
protected

◆ refresh

bool refresh
protected

The documentation for this class was generated from the following file: