Gorgon Game Engine
MultiListbox< T_, TW_ > Class Template Reference

This is a simple multi select listbox. More...

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

Public Member Functions

 MultiListbox (const UI::Template &temp)
 
 MultiListbox (Registry::TemplateType temp=Registry::Listbox_Regular)
 
virtual bool Activate ()
 Activates the widget. More...
 
MultiListboxoperator= (const T_ value)
 
- Public Member Functions inherited from 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 > >
void DisableSmoothScroll ()
 Disables smooth scrolling of the panel. More...
 
void EnsureVisible (long index)
 Ensures the given index is completely visible on the screen. More...
 
bool FitHeight (int maxpixels)
 This function will try to set the height of the listbox to contain all its elements. More...
 
Geometry::Size GetInteriorSize () const
 
float GetMaximumDisplayedElements () const
 This may not be a perfect number. More...
 
float GetOverscroll () const
 Returns the amount of extra scrolling distance after the bottom-most widget is completely visible in pixels. More...
 
int GetScrollDistance () const
 Returns the scroll distance per click. More...
 
int GetSmoothScrollSpeed () const
 Returns the smooth scrolling speed of the panel. More...
 
bool IsSmoothScrollEnabled () const
 Returns if the smooth scroll is enabled. More...
 
bool KeyEvent (Input::Key key, float state) override
 This function should be called whenever a key is pressed or released. More...
 
virtual void Refresh () override
 This function should refresh the contents of the listbox. More...
 
void ScrollBy (float y)
 Scrolls the contents an additional amount of items. More...
 
float ScrollOffset () const
 Returns the current scroll offset. More...
 
void ScrollTo (float y)
 Scrolls the contents of the listbox so that the it will start displaying items from the given location in list items. More...
 
void SetOverscroll (float value)
 Sets the amount of extra scrolling distance after the bottom-most widget is completely visible in pixels. More...
 
void SetScrollDistance (int vert)
 Sets the horizontal scroll distance per click in pixels. More...
 
void SetSmoothScrollSpeed (int value)
 Adjusts the smooth scrolling speed of the panel. 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...
 
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 Member Functions inherited from ListboxBase< 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 > > >, useisvisible, TW_ >
virtual long GetCount () const override
 Returns the number of elements in the list. More...
 
virtual const T_ & operator[] (long index) const override
 Returns the item at the given point. More...
 
virtual T_ & operator[] (long index) override
 Returns the item at the given point. More...
 
- Public Member Functions inherited from ListBase< T_, ListItem >
virtual ~ListBase ()
 

Additional Inherited Members

- Public Types inherited from 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 > >
using ListBase = ListboxBase< 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 > > >, useisvisible, TW_ >
 
- Public Types inherited from ListboxBase< 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 > > >, useisvisible, TW_ >
using SelectionType = internal::LBSELTR_Multi< T_, ListItem, MultiListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >
 
using StorageType = internal::LBSTR_STLVector< T_, ListItem, std::vector< T_ >, MultiListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >
 
using TypeTraits = internal::LBTRF_ListItem< T_, ListItem, MultiListbox< T_, internal::SetTextUsingFrom< T_, ListItem > > >
 
- 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 inherited from 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 > >
 ListboxWidgetBase (const UI::Template &temp)
 
 ~ListboxWidgetBase ()
 
virtual void boundschanged () override
 Call this function when the widget bounds is changed. More...
 
UI::Widgetcreatevscroll (const UI::Template &temp)
 
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 long getindex (const ListItem &widget) override
 For internal use. More...
 
virtual ListItemgetrepresentation () override
 For internal use. More...
 
virtual ListItemgetrepresentation (long index) override
 For internal use. More...
 
ListItemgetwidget (UI::ComponentTemplate::Tag tag, int order)
 
void updatescroll ()
 
- 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 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 allowfocus () const
 Should return true if the widget can be focused. 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 Member Functions inherited from ListboxBase< 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 > > >, useisvisible, TW_ >
 ListboxBase ()
 
- Protected Attributes inherited from 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 > >
UI::LayerAdapter contents
 
std::map< const ListItem *, long > indexes
 
bool isscrolling
 
float maxdisplay
 
float overscroll
 
Input::KeyRepeater repeater
 
int scrolldist
 
float scrolloffset
 
int scrollspeed
 
float target
 
std::map< long, ListItem * > widgetlist
 
std::map< UI::ComponentTemplate::Tag, Containers::Collection< ListItem > > widgets
 
- Protected Attributes inherited from ComponentStackWidget
bool enabled
 
bool parentenabled
 
ComponentStackstack
 

Detailed Description

template<class T_, void(*)(const T_ &, ListItem &) TW_ = internal::SetTextUsingFrom<T_, ListItem>>
class Gorgon::Widgets::MultiListbox< T_, TW_ >

This is a simple multi select listbox.

It does not store any additional information about each item, therefore, can store large amounts of items. However, default event strategy is triggering the event for every selected and unselected item. This might cause problems if the list is too long. When the event method is set to single, only one event will be called for single action. Items are stored in an std::vector. You may use Selection and SelectedIndices to iterate selected elements. In both members, selection is always sorted by the position in the listbox.

Constructor & Destructor Documentation

◆ MultiListbox() [1/2]

◆ MultiListbox() [2/2]

MultiListbox ( const UI::Template temp)
explicit

Member Function Documentation

◆ Activate()

virtual bool Activate ( )
virtual

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.

◆ operator=()

MultiListbox& operator= ( const T_  value)

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