X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/674d80a76ff5db54cfb03de20853fba6d739832a..81a887a895e89622649ff394820800e2071fe6df:/interface/wx/filepicker.h diff --git a/interface/wx/filepicker.h b/interface/wx/filepicker.h index 6fdd64aa5c..40cd69a499 100644 --- a/interface/wx/filepicker.h +++ b/interface/wx/filepicker.h @@ -3,9 +3,28 @@ // Purpose: interface of wxFilePickerCtrl // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +#define wxFLP_OPEN 0x0400 +#define wxFLP_SAVE 0x0800 +#define wxFLP_OVERWRITE_PROMPT 0x1000 +#define wxFLP_FILE_MUST_EXIST 0x2000 +#define wxFLP_CHANGE_DIR 0x4000 +#define wxFLP_SMALL wxPB_SMALL +#define wxFLP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) +#define wxFLP_DEFAULT_STYLE (wxFLP_OPEN|wxFLP_FILE_MUST_EXIST) + +#define wxDIRP_DIR_MUST_EXIST 0x0008 +#define wxDIRP_CHANGE_DIR 0x0010 +#define wxDIRP_SMALL wxPB_SMALL +#define wxDIRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL) +#define wxDIRP_DEFAULT_STYLE (wxDIRP_DIR_MUST_EXIST) + +wxEventType wxEVT_COMMAND_FILEPICKER_CHANGED; +wxEventType wxEVT_COMMAND_DIRPICKER_CHANGED; + + /** @class wxFilePickerCtrl @@ -37,10 +56,13 @@ existing file. @style{wxFLP_CHANGE_DIR} Change current working directory on each user file selection change. + @style{wxFLP_SMALL} + Use smaller version of the control with a small "..." button instead + of the normal "Browse" one. This flag is new since wxWidgets 2.9.3. @endStyleTable - @beginEventTable{wxFileDirPickerEvent} + @beginEventEmissionTable{wxFileDirPickerEvent} @event{EVT_FILEPICKER_CHANGED(id, func)} The user changed the file selected in the control either using the button or using text control (see wxFLP_USE_TEXTCTRL; note that in @@ -50,26 +72,28 @@ @library{wxcore} @category{pickers} - + @appearance{filepickerctrl.png} @see wxFileDialog, wxFileDirPickerEvent */ class wxFilePickerCtrl : public wxPickerBase { public: + wxFilePickerCtrl(); + /** Initializes the object and calls Create() with all the parameters. */ wxFilePickerCtrl(wxWindow* parent, wxWindowID id, const wxString& path = wxEmptyString, - const wxString& message = "Select a file", - const wxString& wildcard = ".", + const wxString& message = wxFileSelectorPromptStr, + const wxString& wildcard = wxFileSelectorDefaultWildcardStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxFLP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, - const wxString& name = "filepickerctrl"); + const wxString& name = wxFilePickerCtrlNameStr); /** Creates this widget with the given parameters. @@ -93,7 +117,7 @@ public: @param style The window style, see wxFLP_* flags. @param validator - Validator which can be used for additional date checks. + Validator which can be used for additional data checks. @param name Control name. @@ -102,13 +126,13 @@ public: */ bool Create(wxWindow* parent, wxWindowID id, const wxString& path = wxEmptyString, - const wxString& message = "Select a file", - const wxString& wildcard = ".", + const wxString& message = wxFileSelectorPromptStr, + const wxString& wildcard = wxFileSelectorDefaultWildcardStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxFLP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, - const wxString& name = "filepickerctrl"); + const wxString& name = wxFilePickerCtrlNameStr); /** Similar to GetPath() but returns the path of the currently selected @@ -127,6 +151,20 @@ public: */ void SetFileName(const wxFileName& filename); + /** + Set the directory to show when starting to browse for files. + + This function is mostly useful for the file picker controls which have + no selection initially to configure the directory that should be shown + if the user starts browsing for files as otherwise the directory of + initially selected file is used, which is usually the desired + behaviour and so the directory specified by this function is ignored in + this case. + + @since 2.9.4 + */ + void SetInitialDirectory(const wxString& dir); + /** Sets the absolute path of the currently selected file. This must be a valid file if the @c wxFLP_FILE_MUST_EXIST style was given. @@ -161,9 +199,12 @@ public: support its absence. @style{wxDIRP_CHANGE_DIR} Change current working directory on each user directory selection change. + @style{wxDIRP_SMALL} + Use smaller version of the control with a small "..." button instead + of the normal "Browse" one. This flag is new since wxWidgets 2.9.3. @endStyleTable - @beginEventTable{wxFileDirPickerEvent} + @beginEventEmissionTable{wxFileDirPickerEvent} @event{EVT_DIRPICKER_CHANGED(id, func)} The user changed the directory selected in the control either using the button or using text control (see wxDIRP_USE_TEXTCTRL; note that in this @@ -174,25 +215,27 @@ public: @library{wxcore} @category{pickers} - + @appearance{dirpickerctrl.png} @see wxDirDialog, wxFileDirPickerEvent */ class wxDirPickerCtrl : public wxPickerBase { public: + wxDirPickerCtrl(); + /** Initializes the object and calls Create() with all the parameters. */ wxDirPickerCtrl(wxWindow* parent, wxWindowID id, const wxString& path = wxEmptyString, - const wxString& message = "Select a folder", + const wxString& message = wxDirSelectorPromptStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDIRP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, - const wxString& name = "dirpickerctrl"); + const wxString& name = wxDirPickerCtrlNameStr); /** Creates the widgets with the given parameters. @@ -222,12 +265,12 @@ public: */ bool Create(wxWindow* parent, wxWindowID id, const wxString& path = wxEmptyString, - const wxString& message = "Select a folder", + const wxString& message = wxDirSelectorPromptStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDIRP_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, - const wxString& name = "dirpickerctrl"); + const wxString& name = wxDirPickerCtrlNameStr); /** Returns the absolute path of the currently selected directory as a @@ -246,6 +289,20 @@ public: */ void SetDirName(const wxFileName& dirname); + /** + Set the directory to show when starting to browse for directories. + + This function is mostly useful for the directory picker controls which + have no selection initially to configure the directory that should be + shown if the user starts browsing for directories as otherwise the + initially selected directory is used, which is usually the desired + behaviour and so the directory specified by this function is ignored in + this case. + + @since 2.9.4 + */ + void SetInitialDirectory(const wxString& dir); + /** Sets the absolute path of (the default converter uses current locale's charset)the currently selected directory. @@ -277,12 +334,14 @@ public: class wxFileDirPickerEvent : public wxCommandEvent { public: + wxFileDirPickerEvent(); + /** The constructor is not normally used by the user code. */ wxFileDirPickerEvent(wxEventType type, wxObject* generator, int id, - const wxString path); + const wxString& path); /** Retrieve the absolute path of the file/directory the user has just selected.