1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxGenericDirCtrl
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxGenericDirCtrl
12 This control can be used to place a directory listing (with optional
13 files) on an arbitrary window.
15 The control contains a wxTreeCtrl window representing the directory
16 hierarchy, and optionally, a wxChoice window containing a list of filters.
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
26 @style{wxDIRCTRL_EDIT_LABELS}
27 Allow the folder and file labels to be editable.
32 <!-- @appearance{genericdirctrl.png} -->
34 class wxGenericDirCtrl
: public wxControl
55 Window style. Please see wxGenericDirCtrl for a list of possible
58 A filter string, using the same syntax as that for wxFileDialog.
59 This may be empty if filters are not being used. Example:
60 @c "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg"
62 The zero-indexed default filter setting.
66 wxGenericDirCtrl(wxWindow
* parent
, const wxWindowID id
= -1,
67 const wxString
& dir
= wxDirDialogDefaultFolderStr
,
68 const wxPoint
& pos
= wxDefaultPosition
,
69 const wxSize
& size
= wxDefaultSize
,
70 long style
= wxDIRCTRL_3D_INTERNAL
|wxBORDER_SUNKEN
,
71 const wxString
& filter
= wxEmptyString
,
72 int defaultFilter
= 0,
73 const wxString
& name
= wxTreeCtrlNameStr
);
78 virtual ~wxGenericDirCtrl();
81 Collapse the given @a path.
83 virtual bool CollapsePath(const wxString
& path
);
86 Collapses the entire tree.
88 virtual void CollapseTree();
91 Create function for two-step construction. See wxGenericDirCtrl() for
94 bool Create(wxWindow
* parent
, const wxWindowID id
= wxID_ANY
,
95 const wxString
& dir
= wxDirDialogDefaultFolderStr
,
96 const wxPoint
& pos
= wxDefaultPosition
,
97 const wxSize
& size
= wxDefaultSize
,
98 long style
= wxDIRCTRL_3D_INTERNAL
,
99 const wxString
& filter
= wxEmptyString
, int defaultFilter
= 0,
100 const wxString
& name
= wxTreeCtrlNameStr
);
103 Tries to expand as much of the given @a path as possible, so that the
104 filename or directory is visible in the tree control.
106 virtual bool ExpandPath(const wxString
& path
);
109 Gets the default path.
111 virtual wxString
GetDefaultPath() const;
114 Gets selected filename path only (else empty string).
116 This function doesn't count a directory as a selection.
118 virtual wxString
GetFilePath() const;
121 Returns the filter string.
123 virtual wxString
GetFilter() const;
126 Returns the current filter index (zero-based).
128 virtual int GetFilterIndex() const;
131 Returns a pointer to the filter list control (if present).
133 virtual wxDirFilterListCtrl
* GetFilterListCtrl() const;
136 Gets the currently-selected directory or filename.
138 virtual wxString
GetPath() const;
141 Returns the root id for the tree control.
143 virtual wxTreeItemId
GetRootId();
146 Returns a pointer to the tree control.
148 virtual wxTreeCtrl
* GetTreeCtrl() const;
151 Initializes variables.
156 Collapse and expand the tree, thus re-creating it from scratch. May be
157 used to update the displayed directory content.
159 virtual void ReCreateTree();
162 Sets the default path.
164 virtual void SetDefaultPath(const wxString
& path
);
167 Sets the filter string.
169 virtual void SetFilter(const wxString
& filter
);
172 Sets the current filter index (zero-based).
174 virtual void SetFilterIndex(int n
);
177 Sets the current path.
179 virtual void SetPath(const wxString
& path
);
183 If @true, hidden folders and files will be displayed by the
184 control. If @false, they will not be displayed.
186 virtual void ShowHidden(bool show
);