]> git.saurik.com Git - wxWidgets.git/blob - interface/dirctrl.h
build fix
[wxWidgets.git] / interface / 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 @wxheader{dirctrl.h}
12
13 This control can be used to place a directory listing (with optional files) on
14 an arbitrary window.
15
16 The control contains a wxTreeCtrl window representing the directory
17 hierarchy, and optionally, a wxChoice window containing a list of filters.
18
19 @library{wxbase}
20 @category{ctrl}
21 @appearance{genericdirctrl.png}
22 */
23 class wxGenericDirCtrl : public wxControl
24 {
25 public:
26 //@{
27 /**
28 Main constructor.
29
30 @param parent
31 Parent window.
32 @param id
33 Window identifier.
34 @param dir
35 Initial folder.
36 @param pos
37 Position.
38 @param size
39 Size.
40 @param style
41 Window style. Please see wxGenericDirCtrl for a list of possible styles.
42 @param filter
43 A filter string, using the same syntax as that for wxFileDialog. This may
44 be empty if filters
45 are not being used.
46 Example: "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg"
47 @param defaultFilter
48 The zero-indexed default filter setting.
49 @param name
50 The window name.
51 */
52 wxGenericDirCtrl();
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);
61 //@}
62
63 /**
64 Destructor.
65 */
66 ~wxGenericDirCtrl();
67
68 /**
69 Collapse the given path.
70 */
71 bool CollapsePath(const wxString& path);
72
73 /**
74 Collapses the entire tree.
75 */
76 void CollapseTree();
77
78 /**
79 Create function for two-step construction. See wxGenericDirCtrl() for details.
80 */
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);
89
90 /**
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.
93 */
94 bool ExpandPath(const wxString& path);
95
96 /**
97 Gets the default path.
98 */
99 wxString GetDefaultPath() const;
100
101 /**
102 Gets selected filename path only (else empty string).
103 This function doesn't count a directory as a selection.
104 */
105 wxString GetFilePath() const;
106
107 /**
108 Returns the filter string.
109 */
110 wxString GetFilter() const;
111
112 /**
113 Returns the current filter index (zero-based).
114 */
115 int GetFilterIndex() const;
116
117 /**
118 Returns a pointer to the filter list control (if present).
119 */
120 wxDirFilterListCtrl* GetFilterListCtrl() const;
121
122 /**
123 Gets the currently-selected directory or filename.
124 */
125 wxString GetPath() const;
126
127 /**
128 Returns the root id for the tree control.
129 */
130 wxTreeItemId GetRootId();
131
132 /**
133 Returns a pointer to the tree control.
134 */
135 wxTreeCtrl* GetTreeCtrl() const;
136
137 /**
138 Initializes variables.
139 */
140 void Init();
141
142 /**
143 Collapse and expand the tree, thus re-creating it from scratch.
144 May be used to update the displayed directory content.
145 */
146 void ReCreateTree();
147
148 /**
149 Sets the default path.
150 */
151 void SetDefaultPath(const wxString& path);
152
153 /**
154 Sets the filter string.
155 */
156 void SetFilter(const wxString& filter);
157
158 /**
159 Sets the current filter index (zero-based).
160 */
161 void SetFilterIndex(int n);
162
163 /**
164 Sets the current path.
165 */
166 void SetPath(const wxString& path);
167
168 /**
169 @param show
170 If @true, hidden folders and files will be displayed by the
171 control. If @false, they will not be displayed.
172 */
173 void ShowHidden(bool show);
174 };
175