Editor API
UnigineEditor public API
MenuBase.h
1 // Copyright (C), UNIGINE. All rights reserved.
2 #pragma once
3 
4 #include <editor/EditorGlobal.h>
5 
6 #include <UnigineCallback.h>
7 
8 
9 namespace Editor
10 {
11 
12 class EDITOR_API MenuBase
13 {
14 public:
15  struct Item;
16  using ItemId = Item *;
17 
18 public:
19  virtual void setTitle(const char *title) = 0;
20  virtual const char *getTitle() const = 0;
21 
22  virtual void clear() = 0;
23  virtual void remove(ItemId item) = 0;
24  virtual bool isEmpty() const = 0;
25 
26  virtual ItemId addAction(const char *text) = 0;
27  virtual ItemId insertAction(const char *text, ItemId before_item) = 0;
28  virtual bool isAction(ItemId item) const = 0;
29 
30  virtual MenuBase *addMenu(const char *title) = 0;
31  virtual MenuBase *insertMenu(const char *title, ItemId before_item) = 0;
32  virtual MenuBase *getMenu(ItemId item) const = 0;
33  virtual ItemId getItemId() const = 0;
34  virtual bool isMenu(ItemId item) const = 0;
35 
36  virtual ItemId addSeparator() = 0;
37  virtual ItemId insertSeparator(ItemId before_item) = 0;
38  virtual bool isSeparator(ItemId item) const = 0;
39 
40  virtual void setText(ItemId item, const char *text) = 0;
41  virtual const char *getText(ItemId item) const = 0;
42  virtual void setData(ItemId item, const char *data) = 0;
43  virtual const char *getData(ItemId item) const = 0;
44  virtual void setToolTip(ItemId item, const char *tooltip) = 0;
45  virtual const char *getToolTip(ItemId item) const = 0;
46  virtual void setEnabled(ItemId item, bool enabled) = 0;
47  virtual bool isEnabled(ItemId item) const = 0;
48  virtual void setCheckable(ItemId item, bool checkable) = 0;
49  virtual bool isCheckable(ItemId item) const = 0;
50  virtual void setChecked(ItemId item, bool checked) = 0;
51  virtual bool isChecked(ItemId item) const = 0;
52 
53  using CallbackItemId = void *;
54  virtual CallbackItemId addCallbackAboutToHide(Unigine::CallbackBase1<MenuBase *> *func) = 0;
55  virtual CallbackItemId addCallbackAboutToShow(Unigine::CallbackBase1<MenuBase *> *func) = 0;
56  virtual CallbackItemId addCallbackTriggered(ItemId item, Unigine::CallbackBase2<MenuBase *, ItemId> *func) = 0;
57  virtual bool removeCallback(CallbackItemId id) = 0;
58 
59 protected:
60  MenuBase() = default;
61  virtual ~MenuBase() = default;
62 };
63 
64 } // namespace Editor
Definition: Actions.h:11
Item * ItemId
Definition: MenuBase.h:16
void * CallbackItemId
Definition: MenuBase.h:53
Definition: MenuBase.h:12