Module ida_kernwin :: Class Choose
[frames] | no frames]

Class Choose

object --+
         |
        Choose

Chooser wrapper class.

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

Nested Classes
  UI_Hooks_Trampoline
Instance Methods
 
__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)
Constructs a chooser window.
 
Embedded(self)
Creates an embedded chooser (as opposed to Show())
 
GetEmbSelection(self)
Returns the selection associated with an embedded chooser
 
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.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  CH_MODAL = 1
Modal chooser
  CH_MULTI = 4
Allow multi selection.
  CH_NOBTNS = 16
  CH_ATTRS = 32
  CH_NOIDB = 64
use the chooser even without an open database, same as x0=-2
  CH_FORCE_DEFAULT = 128
If a non-modal chooser was already open, change selection to the given default one
  CH_QFLT = 4096
open with quick filter enabled and focused
  CH_QFTYP_SHIFT = 13
  CH_QFTYP_DEFAULT = 0
  CH_QFTYP_NORMAL = 8192
  CH_QFTYP_WHOLE_WORDS = 16384
  CH_QFTYP_REGEX = 24576
  CH_QFTYP_FUZZY = 32768
  CH_QFTYP_MASK = 57344
  CH_CAN_INS = 256
allow to insert new items
  CH_CAN_DEL = 512
allow to delete existing item(s)
  CH_CAN_EDIT = 1024
allow to edit existing item(s)
  CH_CAN_REFRESH = 2048
allow to refresh chooser
  CH_BUILTIN_SHIFT = 19
  CH_BUILTIN_MASK = 16252928
  CHCOL_PLAIN = 0
  CHCOL_PATH = 65536
  CHCOL_HEX = 131072
  CHCOL_DEC = 196608
  CHCOL_FORMAT = 458752
  NO_SELECTION = -1
there is no selected item
  EMPTY_CHOOSER = -4
the chooser is initialized
  ALREADY_EXISTS = -5
the non-modal chooser with the same data is already open
  NO_ATTR = -6
some mandatory attribute is missing
  NOTHING_CHANGED = 0
  ALL_CHANGED = 1
  SELECTION_CHANGED = 2
  CHOOSE_HAVE_INIT = 1
  CHOOSE_HAVE_GETICON = 2
  CHOOSE_HAVE_GETATTR = 4
  CHOOSE_HAVE_INS = 8
  CHOOSE_HAVE_DEL = 16
  CHOOSE_HAVE_EDIT = 32
  CHOOSE_HAVE_ENTER = 64
  CHOOSE_HAVE_REFRESH = 128
  CHOOSE_HAVE_SELECT = 256
  CHOOSE_HAVE_ONCLOSE = 512
Properties

Inherited from object: __class__

Method Details

__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)
(Constructor)

 
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 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

Overrides: object.__init__

Embedded(self)

 

Creates an embedded chooser (as opposed to Show())

Returns:
Returns 0 on success or NO_ATTR

GetEmbSelection(self)

 

Returns the selection associated with an embedded chooser

Returns:
  • None if chooser is not embedded
  • A list with selection indexes (0-based)

Show(self, modal=False)

 

Activates or creates a chooser window

Parameters:
  • modal - Display 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;

GetWidget(self)

 

Return the TWidget underlying this view.

Returns:
The TWidget underlying this view, or None.

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)

Returns:
list of selected lines numbers (one element or empty)

Class Variable Details

CH_MULTI

Allow multi selection. Refer the description of the OnInsertLine(), OnDeleteLine(), OnEditLine(), OnSelectLine(), OnRefresh(), OnSelectionChange() to see a difference between single and multi selection callbacks.

Value:
4