API Documentation
ListBox.h
1 // ListBox.h
3 //
5 
6 namespace nkWinUi
7 {
11  class ListBox : public Component
12  {
13  public :
14 
18  class Item
19  {
20  public :
21 
25  Item () noexcept ;
29  ~Item () ;
30 
31  // Getters
35  ListBox* getParentList () const ;
39  nkMemory::StringView getLabel () const ;
43  void* getAttachedData () const ;
44 
45  // Setters
51  void setParentList (ListBox* parent) ;
57  void setLabel (nkMemory::StringView label) ;
65  void setAttachedData (void* data) ;
66  } ;
67 
68  public :
69 
77  ListBox (System* system) noexcept ;
81  ListBox (const ListBox&) = delete ;
85  virtual ~ListBox () ;
86 
87  // Getters
92  Item* getItemFromLabel (nkMemory::StringView label) const ;
97  Item* getItemFromData (void* data) const ;
102  Item* getItemFromIndex (unsigned int index) const ;
106  virtual Item* getCurrentSelection () const ;
110  virtual int getCurrentSelectionIndex () const ;
114  std::function<void (ListBox*)> getSelectionCallback () const ;
118  unsigned int getItemCount () const ;
119 
120  // Setters
126  void setSelectionCallback (std::function<void (ListBox*)> value) ;
127 
137  virtual Item* insertItem (nkMemory::StringView text, void* data) ;
143  virtual void* deleteItem (nkMemory::StringView name) ;
150  virtual void changeItemLabel (nkMemory::StringView oldText, nkMemory::StringView newText) ;
159  void changeItemData (nkMemory::StringView text, void* newData) ;
166  virtual bool setSelected (nkMemory::StringView text) ;
173  virtual bool setSelectedIndex (unsigned int index) ;
180  bool setSelectedData (void* data) ;
184  virtual void clearItems () ;
185 
186  // Import / Export
187  virtual void exportIntrospection (nkExport::Node* rootNode) override ;
188  virtual void importClassFromTree (nkExport::Node* rootNode) override ;
189 
190  // Operators
194  ListBox& operator= (const ListBox&) = delete ;
195 
196  public :
197 
198  // Statics
206  static nkMemory::UniquePtr<ListBox> create (System* system = nullptr) ;
207  } ;
208 }
nkWinUi::ListBox::setSelectionCallback
void setSelectionCallback(std::function< void(ListBox *)> value)
nkWinUi::ListBox::Item::setAttachedData
void setAttachedData(void *data)
nkWinUi::ListBox::Item::Item
Item() noexcept
nkWinUi::ListBox::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkWinUi::ListBox::getItemCount
unsigned int getItemCount() const
nkWinUi::ListBox::insertItem
virtual Item * insertItem(nkMemory::StringView text, void *data)
nkWinUi::ListBox::getCurrentSelection
virtual Item * getCurrentSelection() const
nkWinUi::ListBox
A graphical list box.
Definition: ListBox.h:12
nkWinUi::ListBox::getItemFromIndex
Item * getItemFromIndex(unsigned int index) const
nkWinUi::ListBox::setSelected
virtual bool setSelected(nkMemory::StringView text)
nkWinUi::ListBox::create
static nkMemory::UniquePtr< ListBox > create(System *system=nullptr)
nkWinUi::ListBox::setSelectedIndex
virtual bool setSelectedIndex(unsigned int index)
nkWinUi::ListBox::setSelectedData
bool setSelectedData(void *data)
nkWinUi::ListBox::Item
Definition: ListBox.h:19
nkWinUi::ListBox::exportIntrospection
virtual void exportIntrospection(nkExport::Node *rootNode) override
nkExport
Encompasses all API of component NilkinsExport.
Definition: Base64Encoder.h:7
nkWinUi::Component
Base class for any graphical component.
Definition: Component.h:12
nkWinUi::System
The main system of the component.
Definition: System.h:18
nkWinUi::ListBox::getSelectionCallback
std::function< void(ListBox *)> getSelectionCallback() const
nkWinUi::ListBox::Item::getParentList
ListBox * getParentList() const
nkWinUi::ListBox::changeItemLabel
virtual void changeItemLabel(nkMemory::StringView oldText, nkMemory::StringView newText)
nkWinUi::ListBox::Item::getLabel
nkMemory::StringView getLabel() const
nkWinUi::ListBox::changeItemData
void changeItemData(nkMemory::StringView text, void *newData)
nkWinUi::ListBox::clearItems
virtual void clearItems()
nkWinUi::ListBox::getCurrentSelectionIndex
virtual int getCurrentSelectionIndex() const
nkWinUi::ListBox::getItemFromLabel
Item * getItemFromLabel(nkMemory::StringView label) const
nkWinUi::ListBox::Item::setParentList
void setParentList(ListBox *parent)
nkWinUi::ListBox::Item::setLabel
void setLabel(nkMemory::StringView label)
nkWinUi::ListBox::deleteItem
virtual void * deleteItem(nkMemory::StringView name)
nkWinUi::ListBox::Item::getAttachedData
void * getAttachedData() const
nkWinUi
Encompasses all API of component NilkinsWinUi.
Definition: Clipboard.h:7
nkWinUi::ListBox::getItemFromData
Item * getItemFromData(void *data) const
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7