]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/dirctrl.h
use CLSCTX_ALL instead of CLSCTX_LOCAL_SERVER in CreateInstance() (#9868)
[wxWidgets.git] / interface / wx / dirctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dirctrl.h
3 // Purpose: interface of wxGenericDirCtrl
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxGenericDirCtrl
11
12 This control can be used to place a directory listing (with optional
13 files) on an arbitrary window.
14
15 The control contains a wxTreeCtrl window representing the directory
16 hierarchy, and optionally, a wxChoice window containing a list of filters.
17
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.
28 @endStyleTable
29
30 @library{wxbase}
31 @category{ctrl}
32 <!-- @appearance{genericdirctrl.png} -->
33 */
34 class wxGenericDirCtrl : public wxControl
35 {
36 public:
37 /**
38 Default constructor.
39 */
40 wxGenericDirCtrl();
41 /**
42 Main constructor.
43
44 @param parent
45 Parent window.
46 @param id
47 Window identifier.
48 @param dir
49 Initial folder.
50 @param pos
51 Position.
52 @param size
53 Size.
54 @param style
55 Window style. Please see wxGenericDirCtrl for a list of possible
56 styles.
57 @param filter
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"
61 @param defaultFilter
62 The zero-indexed default filter setting.
63 @param name
64 The window name.
65 */
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);
74
75 /**
76 Destructor.
77 */
78 ~wxGenericDirCtrl();
79
80 /**
81 Collapse the given @a path.
82 */
83 bool CollapsePath(const wxString& path);
84
85 /**
86 Collapses the entire tree.
87 */
88 void CollapseTree();
89
90 /**
91 Create function for two-step construction. See wxGenericDirCtrl() for
92 details.
93 */
94 bool Create(wxWindow* parent, const wxWindowID id = -1,
95 const wxString& dir = wxDirDialogDefaultFolderStr,
96 const wxPoint& pos = wxDefaultPosition,
97 const wxSize& size = wxDefaultSize,
98 long style = wxDIRCTRL_3D_INTERNAL|wxBORDER_SUNKEN,
99 const wxString& filter = wxEmptyString,
100 int defaultFilter = 0,
101 const wxString& name = wxTreeCtrlNameStr);
102
103 /**
104 Tries to expand as much of the given @a path as possible, so that the
105 filename or directory is visible in the tree control.
106 */
107 bool ExpandPath(const wxString& path);
108
109 /**
110 Gets the default path.
111 */
112 wxString GetDefaultPath() const;
113
114 /**
115 Gets selected filename path only (else empty string).
116
117 This function doesn't count a directory as a selection.
118 */
119 wxString GetFilePath() const;
120
121 /**
122 Returns the filter string.
123 */
124 wxString GetFilter() const;
125
126 /**
127 Returns the current filter index (zero-based).
128 */
129 int GetFilterIndex() const;
130
131 /**
132 Returns a pointer to the filter list control (if present).
133 */
134 wxDirFilterListCtrl* GetFilterListCtrl() const;
135
136 /**
137 Gets the currently-selected directory or filename.
138 */
139 wxString GetPath() const;
140
141 /**
142 Returns the root id for the tree control.
143 */
144 wxTreeItemId GetRootId();
145
146 /**
147 Returns a pointer to the tree control.
148 */
149 wxTreeCtrl* GetTreeCtrl() const;
150
151 /**
152 Initializes variables.
153 */
154 void Init();
155
156 /**
157 Collapse and expand the tree, thus re-creating it from scratch. May be
158 used to update the displayed directory content.
159 */
160 void ReCreateTree();
161
162 /**
163 Sets the default path.
164 */
165 void SetDefaultPath(const wxString& path);
166
167 /**
168 Sets the filter string.
169 */
170 void SetFilter(const wxString& filter);
171
172 /**
173 Sets the current filter index (zero-based).
174 */
175 void SetFilterIndex(int n);
176
177 /**
178 Sets the current path.
179 */
180 void SetPath(const wxString& path);
181
182 /**
183 @param show
184 If @true, hidden folders and files will be displayed by the
185 control. If @false, they will not be displayed.
186 */
187 void ShowHidden(bool show);
188 };
189