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 | |
| parent | 4025361513068463390900635313910200542556 (diff) | |
Initial components UI update.
| -rw-r--r-- | binaryninjaapi.h | 2 | ||||
| -rw-r--r-- | binaryview.cpp | 6 | ||||
| -rw-r--r-- | ui/action.h | 21 | ||||
| -rw-r--r-- | ui/uitypes.h | 1 |
4 files changed, 28 insertions, 2 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 0052e3ed..91006bf5 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -2825,7 +2825,7 @@ namespace BinaryNinja { SegmentUpdates = SegmentLifetime | SegmentUpdated, SectionLifetime = SectionAdded | SectionRemoved, SectionUpdates = SectionLifetime | SectionUpdated, - ComponentUpdates = ComponentAdded | ComponentRemoved | ComponentMoved | ComponentFunctionAdded | ComponentFunctionRemoved | ComponentDataVariableAdded | ComponentDataVariableRemoved + ComponentUpdates = ComponentNameUpdated | ComponentAdded | ComponentRemoved | ComponentMoved | ComponentFunctionAdded | ComponentFunctionRemoved | ComponentDataVariableAdded | ComponentDataVariableRemoved }; using NotificationTypes = uint64_t; diff --git a/binaryview.cpp b/binaryview.cpp index 7abb01cb..1588d23a 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -3286,7 +3286,11 @@ Ref<Component> BinaryView::CreateComponent(std::string parentGUID) Ref<Component> BinaryView::CreateComponent(Ref<Component> parent) { - auto bnComponent = BNCreateComponentWithParent(m_object, parent->GetGuid().c_str()); + BNComponent* bnComponent; + if (parent) + bnComponent = BNCreateComponentWithParent(m_object, parent->GetGuid().c_str()); + else + bnComponent = BNCreateComponent(m_object); return new Component(bnComponent); } 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 */ diff --git a/ui/uitypes.h b/ui/uitypes.h index bf15cbd6..083c4ac5 100644 --- a/ui/uitypes.h +++ b/ui/uitypes.h @@ -68,6 +68,7 @@ typedef BinaryNinja::Ref<BinaryNinja::BasicBlock> BasicBlockRef; typedef BinaryNinja::Ref<BinaryNinja::BinaryData> BinaryDataRef; typedef BinaryNinja::Ref<BinaryNinja::BinaryView> BinaryViewRef; typedef BinaryNinja::Ref<BinaryNinja::BinaryViewType> BinaryViewTypeRef; +typedef BinaryNinja::Ref<BinaryNinja::Component> ComponentRef; typedef BinaryNinja::Ref<BinaryNinja::Database> DatabaseRef; typedef BinaryNinja::Ref<BinaryNinja::DebugInfo> DebugInfoRef; typedef BinaryNinja::Ref<BinaryNinja::DisassemblySettings> DisassemblySettingsRef; |
