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