X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ccf39540bb96a0e5d067451ad79c82397579aceb..9e9574fe45b176ee74bba8fad7574cf9906145d1:/interface/wx/dirctrl.h?ds=sidebyside diff --git a/interface/wx/dirctrl.h b/interface/wx/dirctrl.h index 4769c92772..9cb3d88f5e 100644 --- a/interface/wx/dirctrl.h +++ b/interface/wx/dirctrl.h @@ -2,10 +2,26 @@ // Name: dirctrl.h // 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, + // Show the filter list + wxDIRCTRL_SHOW_FILTERS = 0x0040, + // Use 3D borders on internal controls + wxDIRCTRL_3D_INTERNAL = 0x0080, + // Editable labels + wxDIRCTRL_EDIT_LABELS = 0x0100, + // Allow multiple selection + wxDIRCTRL_MULTIPLE = 0x0200 +}; + + /** @class wxGenericDirCtrl @@ -23,13 +39,26 @@ @style{wxDIRCTRL_SELECT_FIRST} When setting the default path, select the first file in the directory. + @style{wxDIRCTRL_SHOW_FILTERS} + Show the drop-down filter list. @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} + @appearance{genericdirctrl} + @event{EVT_DIRCTRL_SELECTIONCHANGED(id, func)} + Selected directory has changed. + Processes a @c wxEVT_DIRCTRL_SELECTIONCHANGED event type. + Notice that this event is generated even for the changes done by the + program itself and not only those done by the user. + @since 2.9.5 + @event{EVT_DIRCTRL_FILEACTIVATED(id, func)} + The user activated a file by double-clicking or pressing Enter. + @since 2.9.5 */ class wxGenericDirCtrl : public wxControl { @@ -118,6 +147,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 +174,18 @@ public: */ virtual wxString GetPath() const; + /** + Gets the path corresponding to the given tree control item. + + @since 2.9.5 + */ + wxString GetPath(wxTreeItemId itemId) 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 +233,52 @@ 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); }; +wxEventType wxEVT_DIRCTRL_SELECTIONCHANGED; +wxEventType wxEVT_DIRCTRL_FILEACTIVATED;