]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/dirctrl.tex
added and documented wxDir::HasFiles/SubDirs(), use the latter in wxDirDialog - it...
[wxWidgets.git] / docs / latex / wx / dirctrl.tex
1 \section{\class{wxGenericDirCtrl}}\label{wxgenericdirctrl}
2
3 This control can be used to place a directory listing (with optional files) on an arbitrary window.
4
5 The control contains a \helpref{wxTreeCtrl}{wxtreectrl} window representing the directory
6 hierarchy, and optionally, a \helpref{wxChoice}{wxchoice} window containing a list of filters.
7
8 \wxheading{Derived from}
9
10 \helpref{wxControl}{wxcontrol}\\
11 \helpref{wxWindow}{wxwindow}\\
12 \helpref{wxEvtHandler}{wxevthandler}\\
13 \helpref{wxObject}{wxobject}
14
15 \wxheading{Include files}
16
17 <wx/dirctrl.h>
18
19 \wxheading{Window styles}
20
21 \twocolwidtha{5cm}
22 \begin{twocollist}
23 \twocolitem{\indexit{wxDIRCTRL\_DIR\_ONLY}}{Only show directories, and not files.}
24 \twocolitem{\indexit{wxDIRCTRL\_3D\_INTERNAL}}{Use 3D borders for internal controls.}
25 \twocolitem{\indexit{wxDIRCTRL\_SELECT\_FIRST}}{When setting the default path, select the first file in the directory.}
26 \twocolitem{\indexit{wxDIRCTRL\_SHOW\_FILTERS}}{Show the drop-down filter list.}
27 \end{twocollist}
28
29 See also \helpref{Generic window styles}{windowstyles}.
30
31 \wxheading{Data structures}
32
33 \latexignore{\rtfignore{\wxheading{Members}}}
34
35 \membersection{wxGenericDirCtrl::wxGenericDirCtrl}\label{wxgenericdirctrlwxgenericdirctrl}
36
37 \func{}{wxGenericDirCtrl}{\void}
38
39 Default constructor.
40
41 \func{}{wxGenericDirCtrl}{\param{wxWindow* }{parent}, \param{const wxWindowID }{id = -1},
42 \param{const wxString\& }{dir = wxDirDialogDefaultFolderStr}, \param{const wxPoint\& }{pos = wxDefaultPosition},
43 \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxDIRCTRL\_3D\_INTERNAL|wxSUNKEN\_BORDER},
44 \param{const wxString\& }{filter = wxEmptyString},
45 \param{int }{defaultFilter = 0},
46 \param{const wxString\& }{name = wxTreeCtrlNameStr}}
47
48 Main constructor.
49
50 \wxheading{Parameters}
51
52 \docparam{parent}{Parent window.}
53
54 \docparam{id}{Window identifier.}
55
56 \docparam{dir}{Initial folder.}
57
58 \docparam{pos}{Position.}
59
60 \docparam{size}{Size.}
61
62 \docparam{style}{Window style. Please see \helpref{wxGenericDirCtrl}{wxgenericdirctrl} for a list of possible styles.}
63
64 \docparam{filter}{A filter string, using the same syntax as that for \helpref{wxFileDialog}{wxfiledialog}. This may be empty if filters
65 are not being used.
66
67 Example: ``All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg"}
68
69 \docparam{defaultFilter}{The zero-indexed default filter setting.}
70
71 \docparam{name}{The window name.}
72
73 \membersection{wxGenericDirCtrl::\destruct{wxGenericDirCtrl}}\label{wxgenericdirctrldtor}
74
75 \func{}{\destruct{wxGenericDirCtrl}}{\void}
76
77 Destructor.
78
79 \membersection{wxGenericDirCtrl::Create}\label{wxgenericdirctrlcreate}
80
81 \func{bool}{Create}{\param{wxWindow* }{parent}, \param{const wxWindowID }{id = -1}, \param{const wxString\& }{dir = wxDirDialogDefaultFolderStr}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxDIRCTRL\_3D\_INTERNAL|wxSUNKEN\_BORDER}, \param{const wxString\& }{filter = wxEmptyString}, \param{int }{defaultFilter = 0}, \param{const wxString\& }{name = wxTreeCtrlNameStr}}
82
83 Create function for two-step construction. See \helpref{wxGenericDirCtrl::wxGenericDirCtrl}{wxgenericdirctrlwxgenericdirctrl} for details.
84
85 \membersection{wxGenericDirCtrl::Init}\label{wxgenericdirctrlinit}
86
87 \func{void}{Init}{\void}
88
89 Initializes variables.
90
91 \membersection{wxGenericDirCtrl::ExpandPath}\label{wxgenericdirctrlexpandpath}
92
93 \func{bool}{ExpandPath}{\param{const wxString\& }{path}}
94
95 Tries to expand as much of the given path as possible, so that the filename or directory is visible in the tree control.
96
97 \membersection{wxGenericDirCtrl::GetDefaultPath}\label{wxgenericdirctrlgetdefaultpath}
98
99 \constfunc{wxString}{GetDefaultPath}{\void}
100
101 Gets the default path.
102
103 \membersection{wxGenericDirCtrl::GetPath}\label{wxgenericdirctrlgetpath}
104
105 \constfunc{wxString}{GetPath}{\void}
106
107 Gets the currently-selected directory or filename.
108
109 \membersection{wxGenericDirCtrl::GetFilePath}\label{wxgenericdirctrlgetfilepath}
110
111 \constfunc{wxString}{GetFilePath}{\void}
112
113 Gets selected filename path only (else empty string).
114
115 This function doen't count a directory as a selection.
116
117 \membersection{wxGenericDirCtrl::GetFilter}\label{wxgenericdirctrlgetfilter}
118
119 \constfunc{wxString}{GetFilter}{\void}
120
121 Returns the filter string.
122
123 \membersection{wxGenericDirCtrl::GetFilterIndex}\label{wxgenericdirctrlgetfilterindex}
124
125 \constfunc{int}{GetFilterIndex}{\void}
126
127 Returns the current filter index (zero-based).
128
129 \membersection{wxGenericDirCtrl::GetFilterListCtrl}\label{wxgenericdirctrlgetfilterlistctrl}
130
131 \constfunc{wxDirFilterListCtrl*}{GetFilterListCtrl}{\void}
132
133 Returns a pointer to the filter list control (if present).
134
135 \membersection{wxGenericDirCtrl::GetRootId}\label{wxgenericdirctrlgetrootid}
136
137 \func{wxTreeItemId}{GetRootId}{\void}
138
139 Returns the root id for the tree control.
140
141 \membersection{wxGenericDirCtrl::GetTreeCtrl}\label{wxgenericdirctrlgettreectrl}
142
143 \constfunc{wxTreeCtrl*}{GetTreeCtrl}{\void}
144
145 Returns a pointer to the tree control.
146
147 \membersection{wxGenericDirCtrl::SetDefaultPath}\label{wxgenericdirctrlsetdefaultpath}
148
149 \func{void}{SetDefaultPath}{\param{const wxString\& }{path}}
150
151 Sets the default path.
152
153 \membersection{wxGenericDirCtrl::SetFilter}\label{wxgenericdirctrlsetfilter}
154
155 \func{void}{SetFilter}{\param{const wxString\& }{filter}}
156
157 Sets the filter string.
158
159 \membersection{wxGenericDirCtrl::SetFilterIndex}\label{wxgenericdirctrlsetfilterindex}
160
161 \func{void}{SetFilterIndex}{\param{int }{n}}
162
163 Sets the current filter index (zero-based).
164
165 \membersection{wxGenericDirCtrl::SetPath}\label{wxgenericdirctrlsetpath}
166
167 \func{void}{SetPath}{\param{const wxString\& }{path}}
168
169 Sets the current path.
170