Latest available version: IDA and decompilers v8.4.240320sp1 see all releases
Hex-Rays logo State-of-the-art binary code analysis tools
email icon

Chooser object. #chooser. More...

#include <kernwin.hpp>

Inherited by chooser_multi_t, and chooser_t.

Public Types

enum  {
  POPUP_INS , POPUP_DEL , POPUP_EDIT , POPUP_REFRESH ,
  NSTDPOPUPS
}
 
enum  cbres_t { NOTHING_CHANGED , ALL_CHANGED , SELECTION_CHANGED }
 return value of ins(), del(), edit(), enter(), refresh() callbacks More...
 

Public Member Functions

 chooser_base_t (uint32 flags_=0, int columns_=0, const int *widths_=nullptr, const char *const *header_=nullptr, const char *title_=nullptr, uint16 flags2_=0)
 
void call_destructor ()
 
virtual void * get_chooser_obj ()
 get pointer to some custom data. More...
 
virtual const void * get_obj_id (size_t *len) const
 get the id of the chooser data. More...
 
bool is_same (const chooser_base_t *other) const
 do the current and the given objects hold the same data?
 
bool can_ins () const
 is an operation allowed?
 
bool can_del () const
 
bool can_edit () const
 
bool can_refresh () const
 
bool popup_allowed (int stdact_idx) const
 is a standard action allowed?
 
bool is_status_bar_hidden () const
 
bool should_restore_geometry () const
 
bool is_modal () const
 is choose modal?
 
bool is_multi () const
 is multi-selection allowed?
 
bool ask_item_attrs () const
 should chooser generate ui_get_chooser_item_attrs events?
 
bool is_force_default () const
 should selection of the already opened non-modal chooser be changed?
 
uint get_builtin_number () const
 get number of the built-in chooser
 
void set_ask_item_attrs (bool enable)
 enable or disable generation of ui_get_chooser_item_attrs events
 
void check_version (uint32 ver) const
 
bool is_quick_filter_visible_initially () const
 
int get_quick_filter_initial_mode () const
 
bool has_dirtree () const
 
bool has_diff_capability () const
 
bool can_sort () const
 
bool can_filter () const
 
bool should_rename_trigger_edit () const
 
bool is_dirtree_persisted () const
 
bool is_lazy_loaded () const
 
bool has_inode_to_index () const
 
virtual bool idaapi init ()
 initialize the chooser and populate it. More...
 
virtual size_t idaapi get_count () const =0
 get the number of elements in the chooser
 
virtual void idaapi get_row (qstrvec_t *out, int *out_icon, chooser_item_attrs_t *out_attrs, size_t n) const =0
 get a description of an element. More...
 
virtual ea_t idaapi get_ea (size_t) const
 get the address of an element. More...
 
virtual void idaapi closed ()
 The chooser window is closed.
 

Public Attributes

int x0 = -1
 screen position, Functions: generic list choosers
 
int y0 = -1
 
int x1 = -1
 
int y1 = -1
 
int width = 0
 (in chars)
 
int height = 0
 (in chars)
 
const char * title
 menu title (includes ptr to help). More...
 
int columns
 number of columns
 
const int * widths
 column widths More...
 
const char *const * header
 header line; contains the tooltips, and column name for each of 'columns' columns. More...
 
int icon = -1
 default icon
 
qstring popup_names [NSTDPOPUPS]
 array of custom labels of the standard actions. More...
 
int deflt_col = 0
 Column that will have focus.
 

Static Public Attributes

static constexpr ssize_t NO_SELECTION = -1
 there is no selected item
 
static constexpr ssize_t EMPTY_CHOOSER = -2
 the chooser has no data and cannot be displayed
 
static constexpr ssize_t ALREADY_EXISTS = -3
 the non-modal chooser with the same data is already open
 
static constexpr ssize_t NO_ATTR = -4
 reserved for IDAPython
 

Protected Member Functions

void init_popup_names (const char *const default_popup_names[NSTDPOPUPS])
 

Protected Attributes

uint8 version = 3
 version of the class
 
uint8 reserved = 0
 
uint16 flags2
 Extended chooser flags
 
uint32 flags
 Generic chooser flags
 

Detailed Description

Chooser object. #chooser.

Member Enumeration Documentation

◆ cbres_t

return value of ins(), del(), edit(), enter(), refresh() callbacks

If the chooser implements get_dirtree(), and has ins() and/or del() capabilities, the meaning of the returned index(es) combined with ALL_CHANGED and SELECTION_CHANGED must be as follows:

  • for ins(): the index (in case of a chooser_t, or first index in case of a chooser_multi_t), will be the index of the row that was inserted.
  • for del(): the index (or indexes in case of a chooser_multi_t), will be the index(es) of the row(s) that was(were) deleted.

Member Function Documentation

◆ get_chooser_obj()

virtual void * chooser_base_t::get_chooser_obj ( )
inlinevirtual

get pointer to some custom data.

Note
These data are also called "the underlying object". Now this method is used only in the ActionsInspector class and ida_kernwin.Choose IDAPython's class.

◆ get_obj_id()

virtual const void * chooser_base_t::get_obj_id ( size_t *  len) const
inlinevirtual

get the id of the chooser data.

The choosers are the same if they have the same data ids.

Parameters
[out]lenlength of the id. If it is 0 then it is considered that the method returned an unique id.
Returns
address of the id or nullptr in the case len == 0

◆ init()

virtual bool idaapi chooser_base_t::init ( )
inlinevirtual

initialize the chooser and populate it.

Return values
falsethe chooser is empty, do not display it

◆ get_row()

virtual void idaapi chooser_base_t::get_row ( qstrvec_t out,
int *  out_icon,
chooser_item_attrs_t out_attrs,
size_t  n 
) const
pure virtual

get a description of an element.

Parameters
[out]outvector of strings.
will receive the contents of each column
[out]out_iconelement's icon id, -1 - no icon
[out]out_attrselement attributes
nelement number (0..get_count()-1)

◆ get_ea()

virtual ea_t idaapi chooser_base_t::get_ea ( size_t  ) const
inlinevirtual

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

Parameters
nelement number (0-based)
Returns
the effective address, BADADDR if the element has no address

Member Data Documentation

◆ title

const char* chooser_base_t::title

menu title (includes ptr to help).

May have chooser title prefixes (see "Chooser title" above).

◆ widths

const int* chooser_base_t::widths

column widths

◆ header

const char* const* chooser_base_t::header

header line; contains the tooltips, and column name for each of 'columns' columns.

When tooltips need to be provided, the syntax should be: "#tooltip#column-name". (Otherwise, the syntax is simply "column-name".)

◆ popup_names

qstring chooser_base_t::popup_names[NSTDPOPUPS]

array of custom labels of the standard actions.

Used to replace labels for these actions.
An empty name means that the default name will be used.

Note
Availability of these actions is determined by the CH_CAN_... flags. The label, icon and other action attributes can be overwritten in the action description returned by get_stdact_descs()

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