1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxGenericDirCtrl
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxGenericDirCtrl
13 This control can be used to place a directory listing (with optional
14 files) on an arbitrary window.
16 The control contains a wxTreeCtrl window representing the directory
17 hierarchy, and optionally, a wxChoice window containing a list of filters.
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
27 @style{wxDIRCTRL_EDIT_LABELS}
28 Allow the folder and file labels to be editable.
33 <!-- @appearance{genericdirctrl.png} -->
35 class wxGenericDirCtrl
: public wxControl
56 Window style. Please see wxGenericDirCtrl for a list of possible
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"
63 The zero-indexed default filter setting.
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
);
82 Collapse the given @a path.
84 bool CollapsePath(const wxString
& path
);
87 Collapses the entire tree.
92 Create function for two-step construction. See wxGenericDirCtrl() for
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
);
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.
108 bool ExpandPath(const wxString
& path
);
111 Gets the default path.
113 wxString
GetDefaultPath() const;
116 Gets selected filename path only (else empty string).
118 This function doesn't count a directory as a selection.
120 wxString
GetFilePath() const;
123 Returns the filter string.
125 wxString
GetFilter() const;
128 Returns the current filter index (zero-based).
130 int GetFilterIndex() const;
133 Returns a pointer to the filter list control (if present).
135 wxDirFilterListCtrl
* GetFilterListCtrl() const;
138 Gets the currently-selected directory or filename.
140 wxString
GetPath() const;
143 Returns the root id for the tree control.
145 wxTreeItemId
GetRootId();
148 Returns a pointer to the tree control.
150 wxTreeCtrl
* GetTreeCtrl() const;
153 Initializes variables.
158 Collapse and expand the tree, thus re-creating it from scratch. May be
159 used to update the displayed directory content.
164 Sets the default path.
166 void SetDefaultPath(const wxString
& path
);
169 Sets the filter string.
171 void SetFilter(const wxString
& filter
);
174 Sets the current filter index (zero-based).
176 void SetFilterIndex(int n
);
179 Sets the current path.
181 void SetPath(const wxString
& path
);
185 If @true, hidden folders and files will be displayed by the
186 control. If @false, they will not be displayed.
188 void ShowHidden(bool show
);