IDAPython 8.4
Loading...
Searching...
No Matches
Choose Class Reference

Chooser wrapper class. More...

Inheritance diagram for Choose:

Classes

class  UI_Hooks_Trampoline
 

Public Member Functions

 __init__ (self, title, cols, flags=0, popup_names=None, icon=-1, x1=-1, y1=-1, x2=-1, y2=-1, deflt=None, embedded=False, width=None, height=None, forbidden_cb=0, flags2=0)
 Constructs a chooser window.
 
 Embedded (self, create_chobj=False)
 Creates an embedded chooser (as opposed to Show())
 
 GetEmbSelection (self)
 Deprecated.
 
 Show (self, modal=False)
 Activates or creates a chooser window.
 
 Activate (self)
 Activates a visible chooser.
 
 Refresh (self)
 Causes the refresh callback to trigger.
 
 Close (self)
 Closes the chooser.
 
 GetWidget (self)
 Return the TWidget underlying this view.
 
 adjust_last_item (self, n)
 Helper for OnDeleteLine() and OnRefresh() callbacks.
 
 AddCommand (self, caption, flags=_ida_kernwin.CHOOSER_POPUP_MENU, menu_index=-1, icon=-1, emb=None, shortcut=None)
 
 OnPopup (self, widget, popup_handle)
 
 OnInit (self)
 Initialize the chooser and populate it.
 
 OnGetSize (self)
 Get the number of elements in the chooser.
 
 OnGetLine (self, n)
 Get data for an element.
 
 OnGetIcon (self, n)
 Get an icon to associate with the first cell of an element.
 
 OnGetLineAttr (self, n)
 Get attributes for an element.
 
 OnInsertLine (self, sel)
 User asked to insert an element.
 
 OnDeleteLine (self, sel)
 User deleted an element.
 
 OnEditLine (self, sel)
 User asked to edit an element.
 
 OnSelectLine (self, sel)
 User pressed the enter key, or double-clicked a selection.
 
 OnSelectionChange (self, sel)
 Selection changed.
 
 OnRefresh (self, sel)
 The chooser needs to be refreshed.
 
 OnClose (self)
 The chooser window is closed.
 
 OnGetEA (self, n)
 Get the address of an element.
 
 OnGetDirTree (self)
 Get the dirtree_t that will be used to present a tree-like structure to the user (see CH_HAS_DIRTREE)
 
 OnIndexToInode (self, n)
 Map an element index to a dirtree_t inode.
 
 OnIndexToDiffpos (self, n)
 Map an element index to a diffpos_t.
 
 OnLazyLoadDir (self, path)
 Callback for lazy-loaded, dirtree-based choosers; the function will be called when a folder is expanded and it has not been loaded before.
 

Public Attributes

 title = title
 
 flags = flags
 
 flags2 = flags2
 
 cols = cols
 
 deflt = deflt
 
 popup_names = popup_names
 
 icon = icon
 
 x1 = x1
 
 y1 = y1
 
 x2 = x2
 
 y2 = y2
 
 embedded = embedded
 
 width = width
 
 height = height
 
 forbidden_cb = forbidden_cb
 
 ui_hooks_trampoline = None
 

Static Public Attributes

 CH_MODAL = _ida_kernwin.CH_MODAL
 
 CH_MULTI = _ida_kernwin.CH_MULTI
 
 CH_NOBTNS = _ida_kernwin.CH_NOBTNS
 
 CH_ATTRS = _ida_kernwin.CH_ATTRS
 
 CH_NOIDB = _ida_kernwin.CH_NOIDB
 
 CH_FORCE_DEFAULT = _ida_kernwin.CH_FORCE_DEFAULT
 
 CH_CAN_INS = _ida_kernwin.CH_CAN_INS
 
 CH_CAN_DEL = _ida_kernwin.CH_CAN_DEL
 
 CH_CAN_EDIT = _ida_kernwin.CH_CAN_EDIT
 
 CH_CAN_REFRESH = _ida_kernwin.CH_CAN_REFRESH
 
 CH_QFLT = _ida_kernwin.CH_QFLT
 
 CH_QFTYP_SHIFT = _ida_kernwin.CH_QFTYP_SHIFT
 
 CH_QFTYP_DEFAULT = _ida_kernwin.CH_QFTYP_DEFAULT
 
 CH_QFTYP_NORMAL = _ida_kernwin.CH_QFTYP_NORMAL
 
 CH_QFTYP_WHOLE_WORDS = _ida_kernwin.CH_QFTYP_WHOLE_WORDS
 
 CH_QFTYP_REGEX = _ida_kernwin.CH_QFTYP_REGEX
 
 CH_QFTYP_FUZZY = _ida_kernwin.CH_QFTYP_FUZZY
 
 CH_QFTYP_MASK = _ida_kernwin.CH_QFTYP_MASK
 
 CH_NO_STATUS_BAR = _ida_kernwin.CH_NO_STATUS_BAR
 
 CH_RESTORE = _ida_kernwin.CH_RESTORE
 
 CH_RENAME_IS_EDIT = _ida_kernwin.CH_RENAME_IS_EDIT
 
 CH_BUILTIN_SHIFT = _ida_kernwin.CH_BUILTIN_SHIFT
 
 CH_BUILTIN_MASK = _ida_kernwin.CH_BUILTIN_MASK
 
 CH_HAS_DIRTREE = _ida_kernwin.CH_HAS_DIRTREE
 
 CH_HAS_DIFF = _ida_kernwin.CH_HAS_DIFF
 
 CHCOL_PLAIN = _ida_kernwin.CHCOL_PLAIN
 
 CHCOL_PATH = _ida_kernwin.CHCOL_PATH
 
 CHCOL_HEX = _ida_kernwin.CHCOL_HEX
 
 CHCOL_DEC = _ida_kernwin.CHCOL_DEC
 
 CHCOL_EA = _ida_kernwin.CHCOL_EA
 
 CHCOL_FNAME = _ida_kernwin.CHCOL_FNAME
 
 CHCOL_FORMAT = _ida_kernwin.CHCOL_FORMAT
 
 CHCOL_DEFHIDDEN = _ida_kernwin.CHCOL_DEFHIDDEN
 
 CHCOL_DRAGHINT = _ida_kernwin.CHCOL_DRAGHINT
 
 CHCOL_INODENAME = _ida_kernwin.CHCOL_INODENAME
 
int NO_SELECTION = -1
 
int EMPTY_CHOOSER = -2
 
int ALREADY_EXISTS = -3
 
int NO_ATTR = -4
 
int NOTHING_CHANGED = 0
 
int ALL_CHANGED = 1
 
int SELECTION_CHANGED = 2
 

Protected Attributes

 _quick_commands = quick_widget_commands_t(_qccb)
 

Detailed Description

Some constants are defined in this class. Please refer to kernwin.hpp for more information.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
title,
cols,
flags = 0,
popup_names = None,
icon = -1,
x1 = -1,
y1 = -1,
x2 = -1,
y2 = -1,
deflt = None,
embedded = False,
width = None,
height = None,
forbidden_cb = 0,
flags2 = 0 )
Parameters
titleThe chooser title
colsa list of colums; each list item is a list of two items example: [ ["Address", 10 | Choose.CHCOL_HEX], ["Name", 30 | Choose.CHCOL_PLAIN] ]
flagsOne of CH_XXXX constants
flags2One of CH2_XXXX constants
defltThe index of the default item (0-based) for single selection choosers or the list of indexes for multi selection chooser
popup_namesList of new captions to replace this list ["Insert", "Delete", "Edit", "Refresh"]
iconIcon index (the icon should exist in ida resources or an index to a custom loaded icon)
x1,y1,x2,y2The default location (for txt-version)
embeddedCreate as embedded chooser
widthEmbedded chooser width
heightEmbedded chooser height
forbidden_cbExplicitly forbidden callbacks

Member Function Documentation

◆ Activate()

Activate ( self)

◆ AddCommand()

AddCommand ( self,
caption,
flags = _ida_kernwin.CHOOSER_POPUP_MENU,
menu_index = -1,
icon = -1,
emb = None,
shortcut = None )

◆ adjust_last_item()

adjust_last_item ( self,
n )

They can be finished by the following line: return [Choose.ALL_CHANGED] + self.adjust_last_item(n)

Parameters
linenumber of the remaining select item
Returns
: list of selected lines numbers (one element or empty)

◆ Close()

Close ( self)

◆ Embedded()

Embedded ( self,
create_chobj = False )
Returns
: Returns 0 on success or NO_ATTR

◆ GetEmbSelection()

GetEmbSelection ( self)

For embedded choosers, the selection is available through 'Form.EmbeddedChooserControl.selection'

◆ GetWidget()

GetWidget ( self)
Returns
: The TWidget underlying this view, or None.

◆ OnClose()

OnClose ( self)

◆ OnDeleteLine()

OnDeleteLine ( self,
sel )
Parameters
selthe current selection
Returns
: a tuple (changed, selection)

◆ OnEditLine()

OnEditLine ( self,
sel )
Parameters
selthe current selection
Returns
: a tuple (changed, selection)

◆ OnGetDirTree()

OnGetDirTree ( self)
Returns
: the dirtree_t, or None

◆ OnGetEA()

OnGetEA ( self,
n )

When this function returns valid addresses:

  • If any column has the CHCOL_FNAME flag, rows will be colored according to the attributes of the functions who own those addresses (extern, library function, Lumina, ... - similar to what the "Functions" widget does)
  • When a selection is present and the user presses <Enter> (<Shift+Enter> if the chooser is modal), IDA will jump to that address (through jumpto())
    Parameters
    nelement number (0-based)
    Returns
    : the effective address, ida_idaapi.BADADDR if the element has no address

◆ OnGetIcon()

OnGetIcon ( self,
n )
Parameters
nindex of the element
Returns
: an icon ID

◆ OnGetLine()

OnGetLine ( self,
n )

This callback is mandatory

Parameters
nthe index to fetch data for
Returns
: a list of strings

◆ OnGetLineAttr()

OnGetLineAttr ( self,
n )
Parameters
nindex of the element
Returns
: a tuple (color, flags)

◆ OnGetSize()

OnGetSize ( self)

This callback is mandatory

Returns
: the number of elements

◆ OnIndexToDiffpos()

OnIndexToDiffpos ( self,
n )

This callback is mandatory if CH_HAS_DIFF is specified

Parameters
nindex of the element
Returns
: the diffpos

◆ OnIndexToInode()

OnIndexToInode ( self,
n )

This callback is mandatory if CH_HAS_DIRTREE is specified

Parameters
nindex of the element
Returns
: the inode number

◆ OnInit()

OnInit ( self)

This callback is optional

◆ OnInsertLine()

OnInsertLine ( self,
sel )
Parameters
selthe current selection
Returns
: a tuple (changed, selection)

◆ OnLazyLoadDir()

OnLazyLoadDir ( self,
path )

The implementation should use the given dirtree's link() or mkdir() methods to add the folder contents.

Parameters
pathan absolute dirtree path to the directory that is being expanded
Returns
: success

◆ OnPopup()

OnPopup ( self,
widget,
popup_handle )

◆ OnRefresh()

OnRefresh ( self,
sel )

It returns the new positions of the selected items.

Parameters
selthe current selection
Returns
: a tuple (changed, selection)

◆ OnSelectionChange()

OnSelectionChange ( self,
sel )
Parameters
selthe new selection

◆ OnSelectLine()

OnSelectLine ( self,
sel )
Parameters
selthe current selection
Returns
: a tuple (changed, selection)

◆ Refresh()

Refresh ( self)

◆ Show()

Show ( self,
modal = False )
Parameters
modalDisplay as modal dialog
Returns
: For all choosers it will return NO_ATTR if some mandatory attribute is missing. The mandatory attributes are: flags, title, cols, OnGetSize(), OnGetLine(); For modal choosers it will return the selected item index (0-based), or NO_SELECTION if no selection, or EMPTY_CHOOSER if the OnRefresh() callback returns EMPTY_CHOOSER; For non-modal choosers it will return 0 or ALREADY_EXISTS if the chooser was already open and is active now;

Member Data Documentation

◆ _quick_commands

_quick_commands = quick_widget_commands_t(_qccb)
protected

◆ ALL_CHANGED

int ALL_CHANGED = 1
static

◆ ALREADY_EXISTS

int ALREADY_EXISTS = -3
static

◆ CH_ATTRS

CH_ATTRS = _ida_kernwin.CH_ATTRS
static

◆ CH_BUILTIN_MASK

CH_BUILTIN_MASK = _ida_kernwin.CH_BUILTIN_MASK
static

◆ CH_BUILTIN_SHIFT

CH_BUILTIN_SHIFT = _ida_kernwin.CH_BUILTIN_SHIFT
static

◆ CH_CAN_DEL

CH_CAN_DEL = _ida_kernwin.CH_CAN_DEL
static

◆ CH_CAN_EDIT

CH_CAN_EDIT = _ida_kernwin.CH_CAN_EDIT
static

◆ CH_CAN_INS

CH_CAN_INS = _ida_kernwin.CH_CAN_INS
static

◆ CH_CAN_REFRESH

CH_CAN_REFRESH = _ida_kernwin.CH_CAN_REFRESH
static

◆ CH_FORCE_DEFAULT

CH_FORCE_DEFAULT = _ida_kernwin.CH_FORCE_DEFAULT
static

◆ CH_HAS_DIFF

CH_HAS_DIFF = _ida_kernwin.CH_HAS_DIFF
static

◆ CH_HAS_DIRTREE

CH_HAS_DIRTREE = _ida_kernwin.CH_HAS_DIRTREE
static

◆ CH_MODAL

CH_MODAL = _ida_kernwin.CH_MODAL
static

◆ CH_MULTI

CH_MULTI = _ida_kernwin.CH_MULTI
static

◆ CH_NO_STATUS_BAR

CH_NO_STATUS_BAR = _ida_kernwin.CH_NO_STATUS_BAR
static

◆ CH_NOBTNS

CH_NOBTNS = _ida_kernwin.CH_NOBTNS
static

◆ CH_NOIDB

CH_NOIDB = _ida_kernwin.CH_NOIDB
static

◆ CH_QFLT

CH_QFLT = _ida_kernwin.CH_QFLT
static

◆ CH_QFTYP_DEFAULT

CH_QFTYP_DEFAULT = _ida_kernwin.CH_QFTYP_DEFAULT
static

◆ CH_QFTYP_FUZZY

CH_QFTYP_FUZZY = _ida_kernwin.CH_QFTYP_FUZZY
static

◆ CH_QFTYP_MASK

CH_QFTYP_MASK = _ida_kernwin.CH_QFTYP_MASK
static

◆ CH_QFTYP_NORMAL

CH_QFTYP_NORMAL = _ida_kernwin.CH_QFTYP_NORMAL
static

◆ CH_QFTYP_REGEX

CH_QFTYP_REGEX = _ida_kernwin.CH_QFTYP_REGEX
static

◆ CH_QFTYP_SHIFT

CH_QFTYP_SHIFT = _ida_kernwin.CH_QFTYP_SHIFT
static

◆ CH_QFTYP_WHOLE_WORDS

CH_QFTYP_WHOLE_WORDS = _ida_kernwin.CH_QFTYP_WHOLE_WORDS
static

◆ CH_RENAME_IS_EDIT

CH_RENAME_IS_EDIT = _ida_kernwin.CH_RENAME_IS_EDIT
static

◆ CH_RESTORE

CH_RESTORE = _ida_kernwin.CH_RESTORE
static

◆ CHCOL_DEC

CHCOL_DEC = _ida_kernwin.CHCOL_DEC
static

◆ CHCOL_DEFHIDDEN

CHCOL_DEFHIDDEN = _ida_kernwin.CHCOL_DEFHIDDEN
static

◆ CHCOL_DRAGHINT

CHCOL_DRAGHINT = _ida_kernwin.CHCOL_DRAGHINT
static

◆ CHCOL_EA

CHCOL_EA = _ida_kernwin.CHCOL_EA
static

◆ CHCOL_FNAME

CHCOL_FNAME = _ida_kernwin.CHCOL_FNAME
static

◆ CHCOL_FORMAT

CHCOL_FORMAT = _ida_kernwin.CHCOL_FORMAT
static

◆ CHCOL_HEX

CHCOL_HEX = _ida_kernwin.CHCOL_HEX
static

◆ CHCOL_INODENAME

CHCOL_INODENAME = _ida_kernwin.CHCOL_INODENAME
static

◆ CHCOL_PATH

CHCOL_PATH = _ida_kernwin.CHCOL_PATH
static

◆ CHCOL_PLAIN

CHCOL_PLAIN = _ida_kernwin.CHCOL_PLAIN
static

◆ cols

cols = cols

◆ deflt

deflt = deflt

◆ embedded

embedded = embedded

◆ EMPTY_CHOOSER

int EMPTY_CHOOSER = -2
static

◆ flags

flags = flags

◆ flags2

flags2 = flags2

◆ forbidden_cb

forbidden_cb = forbidden_cb

◆ height

height = height

◆ icon

icon = icon

◆ NO_ATTR

int NO_ATTR = -4
static

◆ NO_SELECTION

int NO_SELECTION = -1
static

◆ NOTHING_CHANGED

int NOTHING_CHANGED = 0
static

◆ popup_names

popup_names = popup_names

◆ SELECTION_CHANGED

int SELECTION_CHANGED = 2
static

◆ title

title = title

◆ ui_hooks_trampoline

ui_hooks_trampoline = None

◆ width

width = width

◆ x1

x1 = x1

◆ x2

x2 = x2

◆ y1

y1 = y1

◆ y2

y2 = y2

The documentation for this class was generated from the following file: