X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/adaaa68635b4c8a4d8c5284add40366ea3eefb07..7344108e8a129a3f9b4df5ab0f98a1713db03b89:/interface/wx/dirctrl.h diff --git a/interface/wx/dirctrl.h b/interface/wx/dirctrl.h index ab11ed588f..0b50fa03ac 100644 --- a/interface/wx/dirctrl.h +++ b/interface/wx/dirctrl.h @@ -3,9 +3,24 @@ // Purpose: interface of wxGenericDirCtrl // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +enum +{ + // Only allow directory viewing/selection, no files + wxDIRCTRL_DIR_ONLY = 0x0010, + // When setting the default path, select the first file in the directory + wxDIRCTRL_SELECT_FIRST = 0x0020, + // Use 3D borders on internal controls + wxDIRCTRL_3D_INTERNAL = 0x0080, + // Editable labels + wxDIRCTRL_EDIT_LABELS = 0x0100, + // Allow multiple selection + wxDIRCTRL_MULTIPLE = 0x0200 +}; + + /** @class wxGenericDirCtrl @@ -25,11 +40,13 @@ directory. @style{wxDIRCTRL_EDIT_LABELS} Allow the folder and file labels to be editable. + @style{wxDIRCTRL_MULTIPLE} + Allows multiple files and folders to be selected. @endStyleTable - @library{wxbase} + @library{wxcore} @category{ctrl} - + @appearance{genericdirctrl.png} */ class wxGenericDirCtrl : public wxControl { @@ -38,6 +55,7 @@ public: Default constructor. */ wxGenericDirCtrl(); + /** Main constructor. @@ -63,11 +81,11 @@ public: @param name The window name. */ - wxGenericDirCtrl(wxWindow* parent, const wxWindowID id = -1, + wxGenericDirCtrl(wxWindow* parent, const wxWindowID id = wxID_ANY, const wxString& dir = wxDirDialogDefaultFolderStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDIRCTRL_3D_INTERNAL|wxBORDER_SUNKEN, + long style = wxDIRCTRL_3D_INTERNAL, const wxString& filter = wxEmptyString, int defaultFilter = 0, const wxString& name = wxTreeCtrlNameStr); @@ -91,13 +109,12 @@ public: Create function for two-step construction. See wxGenericDirCtrl() for details. */ - bool Create(wxWindow* parent, const wxWindowID id = -1, + bool Create(wxWindow* parent, const wxWindowID id = wxID_ANY, const wxString& dir = wxDirDialogDefaultFolderStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDIRCTRL_3D_INTERNAL|wxBORDER_SUNKEN, - const wxString& filter = wxEmptyString, - int defaultFilter = 0, + long style = wxDIRCTRL_3D_INTERNAL, + const wxString& filter = wxEmptyString, int defaultFilter = 0, const wxString& name = wxTreeCtrlNameStr); /** @@ -118,6 +135,13 @@ public: */ virtual wxString GetFilePath() const; + /** + Fills the array @a paths with the currently selected filepaths. + + This function doesn't count a directory as a selection. + */ + virtual void GetFilePaths(wxArrayString& paths) const; + /** Returns the filter string. */ @@ -138,6 +162,11 @@ public: */ virtual wxString GetPath() const; + /** + Fills the array @a paths with the selected directories and filenames. + */ + virtual void GetPaths(wxArrayString& paths) const; + /** Returns the root id for the tree control. */ @@ -185,5 +214,49 @@ public: control. If @false, they will not be displayed. */ virtual void ShowHidden(bool show); + + /** + Selects the given item. + + In multiple selection controls, can be also used to deselect a + currently selected item if the value of @a select is false. + Existing selections are not changed. Only visible items can be + (de)selected, otherwise use ExpandPath(). + */ + virtual void SelectPath(const wxString& path, bool select = true); + + /** + Selects only the specified paths, clearing any previous selection. + + Only supported when wxDIRCTRL_MULTIPLE is set. + */ + virtual void SelectPaths(const wxArrayString& paths); + + /** + Removes the selection from all currently selected items. + */ + virtual void UnselectAll(); }; + + +class wxDirFilterListCtrl: public wxChoice +{ +public: + wxDirFilterListCtrl(); + wxDirFilterListCtrl(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + bool Create(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0); + + virtual ~wxDirFilterListCtrl() {} + + void Init(); + + //// Operations + void FillFilterList(const wxString& filter, int defaultFilter); +};