actions

summary: custom actions, with icons & tooltips

description:

How to create user actions, that once created can be inserted in menus, toolbars, context menus, …

Those actions, when triggered, will be passed a ‘context’ that contains some of the most frequently needed bits of information.

In addition, custom actions can determine when they want to be available (through their ida_kernwin.action_handler_t.update callback)

keywords: actions

see_also: add_hotkey

level: intermediate

Attributes

icon_data

act_icon

hooks

act_name

Classes

SayHi

Hooks

Module Contents

class actions.SayHi(message)

Bases: ida_kernwin.action_handler_t

message
activate(ctx)

Activate an action. This function implements the core behavior of an action. It is called when the action is triggered, from a menu, from a popup menu, from the toolbar, or programmatically.

Returns:

non-zero: all IDA windows will be refreshed

update(ctx)

Update an action. This is called when the context of the UI changed, and we need to let the action update some of its properties if needed (label, icon, …) In addition, this lets IDA know whether the action is enabled, and when it should be queried for availability again. Note: This callback is not meant to change anything in the application’s state, except by calling one (or many) of the “update_action_*()” functions on this very action.

actions.icon_data = b''
actions.act_icon
actions.hooks = None
actions.act_name = 'example:add_action'
class actions.Hooks(_flags: int = 0, _hkcb_flags: int = 1)

Bases: ida_kernwin.UI_Hooks

finish_populating_widget_popup(widget, popup)

IDA is about to be done populating the context menu for a widget. This is your chance to attach_action_to_popup().

Parameters:
  • widget – (TWidget *)

  • popup_handle – (TPopupMenu *)

  • ctx – (const action_activation_ctx_t *)

Returns:

void