wex v24.10.0
|
Offers file history methods. More...
#include <wex/ui/file-history.h>
Public Member Functions | |
file_history (size_t max_files=9, wxWindowID id_base=wxID_FILE1, const std::string &key=std::string()) | |
Default constructor. | |
~file_history () | |
Destructor. | |
const path | operator[] (size_t index) const |
Returns the path at this index (zero-based). | |
bool | append (const path &p) |
Appends a file (if file exists) to the file history list. | |
void | clear () |
Clears history. | |
bool | empty () const |
Returns true if history is empty. | |
wxWindowID | get_base_id () const |
Returns baseid. | |
std::vector< path > | get_history_files (size_t max) const |
Returns a vector of max recent opened files. | |
size_t | get_max_files () const |
Returns max files. | |
void | popup_menu (wxWindow *win, int clear_id=-1, const wxPoint &pos=wxDefaultPosition) const |
Shows popup menu containing all recent opened files. | |
void | save () |
Saves the file history into the config. | |
size_t | size () const |
Returns number of items. | |
void | use_menu (wxWindowID id, wex::menu *menu) |
Adds a recent file submenu to specified menu, and sets the file history to use it. | |
Offers file history methods.
wex::file_history::file_history | ( | size_t | max_files = 9, |
wxWindowID | id_base = wxID_FILE1, | ||
const std::string & | key = std::string() ) |
Default constructor.
Fills the file history with items available from the config.
max_files | max number of files to use |
id_base | base for menu id |
key | if key is empty string, files are loaded / saved to default keys, otherwise to specified key. |
bool wex::file_history::append | ( | const path & | p | ) |
Appends a file (if file exists) to the file history list.
Returns true if file is appended.
void wex::file_history::popup_menu | ( | wxWindow * | win, |
int | clear_id = -1, | ||
const wxPoint & | pos = wxDefaultPosition ) const |
Shows popup menu containing all recent opened files.
win | window which will get the popup menu |
clear_id | adds a clear menu items as well (if not -1) |
pos | position for popup menu |