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