IDAPython 9.0
Loading...
Searching...
No Matches
Choose Class Reference
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)
 
 Embedded (self, create_chobj=False)
 
 GetEmbSelection (self)
 
 Show (self, modal=False)
 
 Activate (self)
 
 Refresh (self)
 
 Close (self)
 
 GetWidget (self)
 
 adjust_last_item (self, n)
 
 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)
 
 OnGetSize (self)
 
 OnGetLine (self, n)
 
 OnGetIcon (self, n)
 
 OnGetLineAttr (self, n)
 
 OnInsertLine (self, sel)
 
 OnDeleteLine (self, sel)
 
 OnEditLine (self, sel)
 
 OnSelectLine (self, sel)
 
 OnSelectionChange (self, sel)
 
 OnRefresh (self, sel)
 
 OnClose (self)
 
 OnGetEA (self, n)
 
 OnGetDirTree (self)
 
 OnIndexToInode (self, n)
 
 OnIndexToDiffpos (self, n)
 
 OnLazyLoadDir (self, path)
 

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

Chooser wrapper class.

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 )
Constructs a chooser window.
@param title: The chooser title
@param cols: a list of colums; each list item is a list of two items
    example: [ ["Address", 10 | Choose.CHCOL_HEX],
               ["Name",    30 | Choose.CHCOL_PLAIN] ]
@param flags: One of CH_XXXX constants
@param flags2: One of CH2_XXXX constants
@param deflt: The index of the default item (0-based) for single
    selection choosers or the list of indexes for multi selection
    chooser
@param popup_names: List of new captions to replace this list
    ["Insert", "Delete", "Edit", "Refresh"]
@param icon: Icon index (the icon should exist in ida resources or
    an index to a custom loaded icon)
@param x1, y1, x2, y2: The default location (for txt-version)
@param embedded: Create as embedded chooser
@param width: Embedded chooser width
@param height: Embedded chooser height
@param forbidden_cb: Explicitly forbidden callbacks

Member Function Documentation

◆ Activate()

Activate ( self)
Activates a visible chooser

◆ 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 )
Helper for OnDeleteLine() and OnRefresh() callbacks.
They can be finished by the following line:
return [Choose.ALL_CHANGED] + self.adjust_last_item(n)
@param: line number of the remaining select item
@return: list of selected lines numbers (one element or empty)

◆ Close()

Close ( self)
Closes the chooser

◆ Embedded()

Embedded ( self,
create_chobj = False )
Creates an embedded chooser (as opposed to Show())
@return: Returns 0 on success or NO_ATTR

◆ GetEmbSelection()

GetEmbSelection ( self)
Deprecated. For embedded choosers, the selection is
available through 'Form.EmbeddedChooserControl.selection'

◆ GetWidget()

GetWidget ( self)
Return the TWidget underlying this view.

@return: The TWidget underlying this view, or None.

◆ OnClose()

OnClose ( self)
The chooser window is closed.

◆ OnDeleteLine()

OnDeleteLine ( self,
sel )
User deleted an element

@param sel the current selection
@return a tuple (changed, selection)

◆ OnEditLine()

OnEditLine ( self,
sel )
User asked to edit an element.

@param sel the current selection
@return a tuple (changed, selection)

◆ OnGetDirTree()

OnGetDirTree ( self)
Get the dirtree_t that will be used to present a tree-like
structure to the user (see CH_HAS_DIRTREE)

@return the dirtree_t, or None

◆ OnGetEA()

OnGetEA ( self,
n )
Get the address of an element

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())
@param n element number (0-based)
@return the effective address, ida_idaapi.BADADDR if the element has no address

◆ OnGetIcon()

OnGetIcon ( self,
n )
Get an icon to associate with the first cell of an element

@param n index of the element
@return an icon ID

◆ OnGetLine()

OnGetLine ( self,
n )
Get data for an element

This callback is mandatory

@param n the index to fetch data for
@return a list of strings

◆ OnGetLineAttr()

OnGetLineAttr ( self,
n )
Get attributes for an element

@param n index of the element
@return a tuple (color, flags)

◆ OnGetSize()

OnGetSize ( self)
Get the number of elements in the chooser.

This callback is mandatory

@return the number of elements

◆ OnIndexToDiffpos()

OnIndexToDiffpos ( self,
n )
Map an element index to a diffpos_t

This callback is mandatory if CH_HAS_DIFF is specified

@param n index of the element
@return the diffpos

◆ OnIndexToInode()

OnIndexToInode ( self,
n )
Map an element index to a dirtree_t inode

This callback is mandatory if CH_HAS_DIRTREE is specified

@param n index of the element
@return the inode number

◆ OnInit()

OnInit ( self)
Initialize the chooser and populate it.

This callback is optional

◆ OnInsertLine()

OnInsertLine ( self,
sel )
User asked to insert an element

@param sel the current selection
@return a tuple (changed, selection)

◆ OnLazyLoadDir()

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. The implementation should use the
given dirtree's link() or mkdir() methods to add the folder contents.

@param path an absolute dirtree path to the directory that is being expanded
@return success

◆ OnPopup()

OnPopup ( self,
widget,
popup_handle )

◆ OnRefresh()

OnRefresh ( self,
sel )
The chooser needs to be refreshed.
It returns the new positions of the selected items.

@param sel the current selection
@return a tuple (changed, selection)

◆ OnSelectionChange()

OnSelectionChange ( self,
sel )
Selection changed

@param sel the new selection

◆ OnSelectLine()

OnSelectLine ( self,
sel )
User pressed the enter key, or double-clicked a selection

@param sel the current selection
@return a tuple (changed, selection)

◆ Refresh()

Refresh ( self)
Causes the refresh callback to trigger

◆ Show()

Show ( self,
modal = False )
Activates or creates a chooser window
@param modal: Display as modal dialog
@return: 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: