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