Skip to content

Commit b8430f7

Browse files
spoonmilkplafosse
authored andcommitted
Add OnActionExecutedImmutable to ui notifications and python api
1 parent b29278c commit b8430f7

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

python/examples/ui_notifications.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ def OnContextMenuCreated(self, context, view, menu):
9898
# This function only works in C++: Name is an out param (cpp: &name), and not modifiable by python.
9999
print(f"py OnContextMenuCreated {context} {view} {menu}")
100100

101+
def OnActionExecutedImmutable(self, context, handler, name, ctx):
102+
print(f"py OnActionExecutedImmutable {context} {handler} {name} {ctx}")
101103

102104
# Register as a global so it doesn't get destructed
103105
notif = UINotification()

ui/uicontext.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,24 @@ class BINARYNINJAUIAPI UIContextNotification
340340
(void)action;
341341
}
342342

343+
344+
/*!
345+
* Callback when an action is executed. Unlike OnActionExecuted, plugins cannot
346+
* modify the behavior of the action.
347+
*
348+
* \param context
349+
* \param handler
350+
* \param name
351+
* \param ctx
352+
*/
353+
virtual void OnActionExecutedImmutable(UIContext* context, UIActionHandler* handler, const QString& name, const UIActionContext& ctx)
354+
{
355+
(void)context;
356+
(void)handler;
357+
(void)name;
358+
(void)ctx;
359+
}
360+
343361
/*!
344362
Callback when a context menu is created, allowing plugins to modify the menu,
345363
e.g., registering and adding new actions into it. This allow plugins to add
@@ -570,6 +588,7 @@ class BINARYNINJAUIAPI UIContext
570588
void NotifyOnILViewTypeChange(ViewFrame* frame, View* view, const BinaryNinja::FunctionViewType& viewType);
571589
void updateCrossReferences(ViewFrame* frame, View* view, const SelectionInfoForXref& selection);
572590
void NotifyOnActionExecuted(UIActionHandler* handler, const QString& name, const UIActionContext& ctx, std::function<void(const UIActionContext&)>& action);
591+
void NotifyOnActionExecutedImmutable(UIActionHandler* handler, const QString& name, const UIActionContext& ctx);
573592
void NotifyOnContextMenuCreated(View* view, Menu& menu);
574593

575594
virtual void findAll(const BinaryNinja::FindParameters& params);

0 commit comments

Comments
 (0)