/////////////////////////////////////////////////////////////////////////////
// Name: filedlg.h
-// Purpose: documentation for wxFileDialog class
+// Purpose: interface of wxFileDialog
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
This class represents the file chooser dialog.
+ It pops up a file selector box (native for Windows and GTK2.4+).
+
+ 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.
+
+ @remarks
+ All implementations of the wxFileDialog provide 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.
+
@beginStyleTable
- @style{wxFD_DEFAULT_STYLE}:
+ @style{wxFD_DEFAULT_STYLE}
Equivalent to wxFD_OPEN.
- @style{wxFD_OPEN}:
+ @style{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.
- @style{wxFD_SAVE}:
+ button's label of the dialog is "Open". Cannot be combined with wxFD_SAVE.
+ @style{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.
- @style{wxFD_OVERWRITE_PROMPT}:
+ @style{wxFD_OVERWRITE_PROMPT}
For save dialog only: prompt for a confirmation if a file will be
overwritten.
- @style{wxFD_FILE_MUST_EXIST}:
- For open dialog only: the user may only select files that actually
- exist.
- @style{wxFD_MULTIPLE}:
+ @style{wxFD_FILE_MUST_EXIST}
+ For open dialog only: the user may only select files that actually exist.
+ @style{wxFD_MULTIPLE}
For open dialog only: allows selecting multiple files.
- @style{wxFD_CHANGE_DIR}:
+ @style{wxFD_CHANGE_DIR}
Change the current working directory to the directory where the
file(s) chosen by the user are.
- @style{wxFD_PREVIEW}:
+ @style{wxFD_PREVIEW}
Show the preview of the selected files (currently only supported by
wxGTK using GTK+ 2.4 or later).
@endStyleTable
@library{wxcore}
@category{cmndlg}
- @seealso
- @ref overview_wxfiledialogoverview "wxFileDialog overview", wxFileSelector
+ @see @ref overview_wxfiledialog, ::wxFileSelector()
*/
class wxFileDialog : public wxDialog
{
public:
/**
Constructor. Use ShowModal() to show the dialog.
-
+
@param parent
- Parent window.
-
+ Parent window.
@param message
- Message to show on the dialog.
-
+ Message to show on the dialog.
@param defaultDir
- The default directory, or the empty string.
-
+ The default directory, or the empty string.
@param defaultFile
- The default filename, or the empty string.
-
+ The default filename, or the empty string.
@param wildcard
- A wildcard, such as "*.*" or "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.
-
+ A wildcard, such as "*.*" or "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.
@param style
- A dialog style. See wxFD_* styles for more info.
-
+ A dialog style. See wxFD_* styles for more info.
@param pos
- Dialog position. Not implemented.
-
+ Dialog position. Not implemented.
@param size
- Dialog size. Not implemented.
-
+ Dialog size. Not implemented.
@param name
- Dialog name. Not implemented.
+ Dialog name. Not implemented.
*/
wxFileDialog(wxWindow* parent,
const wxString& message = "Choose a file",
/**
Returns the default directory.
*/
- wxString GetDirectory();
+ wxString GetDirectory() const;
/**
- If functions
- SetExtraControlCreator()
- and ShowModal() were called,
+ If functions SetExtraControlCreator() and ShowModal() were called,
returns the extra window. Otherwise returns @NULL.
*/
- wxWindow* GetExtraControl();
+ wxWindow* GetExtraControl() const;
/**
Returns the default filename.
*/
- wxString GetFilename();
+ wxString GetFilename() const;
/**
- Fills the array @e filenames with the names of the files chosen. This
- function should only be used with the dialogs which have @c wxFD_MULTIPLE style,
+ Fills the array @a filenames with the names of the files chosen.
+
+ This function should only be used with the dialogs which have @c wxFD_MULTIPLE 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.
*/
- void GetFilenames(wxArrayString& filenames);
+ void GetFilenames(wxArrayString& filenames) 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.
*/
- int GetFilterIndex();
+ int GetFilterIndex() const;
/**
Returns the message that will be displayed on the dialog.
*/
- wxString GetMessage();
+ wxString GetMessage() const;
/**
Returns the full path (directory and filename) of the selected file.
*/
- wxString GetPath();
+ wxString GetPath() const;
/**
- Fills the array @e paths with the full paths of the files chosen. This
- function should only be used with the dialogs which have @c wxFD_MULTIPLE style,
+ Fills the array @a paths with the full paths of the files chosen.
+
+ This function should only be used with the dialogs which have @c wxFD_MULTIPLE style,
use GetPath() for the others.
*/
- void GetPaths(wxArrayString& paths);
+ void GetPaths(wxArrayString& paths) const;
/**
Returns the file dialog wildcard.
*/
- wxString GetWildcard();
+ wxString GetWildcard() const;
/**
Sets the default directory.
/**
Customize file dialog by adding extra window, which is typically placed
below the list of files and above the buttons.
-
- SetExtraControlCreator can be called only once, before calling
- ShowModal().
+
+ SetExtraControlCreator() can be called only once, before calling ShowModal().
+
The @c creator function should take pointer to parent window (file dialog)
and should return a window allocated with operator new.
-
+
Supported platforms: wxGTK, wxUniv.
*/
bool SetExtraControlCreator(t_extraControlCreator creator);
/**
Sets the wildcard, which can contain multiple file types, for example:
-
- "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
-
+ "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.
*/
};
+
// ============================================================================
// Global functions/macros
// ============================================================================
+/** @ingroup group_funcmacro_dialog */
+//@{
+
/**
Pops up a file selector box. In Windows, this is the common file selector
- dialog. In X, this is a file selector box with the same functionality.
- The path and filename are distinct elements of a full file pathname.
- If path is empty, the current directory will be used. If filename is empty,
- 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 wxFD_OPEN,
- wxFD_SAVE, wxFD_OVERWRITE_PROMPT or wxFD_FILE_MUST_EXIST. Note that
- wxFD_MULTIPLE
- can only be used with wxFileDialog and not here as this
- function only returns a single file name.
+ dialog. In X, this is a file selector box with the same functionality. The
+ path and filename are distinct elements of a full file pathname. If path
+ is empty, the current directory will be used. If filename is empty, 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
+ wxFD_OPEN, wxFD_SAVE, wxFD_OVERWRITE_PROMPT or wxFD_FILE_MUST_EXIST.
+
+ @note wxFD_MULTIPLE can only be used with wxFileDialog and not here since
+ this function only returns a single file name.
Both the Unix 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:
+ The wildcard may be a specification for multiple types of file with a
+ description for each, such as:
+
@code
"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
@endcode
The application must check for an empty return value (the user pressed
Cancel). For example:
+
@code
wxString filename = wxFileSelector("Choose a file to open");
if ( !filename.empty() )
}
//else: cancelled by user
@endcode
+
+ @header{wx/filedlg.h}
*/
wxString wxFileSelector(const wxString& message,
const wxString& default_path = "",
const wxString& default_extension = "",
const wxString& wildcard = ".",
int flags = 0,
- wxWindow * parent = @NULL,
+ wxWindow* parent = NULL,
int x = -1,
int y = -1);
+//@}
+