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 files) on
16 The control contains a wxTreeCtrl window representing the directory
17 hierarchy, and optionally, a wxChoice window containing a list of filters.
21 @appearance{genericdirctrl.png}
23 class wxGenericDirCtrl
: public wxControl
41 Window style. Please see wxGenericDirCtrl for a list of possible styles.
43 A filter string, using the same syntax as that for wxFileDialog. This may
46 Example: "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg"
48 The zero-indexed default filter setting.
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
);
69 Collapse the given path.
71 bool CollapsePath(const wxString
& path
);
74 Collapses the entire tree.
79 Create function for two-step construction. See wxGenericDirCtrl() for details.
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
);
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.
94 bool ExpandPath(const wxString
& path
);
97 Gets the default path.
99 wxString
GetDefaultPath() const;
102 Gets selected filename path only (else empty string).
103 This function doesn't count a directory as a selection.
105 wxString
GetFilePath() const;
108 Returns the filter string.
110 wxString
GetFilter() const;
113 Returns the current filter index (zero-based).
115 int GetFilterIndex() const;
118 Returns a pointer to the filter list control (if present).
120 wxDirFilterListCtrl
* GetFilterListCtrl() const;
123 Gets the currently-selected directory or filename.
125 wxString
GetPath() const;
128 Returns the root id for the tree control.
130 wxTreeItemId
GetRootId();
133 Returns a pointer to the tree control.
135 wxTreeCtrl
* GetTreeCtrl() const;
138 Initializes variables.
143 Collapse and expand the tree, thus re-creating it from scratch.
144 May be used to update the displayed directory content.
149 Sets the default path.
151 void SetDefaultPath(const wxString
& path
);
154 Sets the filter string.
156 void SetFilter(const wxString
& filter
);
159 Sets the current filter index (zero-based).
161 void SetFilterIndex(int n
);
164 Sets the current path.
166 void SetPath(const wxString
& path
);
170 If @true, hidden folders and files will be displayed by the
171 control. If @false, they will not be displayed.
173 void ShowHidden(bool show
);