Nana C++ Library. Reference for users.
What we need to use nana
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
nana::filebox Class Reference

Create an Open or Save dialog box to let user select the name of a file. More...

Classes

struct  implement
 

Public Types

using path_type = std::filesystem::path
 

Public Member Functions

 filebox (window owner, bool is_open_mode)
 
 filebox (const filebox &)
 
 ~filebox ()
 
fileboxoperator= (const filebox &)
 
void owner (window handle)
 Change owner window. More...
 
fileboxtitle (::std::string text)
 Changes new title. More...
 
fileboxinit_path (const path_type &path)
 Sets a initial path. More...
 
fileboxinit_file (const ::std::string &filename)
 Sets a initial filename. More...
 
fileboxadd_filter (const ::std::string &description, const ::std::string &filetype)
 Add a filetype filter. More...
 
fileboxadd_filter (const std::vector< std::pair< std::string, std::string >> &filters)
 
const path_typepath () const
 
fileboxallow_multi_select (bool allow)
 
std::vector< path_typeshow () const
 Display the filebox dialog. More...
 
std::vector< path_typeoperator() () const
 a function object method alternative to show() to display the filebox dialog, More...
 

Detailed Description

Create an Open or Save dialog box to let user select the name of a file.

Examples:
filebox-txt.cpp, and notepad.cpp.

Member Typedef Documentation

using nana::filebox::path_type = std::filesystem::path

Constructor & Destructor Documentation

nana::filebox::filebox ( window  owner,
bool  is_open_mode 
)
nana::filebox::filebox ( const filebox other)
nana::filebox::~filebox ( )

Member Function Documentation

filebox& nana::filebox::add_filter ( const ::std::string description,
const ::std::string filetype 
)

Add a filetype filter.

To specify multiple filter in a single description, use a semicolon to separate the patterns(for example,"*.TXT;*.DOC;*.BAK").

Parameters
descriptionfor example: "Text File"
filetypefilter pattern(for example: "*.TXT")
Examples:
filebox-txt.cpp, and notepad.cpp.
filebox & nana::filebox::add_filter ( const std::vector< std::pair< std::string, std::string >> &  filters)
filebox & nana::filebox::allow_multi_select ( bool  allow)
filebox & nana::filebox::init_file ( const ::std::string filename)

Sets a initial filename.

Suggest a filename when filebox starts. If the filename contains a path, the initial path will be replaced with the path presents in initial filename.

Parameters
filenamea filename used for a initial filename when filebox starts.
Returns
reference of *this.Init file, if it contains a path, the init path is replaced by the path of init file.
filebox & nana::filebox::init_path ( const path_type path)

Sets a initial path.

Suggest initial path used to locate a directory when the filebox starts.

Note
the behavior of init_path is different between Win7 and Win2K/XP/Vista, but its behavior under Linux is conformed with Win7.
Parameters
patha path of initial directory
Returns
reference of *this.
std::vector<path_type> nana::filebox::operator() ( ) const
inline

a function object method alternative to show() to display the filebox dialog,

filebox & nana::filebox::operator= ( const filebox other)
void nana::filebox::owner ( window  handle)

Change owner window.

Changes the owner window for the filebox. When show()/operator()# are invoked, the dialog of filebox will be created with the specified owner.

Parameters
handleA handle to a window which will be used for the owner of filebox
const filebox::path_type & nana::filebox::path ( ) const
std::vector< filebox::path_type > nana::filebox::show ( ) const

Display the filebox dialog.

Examples:
notepad.cpp.
filebox & nana::filebox::title ( ::std::string  text)

Changes new title.

Changes the title. When show()/operator()# are invoked, the dialog of filebox will be created with the specified title.

Parameters
textText of title
Returns
the reference of *this.