Hasty Badger
Small UI library (a branch of Turbo Badger)
|
TBSelectItemSourceList is a item provider for list widgets (TBSelectList and TBSelectDropdown). More...
#include <tb_select_item.h>
Public Member Functions | |
TBOBJECT_SUBCLASS (TBSelectItemSourceList, TBSelectItemSource) | |
virtual const TBStr & | GetItemString (int index) const |
Get the string of a item. More... | |
virtual TBSelectItemSource * | GetItemSubSource (int index) |
Get the source to be used if this item should open a sub menu. More... | |
virtual TBID | GetItemImage (int index) const |
Get the skin image to be painted before the text for this item. More... | |
virtual TBID | GetItemID (int index) const |
Get the id of the item. More... | |
virtual int | GetNumItems () const |
Get the number of items. | |
virtual TBWidget * | CreateItemWidget (int index, TBSelectItemViewer *viewer) |
Create the item representation widget(s). More... | |
bool | AddItem (T *item, int index) |
Add a new item at the given index. More... | |
bool | AddItem (T *item) |
Add a new item last. More... | |
T * | GetItem (int index) |
Get the item at the given index. More... | |
const T * | GetItem (int index) const |
Get the item at the given index. More... | |
T * | FindItemByID (TBID id) |
Get the item at the given index. More... | |
const T * | FindItemByID (TBID id) const |
Get the item at the given index. More... | |
void | DeleteItem (int index) |
Delete the item at the given index. More... | |
void | DeleteAllItems () |
Delete all items. More... | |
Public Member Functions inherited from tb::TBSelectItemSource | |
TBOBJECT_SUBCLASS (TBSelectItemSource, TBTypedObject) | |
virtual bool | Filter (int index, const TBStr &filter) |
Return true if an item matches the given filter text. More... | |
virtual int | FindIDIndex (TBID id) const |
Get the index of the first item having this id or -1 if not found. | |
void | SetSort (TB_SORT sort) |
Set sort type. More... | |
TB_SORT | GetSort () const |
void | InvokeItemChanged (int index, TBSelectItemViewer *exclude_viewer=nullptr) |
Invoke OnItemChanged on all open viewers for this source. More... | |
void | InvokeItemAdded (int index) |
void | InvokeItemRemoved (int index) |
void | InvokeAllItemsRemoved () |
Public Member Functions inherited from tb::TBTypedObject | |
virtual bool | IsOfTypeId (const TB_TYPE_ID type_id) const |
Returns true if the class or the base class matches the type id. | |
template<class T > | |
T * | SafeCastTo () const |
Returns this object as the given type or nullptr if it's not that type. More... | |
template<class T > | |
bool | IsOfType () const |
Return true if this object can safely be casted to the given type. More... | |
virtual const char * | GetClassName () const |
Get the classname of the object. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from tb::TBTypedObject | |
template<class T > | |
static TB_TYPE_ID | GetTypeId () |
A static template method that returns a unique id for each type. More... | |
TBSelectItemSourceList is a item provider for list widgets (TBSelectList and TBSelectDropdown).
It stores items of the type specified by the template in an array.
|
inline |
Add a new item at the given index.
|
inline |
Add a new item last.
|
inlinevirtual |
Create the item representation widget(s).
By default, it will create a TBTextField for string-only items, and other types for items that also has image or submenu.
Reimplemented from tb::TBSelectItemSource.
|
inline |
Delete all items.
|
inline |
Delete the item at the given index.
|
inline |
Get the item at the given index.
|
inline |
Get the item at the given index.
|
inline |
Get the item at the given index.
|
inline |
Get the item at the given index.
|
inlinevirtual |
Get the id of the item.
Reimplemented from tb::TBSelectItemSource.
|
inlinevirtual |
Get the skin image to be painted before the text for this item.
Reimplemented from tb::TBSelectItemSource.
|
inlinevirtual |
Get the string of a item.
If a item has more than one string, return the one that should be used for inline-find (pressing keys in the list will scroll to the item starting with the same letters), and for sorting the list.
Implements tb::TBSelectItemSource.
|
inlinevirtual |
Get the source to be used if this item should open a sub menu.
Reimplemented from tb::TBSelectItemSource.