wex v24.10.0
|
Adds printing, popup menu, images, columns and items to wxListView. More...
#include <wex/ui/listview.h>
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. | |
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.
|
overridevirtual |
Appends new columns.
Returns false if appending a column failed.
Reimplemented from wex::factory::listview.
|
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.
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).
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.
item | the item |
index | if index -1, appends item, otherwise inserts before index |
|
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.
|
virtual |
Copies the specified item (all columns) to text.
If item_number = -1, copies all items.
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.
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.
|
inline |
Sorts on a column specified by column name.
Returns true if column was sorted.
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.