diff options
| author | Brian Potchik <brian@vector35.com> | 2023-11-16 16:00:37 -0500 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2023-11-16 16:00:37 -0500 |
| commit | c798413b1d6625a94d90f1ef56c067370d93bb9f (patch) | |
| tree | cb03df772a8fc87f79ab4b4b6fbc716a51534626 /ui/action.h | |
| parent | 4025361513068463390900635313910200542556 (diff) | |
Initial components UI update.
Diffstat (limited to 'ui/action.h')
| -rw-r--r-- | ui/action.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ui/action.h b/ui/action.h index 9deb3a66..49f58b6a 100644 --- a/ui/action.h +++ b/ui/action.h @@ -372,6 +372,27 @@ class BINARYNINJAUIAPI Menu static std::vector<QString> getMainMenus(); }; +class BINARYNINJAUIAPI OrderedMenuHelper +{ + Menu* m_menu = nullptr; + uint8_t m_groupOrder = MENU_ORDER_NORMAL; + std::map<QString, uint8_t> m_orders; + +public: + OrderedMenuHelper(Menu* menu) : m_menu(menu) { } + + Menu* getMenu() { return m_menu; } + + void addAction(const QString& action, const QString& group) { + if (m_orders.find(group) == m_orders.end()) + { + m_menu->setGroupOrdering(group, m_groupOrder++); + m_orders[group] = MENU_ORDER_NORMAL; + } + m_menu->addAction(action, group, m_orders[group]++); + } +}; + /*! \ingroup action */ |
