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

The chooser object with multi-selection. More...

#include <kernwin.hpp>

Inherits chooser_base_t.

Public Member Functions

 chooser_multi_t (uint32 flags_=0, int columns_=0, const int *widths_=nullptr, const char *const *header_=nullptr, const char *title_=nullptr, uint16 flags2_=0)
 
ssize_t choose (const sizevec_t &deflt=sizevec_t())
 Display a generic list chooser and allow the user to select an item. More...
 
virtual void idaapi get_item_index (sizevec_t *sel, const void *item_data) const newapi
 Get the positions of the items. More...
 
typedef cbres_t (idaapi chooser_multi_t::*cb_t)(sizevec_t *sel)
 Type of ins(), del(), edit(), enter(), refresh() callbacks.
 
virtual cbres_t idaapi ins (sizevec_t *) new api
 User asked to insert an element.
 
virtual cbres_t idaapi del (sizevec_t *) new api
 User deleted elements. More...
 
virtual cbres_t idaapi edit (sizevec_t *) new api
 User asked to edit an element. More...
 
virtual cbres_t idaapi enter (sizevec_t *sel) new api
 User pressed the enter key. More...
 
virtual cbres_t idaapi refresh (sizevec_t *) new api
 The chooser needs to be refreshed. More...
 
virtual void idaapi select (const sizevec_t &) const newapi
 Selection changed. More...
 
virtual dirtree_t *idaapi get_dirtree () new api
 get the dirtree_t that will be used to present a tree-like structure to the user (see CH_HAS_DIRTREE) More...
 
virtual inode_t idaapi index_to_inode (size_t) const newapi
 Map an item index to a dirtree_t inode This is necessary only if CH_HAS_DIRTREE is specified. More...
 
virtual diffpos_t idaapi index_to_diffpos (size_t) const newapi
 Map an item index to a diffpos_t This is necessary only if CH_HAS_DIFF is specified. More...
 
virtual bool idaapi get_stdact_descs (chooser_stdact_desc_t *[NSTDPOPUPS]) new api
 Get the description of the standard chooser actions. More...
 
virtual bool idaapi do_lazy_load_dir (dirtree_t *, const qstring &) new api
 Callback for lazy-loaded, dirtree-based choosers; the function will be called when a folder is expanded and it has not been loaded before. More...
 
virtual size_t idaapi inode_to_index (inode_t) const newapi
 Map an a dirtree_t inode to the index This will be used only if CH_HAS_DIRTREE and CH2_HAS_INODE2INDEX are specified Implementing this function will result in increase overall performance especially for big choosers. More...
 
- Public Member Functions inherited from chooser_base_t
 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.
 

Protected Member Functions

ssize_t new_sel_after_del (const sizevec_t &sel) const
 
void adjust_last_item (sizevec_t *sel, size_t n) const
 
- Protected Member Functions inherited from chooser_base_t
void init_popup_names (const char *const default_popup_names[NSTDPOPUPS])
 

Static Protected Member Functions

static bool next_item_to_del (sizevec_t *sel)
 

Additional Inherited Members

- Public Types inherited from chooser_base_t
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 Attributes inherited from chooser_base_t
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 inherited from chooser_base_t
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 Attributes inherited from chooser_base_t
uint8 version = 3
 version of the class
 
uint8 reserved = 0
 
uint16 flags2
 Extended chooser flags
 
uint32 flags
 Generic chooser flags
 

Detailed Description

The chooser object with multi-selection.

Member Function Documentation

◆ get_item_index()

virtual void idaapi chooser_multi_t::get_item_index ( sizevec_t sel,
const void *  item_data 
) const
inlinevirtual

Get the positions of the items.

A simple chooser considers `item_data` as a list of indexes.

Parameters
[in,out]selitems indexes
item_datapointer to some data that identifies the items

◆ del()

virtual cbres_t idaapi chooser_multi_t::del ( sizevec_t )
inlinenewvirtual

User deleted elements.

Parameters
[in,out]selselected items
Returns
what is changed

◆ edit()

virtual cbres_t idaapi chooser_multi_t::edit ( sizevec_t )
inlinenewvirtual

User asked to edit an element.

Parameters
[in,out]selselected items
Returns
what is changed

◆ enter()

virtual cbres_t idaapi chooser_multi_t::enter ( sizevec_t sel)
inlinenewvirtual

User pressed the enter key.

Parameters
[in,out]selselected items
Returns
what is changed

◆ refresh()

virtual cbres_t idaapi chooser_multi_t::refresh ( sizevec_t )
inlinenewvirtual

The chooser needs to be refreshed.

It returns the new positions of the selected items.

Parameters
[in,out]selselected items
Returns
what is changed

◆ select()

virtual void idaapi chooser_multi_t::select ( const sizevec_t ) const
inlinevirtual

Selection changed.

Note
This callback is not supported in the txt-version.
Parameters
selnew selected items

◆ get_dirtree()

virtual dirtree_t *idaapi chooser_multi_t::get_dirtree ( )
inlinenewvirtual

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

Returns
the dirtree_t, or nullptr

◆ index_to_inode()

virtual inode_t idaapi chooser_multi_t::index_to_inode ( size_t  ) const
inlinevirtual

Map an item index to a dirtree_t inode This is necessary only if CH_HAS_DIRTREE is specified.

Parameters
nindex of the item
Returns
the inode number

◆ index_to_diffpos()

virtual diffpos_t idaapi chooser_multi_t::index_to_diffpos ( size_t  ) const
inlinevirtual

Map an item index to a diffpos_t This is necessary only if CH_HAS_DIFF is specified.

Parameters
nindex of the item
Returns
the diffpos

◆ get_stdact_descs()

virtual bool idaapi chooser_multi_t::get_stdact_descs ( chooser_stdact_desc_t [NSTDPOPUPS])
inlinenewvirtual

Get the description of the standard chooser actions.

This method is called when creating the chooser widget. It should fill the array of pointers to the action description. 'nullptr' means that the default action attributes will be used.

Note
Availability of the standard actions is determined by the CH_CAN_... flags.
Parameters
[out]ucbsthe array of pointers to the description structure
Return values
trueUCBS is filled
falseno custom standard actions

◆ do_lazy_load_dir()

virtual bool idaapi chooser_multi_t::do_lazy_load_dir ( dirtree_t ,
const qstring  
)
inlinenewvirtual

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.

Note
The dirtree is chdir()-positioned to the directory being loaded, so relative paths (like simple filenames) may be useful.
Parameters
dtdirtree used to fill the directory in
dir_pathan absolute dirtree path to this directory
Returns
success

◆ inode_to_index()

virtual size_t idaapi chooser_multi_t::inode_to_index ( inode_t  ) const
inlinevirtual

Map an a dirtree_t inode to the index This will be used only if CH_HAS_DIRTREE and CH2_HAS_INODE2INDEX are specified Implementing this function will result in increase overall performance especially for big choosers.

Parameters
inodeinode of the item
Returns
the index

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