This class represents the file chooser dialog.
Derived from
wxDialog
wxWindow
wxEvtHandler
wxObject
Include files
<wx/filedlg.h>
See also
wxFileDialog overview, wxFileSelector
Remarks
Pops up a file selector box. In Windows, 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. Flags may be a combination of wxOPEN, wxSAVE, wxOVERWRITE_PROMPT, wxHIDE_READONLY, wxFILE_MUST_EXIST, wxMULTIPLE or 0.
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 files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"Members
wxFileDialog::wxFileDialog
wxFileDialog::~wxFileDialog
wxFileDialog::GetDirectory
wxFileDialog::GetFilename
wxFileDialog::GetFilenames
wxFileDialog::GetFilterIndex
wxFileDialog::GetMessage
wxFileDialog::GetPath
wxFileDialog::GetPaths
wxFileDialog::GetStyle
wxFileDialog::GetWildcard
wxFileDialog::SetDirectory
wxFileDialog::SetFilename
wxFileDialog::SetFilterIndex
wxFileDialog::SetMessage
wxFileDialog::SetPath
wxFileDialog::SetStyle
wxFileDialog::SetWildcard
wxFileDialog::ShowModal
wxFileDialog(wxWindow* parent, const wxString& message = "Choose a file", const wxString& defaultDir = "", const wxString& defaultFile = "", const wxString& wildcard = "*.*", long style = 0, const wxPoint& pos = wxDefaultPosition)
Constructor. Use wxFileDialog::ShowModal to show the dialog.
Parameters
parent
message
defaultDir
defaultFile
wildcard
style
wxOPEN | This is an open dialog. |
wxSAVE | This is a save dialog. |
wxHIDE_READONLY | Hide read-only files. |
wxOVERWRITE_PROMPT | Prompt for a conformation if a file will be overridden. |
wxMULTIPLE | For open dialog only: allows selecting multiple files |
pos
~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.
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.
long GetStyle() const
Returns the dialog style.
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. Windows only.
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 SetStyle(long style)
Sets the dialog style. See wxFileDialog::wxFileDialog for details.
void SetWildcard(const wxString& wildCard)
Sets the wildcard, which in Windows can contain multiple file types.
int ShowModal()
Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL otherwise.