1\section{\class{wxGenericDirCtrl}}\label{wxgenericdirctrl} 2 3This control can be used to place a directory listing (with optional files) on an arbitrary window. 4 5The control contains a \helpref{wxTreeCtrl}{wxtreectrl} window representing the directory 6hierarchy, 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{7cm} 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\twocolitem{\indexit{wxDIRCTRL\_EDIT\_LABELS}}{Allow the folder and file labels to be editable.} 28\end{twocollist} 29 30See also \helpref{Generic window styles}{windowstyles}. 31 32\wxheading{Data structures} 33 34\latexignore{\rtfignore{\wxheading{Members}}} 35 36\membersection{wxGenericDirCtrl::wxGenericDirCtrl}\label{wxgenericdirctrlwxgenericdirctrl} 37 38\func{}{wxGenericDirCtrl}{\void} 39 40Default constructor. 41 42\func{}{wxGenericDirCtrl}{\param{wxWindow* }{parent}, \param{const wxWindowID }{id = -1}, 43 \param{const wxString\& }{dir = wxDirDialogDefaultFolderStr}, \param{const wxPoint\& }{pos = wxDefaultPosition}, 44 \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxDIRCTRL\_3D\_INTERNAL|wxSUNKEN\_BORDER}, 45 \param{const wxString\& }{filter = wxEmptyString}, 46 \param{int }{defaultFilter = 0}, 47 \param{const wxString\& }{name = wxTreeCtrlNameStr}} 48 49Main constructor. 50 51\wxheading{Parameters} 52 53\docparam{parent}{Parent window.} 54 55\docparam{id}{Window identifier.} 56 57\docparam{dir}{Initial folder.} 58 59\docparam{pos}{Position.} 60 61\docparam{size}{Size.} 62 63\docparam{style}{Window style. Please see \helpref{wxGenericDirCtrl}{wxgenericdirctrl} for a list of possible styles.} 64 65\docparam{filter}{A filter string, using the same syntax as that for \helpref{wxFileDialog}{wxfiledialog}. This may be empty if filters 66are not being used. 67 68Example: ``All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg"} 69 70\docparam{defaultFilter}{The zero-indexed default filter setting.} 71 72\docparam{name}{The window name.} 73 74\membersection{wxGenericDirCtrl::\destruct{wxGenericDirCtrl}}\label{wxgenericdirctrldtor} 75 76\func{}{\destruct{wxGenericDirCtrl}}{\void} 77 78Destructor. 79 80\membersection{wxGenericDirCtrl::Create}\label{wxgenericdirctrlcreate} 81 82\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}} 83 84Create function for two-step construction. See \helpref{wxGenericDirCtrl::wxGenericDirCtrl}{wxgenericdirctrlwxgenericdirctrl} for details. 85 86\membersection{wxGenericDirCtrl::Init}\label{wxgenericdirctrlinit} 87 88\func{void}{Init}{\void} 89 90Initializes variables. 91 92\membersection{wxGenericDirCtrl::CollapseTree}\label{wxgenericdirctrlcollapsetree} 93 94\func{void}{CollapseTree}{\void} 95 96Collapses the entire tree. 97 98\membersection{wxGenericDirCtrl::ExpandPath}\label{wxgenericdirctrlexpandpath} 99 100\func{bool}{ExpandPath}{\param{const wxString\& }{path}} 101 102Tries to expand as much of the given path as possible, so that the filename or directory is visible in the tree control. 103 104\membersection{wxGenericDirCtrl::CollapsePath}\label{wxgenericdirctrlcollapsepath} 105 106\func{bool}{CollapsePath}{\param{const wxString\& }{path}} 107 108Collapse the given path. 109 110\membersection{wxGenericDirCtrl::GetDefaultPath}\label{wxgenericdirctrlgetdefaultpath} 111 112\constfunc{wxString}{GetDefaultPath}{\void} 113 114Gets the default path. 115 116\membersection{wxGenericDirCtrl::GetPath}\label{wxgenericdirctrlgetpath} 117 118\constfunc{wxString}{GetPath}{\void} 119 120Gets the currently-selected directory or filename. 121 122\membersection{wxGenericDirCtrl::GetFilePath}\label{wxgenericdirctrlgetfilepath} 123 124\constfunc{wxString}{GetFilePath}{\void} 125 126Gets selected filename path only (else empty string). 127 128This function doesn't count a directory as a selection. 129 130\membersection{wxGenericDirCtrl::GetFilter}\label{wxgenericdirctrlgetfilter} 131 132\constfunc{wxString}{GetFilter}{\void} 133 134Returns the filter string. 135 136\membersection{wxGenericDirCtrl::GetFilterIndex}\label{wxgenericdirctrlgetfilterindex} 137 138\constfunc{int}{GetFilterIndex}{\void} 139 140Returns the current filter index (zero-based). 141 142\membersection{wxGenericDirCtrl::GetFilterListCtrl}\label{wxgenericdirctrlgetfilterlistctrl} 143 144\constfunc{wxDirFilterListCtrl*}{GetFilterListCtrl}{\void} 145 146Returns a pointer to the filter list control (if present). 147 148\membersection{wxGenericDirCtrl::GetRootId}\label{wxgenericdirctrlgetrootid} 149 150\func{wxTreeItemId}{GetRootId}{\void} 151 152Returns the root id for the tree control. 153 154\membersection{wxGenericDirCtrl::GetTreeCtrl}\label{wxgenericdirctrlgettreectrl} 155 156\constfunc{wxTreeCtrl*}{GetTreeCtrl}{\void} 157 158Returns a pointer to the tree control. 159 160\membersection{wxGenericDirCtrl::ReCreateTree}\label{wxgenericdirctrlrecreatetree} 161 162\func{void}{ReCreateTree}{\void} 163 164Collapse and expand the tree, thus re-creating it from scratch. 165May be used to update the displayed directory content. 166 167\membersection{wxGenericDirCtrl::SetDefaultPath}\label{wxgenericdirctrlsetdefaultpath} 168 169\func{void}{SetDefaultPath}{\param{const wxString\& }{path}} 170 171Sets the default path. 172 173\membersection{wxGenericDirCtrl::SetFilter}\label{wxgenericdirctrlsetfilter} 174 175\func{void}{SetFilter}{\param{const wxString\& }{filter}} 176 177Sets the filter string. 178 179\membersection{wxGenericDirCtrl::SetFilterIndex}\label{wxgenericdirctrlsetfilterindex} 180 181\func{void}{SetFilterIndex}{\param{int }{n}} 182 183Sets the current filter index (zero-based). 184 185\membersection{wxGenericDirCtrl::SetPath}\label{wxgenericdirctrlsetpath} 186 187\func{void}{SetPath}{\param{const wxString\& }{path}} 188 189Sets the current path. 190 191\membersection{wxGenericDirCtrl::ShowHidden}\label{wxgenericdirctrlShowHidden} 192 193\func{void}{ShowHidden}{\param{bool }{show}} 194 195\wxheading{Parameters} 196 197\docparam{show}{If true, hidden folders and files will be displayed by the 198control. If false, they will not be displayed.} 199 200