]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/dirctrl.h
Deprecate wxWindow::MakeModal().
[wxWidgets.git] / interface / wx / dirctrl.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: dirctrl.h
e54c96f1 3// Purpose: interface of wxGenericDirCtrl
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxGenericDirCtrl
7c913512 11
bc85d676
BP
12 This control can be used to place a directory listing (with optional
13 files) on an arbitrary window.
7c913512 14
23324ae1
FM
15 The control contains a wxTreeCtrl window representing the directory
16 hierarchy, and optionally, a wxChoice window containing a list of filters.
7c913512 17
bc85d676
BP
18 @beginStyleTable
19 @style{wxDIRCTRL_DIR_ONLY}
20 Only show directories, and not files.
21 @style{wxDIRCTRL_3D_INTERNAL}
22 Use 3D borders for internal controls.
23 @style{wxDIRCTRL_SELECT_FIRST}
24 When setting the default path, select the first file in the
25 directory.
26 @style{wxDIRCTRL_EDIT_LABELS}
27 Allow the folder and file labels to be editable.
80f624ec
VZ
28 @style{wxDIRCTRL_MULTIPLE}
29 Allows multiple files and folders to be selected.
bc85d676
BP
30 @endStyleTable
31
6ab3e039 32 @library{wxcore}
23324ae1 33 @category{ctrl}
7e59b885 34 @appearance{genericdirctrl.png}
23324ae1
FM
35*/
36class wxGenericDirCtrl : public wxControl
37{
38public:
bc85d676
BP
39 /**
40 Default constructor.
41 */
42 wxGenericDirCtrl();
a44f3b5a 43
23324ae1
FM
44 /**
45 Main constructor.
3c4f71cc 46
7c913512 47 @param parent
4cc4bfaf 48 Parent window.
7c913512 49 @param id
4cc4bfaf 50 Window identifier.
7c913512 51 @param dir
4cc4bfaf 52 Initial folder.
7c913512 53 @param pos
4cc4bfaf 54 Position.
7c913512 55 @param size
4cc4bfaf 56 Size.
7c913512 57 @param style
bc85d676
BP
58 Window style. Please see wxGenericDirCtrl for a list of possible
59 styles.
7c913512 60 @param filter
bc85d676
BP
61 A filter string, using the same syntax as that for wxFileDialog.
62 This may be empty if filters are not being used. Example:
63 @c "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg"
7c913512 64 @param defaultFilter
4cc4bfaf 65 The zero-indexed default filter setting.
7c913512 66 @param name
4cc4bfaf 67 The window name.
23324ae1 68 */
a44f3b5a 69 wxGenericDirCtrl(wxWindow* parent, const wxWindowID id = wxID_ANY,
7c913512
FM
70 const wxString& dir = wxDirDialogDefaultFolderStr,
71 const wxPoint& pos = wxDefaultPosition,
72 const wxSize& size = wxDefaultSize,
ccf39540 73 long style = wxDIRCTRL_3D_INTERNAL,
7c913512
FM
74 const wxString& filter = wxEmptyString,
75 int defaultFilter = 0,
76 const wxString& name = wxTreeCtrlNameStr);
23324ae1
FM
77
78 /**
79 Destructor.
80 */
adaaa686 81 virtual ~wxGenericDirCtrl();
23324ae1
FM
82
83 /**
bc85d676 84 Collapse the given @a path.
23324ae1 85 */
adaaa686 86 virtual bool CollapsePath(const wxString& path);
23324ae1
FM
87
88 /**
89 Collapses the entire tree.
90 */
adaaa686 91 virtual void CollapseTree();
23324ae1
FM
92
93 /**
bc85d676
BP
94 Create function for two-step construction. See wxGenericDirCtrl() for
95 details.
23324ae1 96 */
b91c4601 97 bool Create(wxWindow* parent, const wxWindowID id = wxID_ANY,
23324ae1
FM
98 const wxString& dir = wxDirDialogDefaultFolderStr,
99 const wxPoint& pos = wxDefaultPosition,
100 const wxSize& size = wxDefaultSize,
b91c4601
FM
101 long style = wxDIRCTRL_3D_INTERNAL,
102 const wxString& filter = wxEmptyString, int defaultFilter = 0,
23324ae1
FM
103 const wxString& name = wxTreeCtrlNameStr);
104
105 /**
bc85d676
BP
106 Tries to expand as much of the given @a path as possible, so that the
107 filename or directory is visible in the tree control.
23324ae1 108 */
adaaa686 109 virtual bool ExpandPath(const wxString& path);
23324ae1
FM
110
111 /**
112 Gets the default path.
113 */
adaaa686 114 virtual wxString GetDefaultPath() const;
23324ae1
FM
115
116 /**
117 Gets selected filename path only (else empty string).
bc85d676 118
23324ae1
FM
119 This function doesn't count a directory as a selection.
120 */
adaaa686 121 virtual wxString GetFilePath() const;
23324ae1 122
80f624ec
VZ
123 /**
124 Fills the array @a paths with the currently selected filepaths.
125
126 This function doesn't count a directory as a selection.
127 */
128 virtual void GetFilePaths(wxArrayString& paths) const;
129
23324ae1
FM
130 /**
131 Returns the filter string.
132 */
adaaa686 133 virtual wxString GetFilter() const;
23324ae1
FM
134
135 /**
136 Returns the current filter index (zero-based).
137 */
adaaa686 138 virtual int GetFilterIndex() const;
23324ae1
FM
139
140 /**
141 Returns a pointer to the filter list control (if present).
142 */
adaaa686 143 virtual wxDirFilterListCtrl* GetFilterListCtrl() const;
23324ae1
FM
144
145 /**
146 Gets the currently-selected directory or filename.
147 */
adaaa686 148 virtual wxString GetPath() const;
23324ae1 149
80f624ec
VZ
150 /**
151 Fills the array @a paths with the selected directories and filenames.
152 */
153 virtual void GetPaths(wxArrayString& paths) const;
154
23324ae1
FM
155 /**
156 Returns the root id for the tree control.
157 */
adaaa686 158 virtual wxTreeItemId GetRootId();
23324ae1
FM
159
160 /**
161 Returns a pointer to the tree control.
162 */
adaaa686 163 virtual wxTreeCtrl* GetTreeCtrl() const;
23324ae1
FM
164
165 /**
166 Initializes variables.
167 */
adaaa686 168 virtual void Init();
23324ae1
FM
169
170 /**
bc85d676
BP
171 Collapse and expand the tree, thus re-creating it from scratch. May be
172 used to update the displayed directory content.
23324ae1 173 */
adaaa686 174 virtual void ReCreateTree();
23324ae1
FM
175
176 /**
177 Sets the default path.
178 */
adaaa686 179 virtual void SetDefaultPath(const wxString& path);
23324ae1
FM
180
181 /**
182 Sets the filter string.
183 */
adaaa686 184 virtual void SetFilter(const wxString& filter);
23324ae1
FM
185
186 /**
187 Sets the current filter index (zero-based).
188 */
adaaa686 189 virtual void SetFilterIndex(int n);
23324ae1
FM
190
191 /**
192 Sets the current path.
193 */
adaaa686 194 virtual void SetPath(const wxString& path);
23324ae1
FM
195
196 /**
7c913512 197 @param show
4cc4bfaf
FM
198 If @true, hidden folders and files will be displayed by the
199 control. If @false, they will not be displayed.
23324ae1 200 */
adaaa686 201 virtual void ShowHidden(bool show);
80f624ec
VZ
202
203 /**
204 Selects the given item.
205
206 In multiple selection controls, can be also used to deselect a
207 currently selected item if the value of @a select is false.
208 Existing selections are not changed. Only visible items can be
209 (de)selected, otherwise use ExpandPath().
210 */
211 virtual void SelectPath(const wxString& path, bool select = true);
212
213 /**
214 Selects only the specified paths, clearing any previous selection.
215
216 Only supported when wxDIRCTRL_MULTIPLE is set.
217 */
218 virtual void SelectPaths(const wxArrayString& paths);
219
220 /**
221 Removes the selection from all currently selected items.
222 */
223 virtual void UnselectAll();
23324ae1 224};
e54c96f1 225