X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae3c17b4013e80b99976c750c19fca47729517f6..7e4952db837344e369ff9ccc7ece1f7b8c207cf1:/interface/wx/filedlg.h diff --git a/interface/wx/filedlg.h b/interface/wx/filedlg.h index ada7bba196..57f09528c3 100644 --- a/interface/wx/filedlg.h +++ b/interface/wx/filedlg.h @@ -8,16 +8,14 @@ /** @class wxFileDialog - @wxheader{filedlg.h} 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. + If path is wxEmptyString, the current directory will be used. + If filename is wxEmptyString, 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 @@ -25,7 +23,9 @@ 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: + @code "BMP and GIF files (*.bmp;*.gif)|*.bmp;*.gif|PNG files (*.png)|*.png" + @endcode 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 @@ -53,13 +53,13 @@ file(s) chosen by the user are. @style{wxFD_PREVIEW} Show the preview of the selected files (currently only supported by - wxGTK using GTK+ 2.4 or later). + wxGTK). @endStyleTable @library{wxcore} @category{cmndlg} - @see @ref overview_wxfiledialog, ::wxFileSelector() + @see @ref overview_cmndlg_file, ::wxFileSelector() */ class wxFileDialog : public wxDialog { @@ -89,35 +89,37 @@ public: Dialog name. Not implemented. */ wxFileDialog(wxWindow* parent, - const wxString& message = "Choose a file", - const wxString& defaultDir = "", - const wxString& defaultFile = "", - const wxString& wildcard = ".", + const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildcard = wxFileSelectorDefaultWildcardStr, long style = wxFD_DEFAULT_STYLE, const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = "filedlg"); + const wxSize& size = wxDefaultSize, + const wxString& name = wxFileDialogNameStr); /** Destructor. */ - ~wxFileDialog(); + virtual ~wxFileDialog(); /** Returns the default directory. */ - wxString GetDirectory() const; + virtual wxString GetDirectory() const; /** If functions SetExtraControlCreator() and ShowModal() were called, returns the extra window. Otherwise returns @NULL. + + @since 2.9.0 */ wxWindow* GetExtraControl() const; /** Returns the default filename. */ - wxString GetFilename() const; + virtual wxString GetFilename() const; /** Fills the array @a filenames with the names of the files chosen. @@ -130,7 +132,7 @@ public: of each referenced file by appending the directory containing the shortcuts to the filename. */ - void GetFilenames(wxArrayString& filenames) const; + virtual void GetFilenames(wxArrayString& filenames) const; /** Returns the index into the list of filters supplied, optionally, in the @@ -141,17 +143,17 @@ public: After the dialog is shown, this is the index selected by the user. */ - int GetFilterIndex() const; + virtual int GetFilterIndex() const; /** Returns the message that will be displayed on the dialog. */ - wxString GetMessage() const; + virtual wxString GetMessage() const; /** Returns the full path (directory and filename) of the selected file. */ - wxString GetPath() const; + virtual wxString GetPath() const; /** Fills the array @a paths with the full paths of the files chosen. @@ -159,17 +161,24 @@ public: This function should only be used with the dialogs which have @c wxFD_MULTIPLE style, use GetPath() for the others. */ - void GetPaths(wxArrayString& paths) const; + virtual void GetPaths(wxArrayString& paths) const; /** Returns the file dialog wildcard. */ - wxString GetWildcard() const; + virtual wxString GetWildcard() const; /** Sets the default directory. */ - void SetDirectory(const wxString& directory); + virtual void SetDirectory(const wxString& directory); + + /** + The type of function used as an argument for SetExtraControlCreator(). + + @since 2.9.0 + */ + typedef wxWindow *(*ExtraControlCreatorFunction)(wxWindow*); /** Customize file dialog by adding extra window, which is typically placed @@ -180,30 +189,32 @@ public: 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. + Supported platforms: wxGTK, wxMSW, wxUniv. + + @since 2.9.0 */ - bool SetExtraControlCreator(t_extraControlCreator creator); + bool SetExtraControlCreator(ExtraControlCreatorFunction creator); /** Sets the default filename. */ - void SetFilename(const wxString& setfilename); + virtual void SetFilename(const wxString& setfilename); /** Sets the default filter index, starting from zero. */ - void SetFilterIndex(int filterIndex); + virtual void SetFilterIndex(int filterIndex); /** Sets the message that will be displayed on the dialog. */ - void SetMessage(const wxString& message); + virtual void SetMessage(const wxString& message); /** Sets the path (the combined directory and filename that will be returned when the dialog is dismissed). */ - void SetPath(const wxString& path); + virtual void SetPath(const wxString& path); /** Sets the wildcard, which can contain multiple file types, for example: @@ -212,13 +223,13 @@ public: Note that the native Motif dialog has some limitations with respect to wildcards; see the Remarks section above. */ - void SetWildcard(const wxString& wildCard); + virtual void SetWildcard(const wxString& wildCard); /** Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL otherwise. */ - int ShowModal(); + virtual int ShowModal(); }; @@ -227,7 +238,7 @@ public: // Global functions/macros // ============================================================================ -/** @ingroup group_funcmacro_dialog */ +/** @addtogroup group_funcmacro_dialog */ //@{ /** @@ -271,9 +282,9 @@ public: @header{wx/filedlg.h} */ wxString wxFileSelector(const wxString& message, - const wxString& default_path = "", - const wxString& default_filename = "", - const wxString& default_extension = "", + const wxString& default_path = wxEmptyString, + const wxString& default_filename = wxEmptyString, + const wxString& default_extension = wxEmptyString, const wxString& wildcard = ".", int flags = 0, wxWindow* parent = NULL,