$szTitle = "wxfiledialog"; include "./_header.inc"; ?>
this class represents the file chooser dialog.
derived from
wxdialog
wxwindow
wxevthandler
wxobject
include files
<wx/filedlg.h>
window styles
wxfd_default_style | equivalent to wxfd_open. |
wxfd_open | this is an open dialog; usually this means that the default button's label of the dialog is "open". cannot be combined with wxfd_save. |
wxfd_save | this is a save dialog; usually this means that the default button's label of the dialog is "save". cannot be combined with wxfd_open. |
wxfd_overwrite_prompt | for save dialog only: prompt for a confirmation if a file will be overwritten. |
wxfd_file_must_exist | for open dialog only: the user may only select files that actually exist. |
wxfd_multiple | for open dialog only: allows selecting multiple files. |
wxfd_change_dir | change the current working directory to the directory where the file(s) chosen by the user are. |
wxfd_preview | show the preview of the selected files (currently only supported by wxgtk using gtk+ 2.4 or later). |
nb: previous versions of wxwidgets used wxfd_change_dir by default under ms windows which allowed the program to simply remember the last directory where user selected the files to open/save. this (desired) functionality must be implemented in the program itself now (manually remember the last path used and pass it to the dialog the next time it is called) or by using this flag.
see also
wxfiledialog overview, wxfileselector
remarks
pops up a file selector box. in windows and gtk2.4+, this is the common file selector dialog. in x, this is a file selector box with somewhat less functionality. the path and filename are distinct elements of a full file pathname. if path is "", the current directory will be used. if filename is "", no default filename will be supplied. the wildcard determines what files are displayed in the file selector, and file extension supplies a type extension for the required filename.
both the x and windows versions implement a wildcard filter. typing a filename containing wildcards (*, ?) in the filename text item, and clicking on ok, will result in only those files matching the pattern being displayed. the wildcard may be a specification for multiple types of file with a description for each, such as:
"bmp and gif files (*.bmp;*.gif)|*.bmp;*.gif|png files (*.png)|*.png"it must be noted that wildcard support in the native motif file dialog is quite limited: only one alternative is supported, and it is displayed without the descriptive test; "bmp files (*.bmp)|*.bmp'' is displayed as "*.bmp'', and both "bmp files (*.bmp)|*.bmp|gif files (*.gif)|*.gif'' and "image files|*.bmp;*.gif'' are errors.
members
wxfiledialog::wxfiledialog
wxfiledialog::~wxfiledialog
wxfiledialog::getdirectory
wxfiledialog::getfilename
wxfiledialog::getfilenames
wxfiledialog::getfilterindex
wxfiledialog::getmessage
wxfiledialog::getpath
wxfiledialog::getpaths
wxfiledialog::getwildcard
wxfiledialog::setdirectory
wxfiledialog::setfilename
wxfiledialog::setfilterindex
wxfiledialog::setmessage
wxfiledialog::setpath
wxfiledialog::setwildcard
wxfiledialog::showmodal
wxfiledialog(wxwindow* parent, const wxstring& message = "choose a file", const wxstring& defaultdir = "", const wxstring& defaultfile = "", const wxstring& wildcard = "*.*", long style = wxfd_default_style, const wxpoint& pos = wxdefaultposition, const wxsize& sz = wxdefaultsize, const wxstring& name = "filedlg")
constructor. use wxfiledialog::showmodal to show the dialog.
parameters
parent
message
defaultdir
defaultfile
wildcard
note that the native motif dialog has some limitations with respect to wildcards; see the remarks section above.
style
pos
size
name
~wxfiledialog()
destructor.
wxstring getdirectory() const
returns the default directory.
wxstring getfilename() const
returns the default filename.
void getfilenames(wxarraystring& filenames) const
fills the array filenames with the names of the files chosen. this function should only be used with the dialogs which have wxmultiple style, use getfilename for the others.
note that under windows, if the user selects shortcuts, the filenames include paths, since the application cannot determine the full path of each referenced file by appending the directory containing the shortcuts to the filename.
int getfilterindex() const
returns the index into the list of filters supplied, optionally, in the wildcard parameter. before the dialog is shown, this is the index which will be used when the dialog is first displayed. after the dialog is shown, this is the index selected by the user.
wxstring getmessage() const
returns the message that will be displayed on the dialog.
wxstring getpath() const
returns the full path (directory and filename) of the selected file.
void getpaths(wxarraystring& paths) const
fills the array paths with the full paths of the files chosen. this function should only be used with the dialogs which have wxmultiple style, use getpath for the others.
wxstring getwildcard() const
returns the file dialog wildcard.
void setdirectory(const wxstring& directory)
sets the default directory.
void setfilename(const wxstring& setfilename)
sets the default filename.
void setfilterindex(int filterindex)
sets the default filter index, starting from zero.
void setmessage(const wxstring& message)
sets the message that will be displayed on the dialog.
void setpath(const wxstring& path)
sets the path (the combined directory and filename that will be returned when the dialog is dismissed).
void setwildcard(const wxstring& wildcard)
sets the wildcard, which can contain multiple file types, for example:
"bmp files (*.bmp)|*.bmp|gif files (*.gif)|*.gif"
note that the native motif dialog has some limitations with respect to wildcards; see the remarks section above.
int showmodal()
shows the dialog, returning wxid_ok if the user pressed ok, and wxid_cancel otherwise.
include "./_footer.inc"; ?>