wex v24.10.0
|
Combines del::listview and file, giving you a list control with file synchronization support. More...
#include <wex/del/listview-file.h>
Public Member Functions | |
file (const wex::path &path, const data::listview &data=data::listview()) | |
Constructor for a data::listview::FILE, opens the file. | |
~file () override | |
Destructor. | |
void | add_items (const std::string &folder, const std::string &files, const data::dir::type_t &flags) |
Adds items. | |
file & | get_file () |
Returns the file. | |
bool | is_contents_changed () const final |
Returns whether contents have been changed. | |
bool | item_from_text (const std::string &text) final |
Inserts new item with column values from text. | |
void | reset_contents_changed () final |
Resets contents changed. | |
Public Member Functions inherited from wex::del::listview | |
listview (const data::listview &data=data::listview()) | |
Default constructor. | |
bool | Destroy () override |
Destroys the window safely. | |
Public Member Functions inherited from wex::listview | |
listview (const data::listview &data=data::listview()) | |
Default constructor. | |
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. | |
Public Member Functions inherited from wex::file | |
file () | |
Default constructor. | |
file (const path &p) | |
Constructor taking a path. | |
file (const char *filename) | |
Constructor taking a filename. | |
file (const path &p, std::ios_base::openmode mode) | |
Constructor taking a path, opens the file. | |
file (const char *filename, std::ios_base::openmode mode) | |
Constructor taking a filename, opens the file. | |
file (const file &rhs) | |
Copy constructor. | |
file & | operator= (const file &f) |
Assignment operator. | |
bool | check_sync () |
Checks whether this file can be synced, and syncs (invokes do_file_load) the file if so. | |
bool | close () |
Closes the file. | |
bool | file_load (const path &p) |
Sets the path, opens the file if asked for, invokes do_file_load, and closes the file again (unless use_stream was invoked). | |
bool | file_new (const path &p) |
Sets the path and invokes do_file_new. | |
bool | file_save (const wex::path &p=wex::path()) |
Sets the path if path is ok, opens the file if asked for, invokes do_file_save, and closes the file again. | |
bool | is_open () const |
Returns true if file is open. | |
bool | is_written () const |
Returns true if file has been written. | |
bool | open (std::ios_base::openmode mode=std::ios_base::in) |
Opens current path. | |
bool | open (const path &p, std::ios_base::openmode mode=std::ios_base::in) |
Opens specified path. | |
const wex::path & | path () const |
Returns the path. | |
wex::path & | path () |
Returns the path. | |
const std::string * | read (std::streampos seek_position=0) |
Reads this file into a buffer. | |
std::fstream & | stream () |
Returns stream. | |
void | use_stream (bool use=true) |
Default file is closed after loading, if you call this method, stream remains open. | |
bool | write (std::span< const char > buffer) |
Writes file from buffer. | |
bool | write (const std::string &s) |
Writes file from string. | |
Additional Inherited Members | |
Static Public Member Functions inherited from wex::del::listview | |
static data::listview::type_t | type_tool (const tool &tool) |
Returns list type from tool id. | |
Static Public Member Functions inherited from wex::listview | |
static int | config_dialog (const data::window &data=data::window()) |
Shows a dialog with options, returns dialog return code. | |
Protected Member Functions inherited from wex::del::listview | |
void | build_popup_menu (menu &menu) override |
Builds the popup menu. | |
Combines del::listview and file, giving you a list control with file synchronization support.
|
finalvirtual |
Inserts new item with column values from text.
Items are separated by newlines, columns by a field separator. Returns true if successful.
Reimplemented from wex::listview.