API Documentation
ToolBar.h
1 // ToolBar.h
3 //
5 
6 namespace nkWinUi
7 {
13  class ToolBar : public Component
14  {
15  public :
16 
17  // Item
21  class Item
22  {
23  public :
24 
25  // Constructor, destructor
31  Item () noexcept ;
35  virtual ~Item () ;
36 
37  // Getters
41  virtual nkMemory::StringView getLabel () const = 0 ;
48  virtual std::function<void ()> getCallback () const = 0 ;
54  virtual ContextMenu* getContextMenu () const = 0 ;
55  } ;
56 
57  public :
58 
59  // Constructor, destructor
67  ToolBar (System* system) noexcept ;
71  virtual ~ToolBar () ;
72 
73  // Getters
78  virtual Item* getItem (unsigned int index) const = 0 ;
82  virtual unsigned int getItemCount () const = 0 ;
83 
84  // Setters
90  void setItemOrigin (ALIGNMENT value) ;
91 
92  // Content creation
102  virtual Item* addItem (nkMemory::StringView label, std::function<void ()> callback) = 0 ;
106  virtual void clearItems () = 0 ;
107 
108  // Recomputations
113  virtual void recomputeSizeToFitItems () = 0 ;
114 
115  public :
116 
117  // Statics
125  static nkMemory::UniquePtr<ToolBar> create (System* system = nullptr) ;
126  } ;
127 }
nkWinUi::ToolBar::recomputeSizeToFitItems
virtual void recomputeSizeToFitItems()=0
nkWinUi::ALIGNMENT
ALIGNMENT
Possible alignment values, interpretable by components depending on their behavior.
Definition: Alignment.h:12
nkWinUi::ToolBar::clearItems
virtual void clearItems()=0
nkWinUi::ToolBar::Item::Item
Item() noexcept
nkWinUi::ToolBar::create
static nkMemory::UniquePtr< ToolBar > create(System *system=nullptr)
nkWinUi::ToolBar::Item::getCallback
virtual std::function< void()> getCallback() const =0
nkWinUi::ToolBar::getItem
virtual Item * getItem(unsigned int index) const =0
nkWinUi::ToolBar::Item
Represents an item within a ToolBar.
Definition: ToolBar.h:22
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::ToolBar
A ToolBar in which items can be added to offer different capabilities.
Definition: ToolBar.h:14
nkWinUi::ToolBar::Item::getLabel
virtual nkMemory::StringView getLabel() const =0
nkWinUi::ToolBar::setItemOrigin
void setItemOrigin(ALIGNMENT value)
nkWinUi::ContextMenu
A graphical context menu.
Definition: ContextMenu.h:12
nkWinUi::ToolBar::Item::getContextMenu
virtual ContextMenu * getContextMenu() const =0
nkWinUi::ToolBar::getItemCount
virtual unsigned int getItemCount() const =0
nkWinUi::ToolBar::addItem
virtual Item * addItem(nkMemory::StringView label, std::function< void()> callback)=0
nkWinUi
Encompasses all API of component NilkinsWinUi.
Definition: Clipboard.h:7
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7