API Documentation
ContextMenu.h
1 // ContextMenu.h
3 //
5 
6 namespace nkWinUi
7 {
11  class ContextMenu : public Component
12  {
13  public :
14 
15  // Internal item
19  class Item
20  {
21  public :
22 
23  // Constructor, destructor
27  Item () noexcept ;
31  virtual ~Item () ;
32 
33  // Getters
37  virtual nkMemory::StringView getLabel () const = 0 ;
41  virtual std::function<void ()> getCallback () const = 0 ;
42  } ;
43 
44  public :
45 
53  ContextMenu (System* system) noexcept ;
57  virtual ~ContextMenu () ;
58 
59  // Getters
64 
65  // Getters
74  virtual Item* getItem (unsigned int index) const = 0 ;
78  virtual unsigned int getItemCount () const = 0 ;
79 
80  // Setters
87  void setAutomaticSizing (bool value) ;
88 
89  // Content creation
98  virtual Item* addItem (nkMemory::StringView label, std::function<void ()> callback) = 0 ;
102  virtual void addSeparator () = 0 ;
106  virtual void clearItems () = 0 ;
107 
108  // View
114  virtual void pop () = 0 ;
115 
116  // Recomputations
121  virtual void recomputeSizeToFitItems () = 0 ;
122 
123  // Import / Export
124  virtual void exportClassToTree (nkExport::Node* rootNode) override ;
125  virtual void importClassFromTree (nkExport::Node* rootNode) override ;
126 
127  public :
128 
129  // Statics
137  static nkMemory::UniquePtr<ContextMenu> create (System* system = nullptr) ;
138  } ;
139 }
nkWinUi::ContextMenu::exportClassToTree
virtual void exportClassToTree(nkExport::Node *rootNode) override
nkWinUi::ContextMenu::pop
virtual void pop()=0
nkWinUi::ContextMenu::addSeparator
virtual void addSeparator()=0
nkWinUi::ContextMenu::recomputeSizeToFitItems
virtual void recomputeSizeToFitItems()=0
nkExport
Encompasses all API of component NilkinsExport.
Definition: Base64Encoder.h:7
nkWinUi::Component
Base class for any graphical component.
Definition: Component.h:12
nkWinUi::ContextMenu::Item::Item
Item() noexcept
nkWinUi::System
The main system of the component.
Definition: System.h:18
nkWinUi::ContextMenu::getItem
virtual Item * getItem(unsigned int index) const =0
nkWinUi::ContextMenu::Item::getCallback
virtual std::function< void()> getCallback() const =0
nkWinUi::ContextMenu::addItem
virtual Item * addItem(nkMemory::StringView label, std::function< void()> callback)=0
nkWinUi::ContextMenu
A graphical context menu.
Definition: ContextMenu.h:12
nkWinUi::ContextMenu::Item
An item within the context menu component.
Definition: ContextMenu.h:20
nkWinUi::ContextMenu::getParentComponent
Component * getParentComponent() const
nkWinUi::ContextMenu::getItemCount
virtual unsigned int getItemCount() const =0
nkWinUi::ContextMenu::clearItems
virtual void clearItems()=0
nkWinUi::ContextMenu::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkWinUi
Encompasses all API of component NilkinsWinUi.
Definition: Clipboard.h:7
nkWinUi::ContextMenu::Item::getLabel
virtual nkMemory::StringView getLabel() const =0
nkWinUi::ContextMenu::setAutomaticSizing
void setAutomaticSizing(bool value)
nkWinUi::ContextMenu::create
static nkMemory::UniquePtr< ContextMenu > create(System *system=nullptr)
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7