wex v24.10.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
wex::listview Class Reference

Adds printing, popup menu, images, columns and items to wxListView. More...

#include <wex/ui/listview.h>

Inheritance diagram for wex::listview:
Inheritance graph
[legend]

Public Member Functions

 listview (const data::listview &data=data::listview())
 Default constructor.
 
virtual bool item_from_text (const std::string &text)
 Inserts new item with column values from text.
 
virtual const std::string item_to_text (long item_number) const
 Copies the specified item (all columns) to text.
 
virtual void items_update ()
 Implement this one if you have images that might be changed after sorting etc.
 
void clear ()
 Clears all items.
 
void config_get ()
 Sets the configurable parameters to values currently in config.
 
const auto & data () const
 Returns associated data.
 
const auto & field_separator () const
 Returns the field separator.
 
int find_column (const std::string &name) const
 If column is not found, -1 is returned,.
 
const std::string get_item_text (long item_number, const std::string &col_name=std::string()) const
 Returns the item text using item number and column name.
 
bool insert_item (const std::vector< std::string > &item, long index=-1)
 Inserts item with provided columns.
 
bool load (const strings_t &l)
 Loads listview from list.
 
const strings_t save () const
 Saves listview to list.
 
bool set_item (long index, int column, const std::string &label)
 Sets an item string field at a particular column.
 
bool set_item_image (long item_number, const wxArtID &artid)
 Sets the item image, using the image list.
 
bool sort_column (const std::string &column_name, sort_t sort_method=SORT_TOGGLE)
 Sorts on a column specified by column name.
 
bool sort_column (int column_no, sort_t sort_method=SORT_TOGGLE)
 Sorts on a column.
 
void sort_column_reset ()
 Resets column that was used for sorting.
 
int sorted_column_no () const
 Returns current sorted column no.
 
bool append_columns (const std::vector< column > &cols) override
 Appends new columns.
 
bool find_next (const std::string &text, bool find_next=true) override
 Finds next.
 
void print () override
 Prints the list.
 
void print_preview () override
 Previews the list.
 
- Public Member Functions inherited from wex::factory::listview
 listview (const data::window &w=data::window(), const data::control &c=data::control())
 Default constructor.
 

Static Public Member Functions

static int config_dialog (const data::window &data=data::window())
 Shows a dialog with options, returns dialog return code.
 

Protected Member Functions

virtual void after_sorting ()
 Invoked after sorting, allows you to do something extra.
 
virtual void build_popup_menu (menu &menu)
 Builds the popup menu.
 

Detailed Description

Adds printing, popup menu, images, columns and items to wxListView.

Allows for sorting on any column. Adds some standard lists, all these lists have items associated with files or folders.

Member Function Documentation

◆ append_columns()

bool wex::listview::append_columns ( const std::vector< column > & cols)
overridevirtual

Appends new columns.

Returns false if appending a column failed.

Reimplemented from wex::factory::listview.

◆ config_dialog()

static int wex::listview::config_dialog ( const data::window & data = data::window())
static

Shows a dialog with options, returns dialog return code.

If used modeless, it uses the dialog id as specified, so you can use that id in frame::on_command_item_dialog.

◆ get_item_text()

const std::string wex::listview::get_item_text ( long item_number,
const std::string & col_name = std::string() ) const

Returns the item text using item number and column name.

If you do not specify a column, the item label is returned (this is also valid in non report mode).

◆ insert_item()

bool wex::listview::insert_item ( const std::vector< std::string > & item,
long index = -1 )

Inserts item with provided columns.

Returns false if inserting fails, or item is empty.

Parameters
itemthe item
indexif index -1, appends item, otherwise inserts before index

◆ item_from_text()

virtual bool wex::listview::item_from_text ( const std::string & text)
virtual

Inserts new item with column values from text.

Items are separated by newlines, columns by a field separator. Returns true if successful.

Reimplemented in wex::del::file.

◆ item_to_text()

virtual const std::string wex::listview::item_to_text ( long item_number) const
virtual

Copies the specified item (all columns) to text.

If item_number = -1, copies all items.

◆ set_item()

bool wex::listview::set_item ( long index,
int column,
const std::string & label )

Sets an item string field at a particular column.

Returns false if an error occurred.

◆ set_item_image()

bool wex::listview::set_item_image ( long item_number,
const wxArtID & artid )

Sets the item image, using the image list.

If the listview does not already contain the image, it is added. Returns false if an error occurred.

◆ sort_column() [1/2]

bool wex::listview::sort_column ( const std::string & column_name,
sort_t sort_method = SORT_TOGGLE )
inline

Sorts on a column specified by column name.

Returns true if column was sorted.

◆ sort_column() [2/2]

bool wex::listview::sort_column ( int column_no,
sort_t sort_method = SORT_TOGGLE )

Sorts on a column.

If you did not specify IMAGE_NONE, the column that is sorted gets an image (wxART_GO_DOWN or wxART_GO_UP), depending on whether it is sorted ascending or descending. By using wxArtProvider CreateBitmap you can override this image to provide your own one.