]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dirctrl.h | |
e54c96f1 | 3 | // Purpose: interface of wxGenericDirCtrl |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxGenericDirCtrl | |
11 | @wxheader{dirctrl.h} | |
7c913512 | 12 | |
23324ae1 FM |
13 | This control can be used to place a directory listing (with optional files) on |
14 | an arbitrary window. | |
7c913512 | 15 | |
23324ae1 FM |
16 | The control contains a wxTreeCtrl window representing the directory |
17 | hierarchy, and optionally, a wxChoice window containing a list of filters. | |
7c913512 | 18 | |
23324ae1 FM |
19 | @library{wxbase} |
20 | @category{ctrl} | |
21 | @appearance{genericdirctrl.png} | |
22 | */ | |
23 | class wxGenericDirCtrl : public wxControl | |
24 | { | |
25 | public: | |
26 | //@{ | |
27 | /** | |
28 | Main constructor. | |
3c4f71cc | 29 | |
7c913512 | 30 | @param parent |
4cc4bfaf | 31 | Parent window. |
7c913512 | 32 | @param id |
4cc4bfaf | 33 | Window identifier. |
7c913512 | 34 | @param dir |
4cc4bfaf | 35 | Initial folder. |
7c913512 | 36 | @param pos |
4cc4bfaf | 37 | Position. |
7c913512 | 38 | @param size |
4cc4bfaf | 39 | Size. |
7c913512 | 40 | @param style |
4cc4bfaf | 41 | Window style. Please see wxGenericDirCtrl for a list of possible styles. |
7c913512 | 42 | @param filter |
4cc4bfaf FM |
43 | A filter string, using the same syntax as that for wxFileDialog. This may |
44 | be empty if filters | |
45 | are not being used. | |
46 | Example: "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg" | |
7c913512 | 47 | @param defaultFilter |
4cc4bfaf | 48 | The zero-indexed default filter setting. |
7c913512 | 49 | @param name |
4cc4bfaf | 50 | The window name. |
23324ae1 FM |
51 | */ |
52 | wxGenericDirCtrl(); | |
7c913512 FM |
53 | wxGenericDirCtrl(wxWindow* parent, const wxWindowID id = -1, |
54 | const wxString& dir = wxDirDialogDefaultFolderStr, | |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
57 | long style = wxDIRCTRL_3D_INTERNAL|wxBORDER_SUNKEN, | |
58 | const wxString& filter = wxEmptyString, | |
59 | int defaultFilter = 0, | |
60 | const wxString& name = wxTreeCtrlNameStr); | |
23324ae1 FM |
61 | //@} |
62 | ||
63 | /** | |
64 | Destructor. | |
65 | */ | |
66 | ~wxGenericDirCtrl(); | |
67 | ||
68 | /** | |
69 | Collapse the given path. | |
70 | */ | |
71 | bool CollapsePath(const wxString& path); | |
72 | ||
73 | /** | |
74 | Collapses the entire tree. | |
75 | */ | |
76 | void CollapseTree(); | |
77 | ||
78 | /** | |
79 | Create function for two-step construction. See wxGenericDirCtrl() for details. | |
80 | */ | |
81 | bool Create(wxWindow* parent, const wxWindowID id = -1, | |
82 | const wxString& dir = wxDirDialogDefaultFolderStr, | |
83 | const wxPoint& pos = wxDefaultPosition, | |
84 | const wxSize& size = wxDefaultSize, | |
85 | long style = wxDIRCTRL_3D_INTERNAL|wxBORDER_SUNKEN, | |
86 | const wxString& filter = wxEmptyString, | |
87 | int defaultFilter = 0, | |
88 | const wxString& name = wxTreeCtrlNameStr); | |
89 | ||
90 | /** | |
91 | Tries to expand as much of the given path as possible, so that the filename or | |
92 | directory is visible in the tree control. | |
93 | */ | |
94 | bool ExpandPath(const wxString& path); | |
95 | ||
96 | /** | |
97 | Gets the default path. | |
98 | */ | |
328f5751 | 99 | wxString GetDefaultPath() const; |
23324ae1 FM |
100 | |
101 | /** | |
102 | Gets selected filename path only (else empty string). | |
23324ae1 FM |
103 | This function doesn't count a directory as a selection. |
104 | */ | |
328f5751 | 105 | wxString GetFilePath() const; |
23324ae1 FM |
106 | |
107 | /** | |
108 | Returns the filter string. | |
109 | */ | |
328f5751 | 110 | wxString GetFilter() const; |
23324ae1 FM |
111 | |
112 | /** | |
113 | Returns the current filter index (zero-based). | |
114 | */ | |
328f5751 | 115 | int GetFilterIndex() const; |
23324ae1 FM |
116 | |
117 | /** | |
118 | Returns a pointer to the filter list control (if present). | |
119 | */ | |
328f5751 | 120 | wxDirFilterListCtrl* GetFilterListCtrl() const; |
23324ae1 FM |
121 | |
122 | /** | |
123 | Gets the currently-selected directory or filename. | |
124 | */ | |
328f5751 | 125 | wxString GetPath() const; |
23324ae1 FM |
126 | |
127 | /** | |
128 | Returns the root id for the tree control. | |
129 | */ | |
130 | wxTreeItemId GetRootId(); | |
131 | ||
132 | /** | |
133 | Returns a pointer to the tree control. | |
134 | */ | |
328f5751 | 135 | wxTreeCtrl* GetTreeCtrl() const; |
23324ae1 FM |
136 | |
137 | /** | |
138 | Initializes variables. | |
139 | */ | |
140 | void Init(); | |
141 | ||
142 | /** | |
143 | Collapse and expand the tree, thus re-creating it from scratch. | |
144 | May be used to update the displayed directory content. | |
145 | */ | |
146 | void ReCreateTree(); | |
147 | ||
148 | /** | |
149 | Sets the default path. | |
150 | */ | |
151 | void SetDefaultPath(const wxString& path); | |
152 | ||
153 | /** | |
154 | Sets the filter string. | |
155 | */ | |
156 | void SetFilter(const wxString& filter); | |
157 | ||
158 | /** | |
159 | Sets the current filter index (zero-based). | |
160 | */ | |
161 | void SetFilterIndex(int n); | |
162 | ||
163 | /** | |
164 | Sets the current path. | |
165 | */ | |
166 | void SetPath(const wxString& path); | |
167 | ||
168 | /** | |
7c913512 | 169 | @param show |
4cc4bfaf FM |
170 | If @true, hidden folders and files will be displayed by the |
171 | control. If @false, they will not be displayed. | |
23324ae1 FM |
172 | */ |
173 | void ShowHidden(bool show); | |
174 | }; | |
e54c96f1 | 175 |