Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions python/examples/ui_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def OnContextMenuCreated(self, context, view, menu):
# This function only works in C++: Name is an out param (cpp: &name), and not modifiable by python.
print(f"py OnContextMenuCreated {context} {view} {menu}")

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

# Register as a global so it doesn't get destructed
notif = UINotification()
19 changes: 19 additions & 0 deletions ui/uicontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,24 @@ class BINARYNINJAUIAPI UIContextNotification
(void)action;
}


/*!
* Callback when an action is executed. Unlike OnActionExecuted, plugins cannot
* modify the behavior of the action.
*
* \param context
* \param handler
* \param name
* \param ctx
*/
virtual void OnActionExecutedImmutable(UIContext* context, UIActionHandler* handler, const QString& name, const UIActionContext& ctx)
{
(void)context;
(void)handler;
(void)name;
(void)ctx;
}

/*!
Callback when a context menu is created, allowing plugins to modify the menu,
e.g., registering and adding new actions into it. This allow plugins to add
Expand Down Expand Up @@ -570,6 +588,7 @@ class BINARYNINJAUIAPI UIContext
void NotifyOnILViewTypeChange(ViewFrame* frame, View* view, const BinaryNinja::FunctionViewType& viewType);
void updateCrossReferences(ViewFrame* frame, View* view, const SelectionInfoForXref& selection);
void NotifyOnActionExecuted(UIActionHandler* handler, const QString& name, const UIActionContext& ctx, std::function<void(const UIActionContext&)>& action);
void NotifyOnActionExecutedImmutable(UIActionHandler* handler, const QString& name, const UIActionContext& ctx);
void NotifyOnContextMenuCreated(View* view, Menu& menu);

virtual void findAll(const BinaryNinja::FindParameters& params);
Expand Down
Loading