1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxFilerCtrl documentation
4 %% Author: Diaa M. Sami
7 %% Copyright: (c) 2007 Diaa M. Sami
8 %% License: wxWindows license
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 \section{\class{wxFileCtrl
}}\label{wxfilectrl
}
13 This control allows the user to select a file. two implemetations exist, one
14 for Gtk and another generic one for anything other than Gtk.
15 It is only available if
\texttt{wxUSE
\_FILECTRL} is set to $
1$.
17 \wxheading{Derived from
}
19 \helpref{wxWindow
}{wxwindow
}\\
20 \helpref{wxEvtHandler
}{wxevthandler
}\\
21 \helpref{wxObject
}{wxobject
}
23 \wxheading{Include files
}
27 \wxheading{Window styles
}
30 \begin{twocollist
}\itemsep=
0pt
31 \twocolitem{\windowstyle{wxFC
\_DEFAULT\_STYLE}}{The default style: wxFC
\_OPEN}
32 \twocolitem{\windowstyle{wxFC
\_OPEN}}{Creates an file control suitable for opening files.
33 Cannot be combined with wxFC
\_SAVE.
}
34 \twocolitem{\windowstyle{wxFC
\_SAVE}}{Creates an file control suitable for saving files. Cannot be combined with wxFC
\_OPEN.
}
35 \twocolitem{\windowstyle{wxFC
\_MULTIPLE}}{For open control only, Allows selecting multiple files. Cannot be combined with wxFC
\_SAVE}
36 \twocolitem{\windowstyle{wxFC
\_NOSHOWHIDDEN}}{Hides the ``Show Hidden Files" checkbox (Generic only)
}
39 \wxheading{Event handling
}
41 To process a file control event, use these event handler macros to direct
42 input to member functions that take a
\helpref{wxFileCtrlEvent
}{wxfilectrlevent
}
46 \begin{twocollist
}\itemsep=
0pt
47 \twocolitem{{\bf EVT
\_FILECTRL\_FILEACTIVATED(id, func)
}}{The user activated a file(by double-clicking or pressing Enter)
}
48 \twocolitem{{\bf EVT
\_FILECTRL\_SELECTIONCHANGED(id, func)
}}{The user changed the current selection(by selecting or deselecting a file)
}
49 \twocolitem{{\bf EVT
\_FILECTRL\_FOLDERCHANGED(id, func)
}}{The current folder of the file control has been changed
}
54 \helpref{wxGenericDirCtrl
}{wxgenericdirctrl
}
56 \latexignore{\rtfignore{\wxheading{Members
}}}
58 \membersection{wxFileCtrl::wxFileCtrl
}\label{wxfilectrlctor
}
60 \func{}{wxFileCtrl
}{\void}
64 \func{}{wxFileCtrl
}{\param{wxWindow *
}{parent
},
\rtfsp
65 \param{wxWindowID
}{ id
},
\rtfsp
66 \param{const wxString\&
}{defaultDirectory = wxEmptyString
},
\rtfsp
67 \param{const wxString\&
}{defaultFilename = wxEmptyString
},
\rtfsp
68 \param{const wxPoint\&
}{wildCard = wxFileSelectorDefaultWildcardStr
},
\rtfsp
69 \param{long
}{ style = wxFC
\_DEFAULT\_STYLE},
\rtfsp
70 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
71 \param{const wxSize\&
}{size = wxDefaultSize
},
72 \param{const wxString\&
}{name = ``filectrl"
}}
74 \wxheading{Parameters
}
76 \docparam{parent
}{Parent window, must not be non-
\texttt{NULL
}.
}
78 \docparam{id
}{The identifier for the control.
}
80 \docparam{defaultDirectory
}{The initial directory shown in the control. Must be
81 a valid path to a directory or the empty string.
82 In case it is the empty string, the current working directory is used.
}
84 \docparam{defaultFilename
}{The default filename, or the empty string.
}
86 \docparam{wildcard
}{A wildcard specifying which files can be selected,
87 such as ``*.*" or ``BMP files
(*.bmp)|*.bmp|GIF files (*.gif)|*.gif".}
89 \docparam{style}{The window style, see {\tt wxFC\_*} flags.}
91 \docparam{pos}{Initial position.}
93 \docparam{size}{Initial size.}
95 \docparam{name}{Control name.}
97 \wxheading{Return value}
99 \true if the control was successfully created or \false if creation failed.
101 \membersection{wxFileCtrl::Create}\label{wxfilectrlcreate}
103 \func{bool}{Create}{\param{wxWindow *}{parent},\rtfsp
104 \param{wxWindowID}{ id},\rtfsp
105 \param{const wxString\& }{defaultDirectory = wxEmptyString},\rtfsp
106 \param{const wxString\& }{defaultFilename = wxEmptyString},\rtfsp
107 \param{const wxPoint\& }{wildCard = wxFileSelectorDefaultWildcardStr},\rtfsp
108 \param{long}{ style = wxFC\_DEFAULT\_STYLE},\rtfsp
109 \param{const wxPoint\& }{pos = wxDefaultPosition},
110 \param{const wxSize\& }{size = wxDefaultSize},
111 \param{const wxString\& }{name = ``filectrl"}}
113 Create function for two-step construction. See \helpref{wxFileCtrl::wxFileCtrl}{wxfilectrlctor} for details.
115 \membersection{wxFileDialog::GetFilename}\label{wxfilectrlgetfilename}
117 \constfunc{wxString}{GetFilename}{\void}
119 Returns the currently selected filename.
120 For the controls having the {\tt wxFC\_MULTIPLE} style, use \helpref{GetFilenames}{wxfilectrlgetfilenames}
123 \membersection{wxFileCtrl::GetDirectory}\label{wxfilectrlgetdirectory}
125 \constfunc{wxString}{GetDirectory}{\void}
127 Returns the current directory of the file control (i.e. the directory shown by
130 \membersection{wxFileCtrl::GetWildcard}\label{wxfilectrlgetwildcard}
132 \constfunc{wxString}{GetWildcard}{\void}
134 Returns the current wildcard.
136 \membersection{wxFileCtrl::GetPath}\label{wxfilectrlgetpath}
138 \constfunc{wxString}{GetPath}{\void}
140 Returns the full path (directory and filename) of the currently selected file.
141 For the controls having the {\tt wxFC\_MULTIPLE} style, use \helpref{GetPaths}{wxfilectrlgetpaths}
144 \membersection{wxFileCtrl::GetPaths}\label{wxfilectrlgetpaths}
146 \constfunc{void}{GetPaths}{\param{wxArrayString\& }{paths}}
148 Fills the array {\it paths} with the full paths of the files chosen. This
149 function should be used with the controls having the {\tt wxFC\_MULTIPLE} style,
150 use \helpref{GetPath}{wxfilectrlgetpath} otherwise.
154 {\it paths} is emptied first.
156 \membersection{wxFileCtrl::GetFilenames}\label{wxfilectrlgetfilenames}
158 \constfunc{void}{GetFilenames}{\param{wxArrayString\& }{filenames}}
160 Fills the array {\it filenames} with the filenames only of selected items. This
161 function should only be used with the controls having the {\tt wxFC\_MULTIPLE} style,
162 use \helpref{GetFilename}{wxfilectrlgetfilename} for the others.
166 {\it filenames} is emptied first.
168 \membersection{wxFileCtrl::GetFilterIndex}\label{wxfilectrlgetfilterindex}
170 \constfunc{int}{GetFilterIndex}{\void}
172 Returns the zero-based index of the currently selected filter.
174 \membersection{wxFileCtrl::ShowHidden}\label{wxfilectrlshowhidden}
176 \func{void}{ShowHidden}{\param{const bool }{show}}
178 Sets whether hidden files and folders are shown or not.
180 \membersection{wxFileCtrl::SetWildcard}\label{wxfilectrlsetwildcard}
182 \func{void}{SetWildcard}{\param{const wxString\& }{wildCard}}
184 Sets the wildcard, which can contain multiple file types, for example:
186 ``BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
188 \membersection{wxFileCtrl::SetFilterIndex}\label{wxfilectrlsetfilterindex}
190 \func{void}{SetFilterIndex}{\param{int }{filterIndex}}
192 Sets the current filter index, starting from zero.
194 \membersection{wxFileCtrl::SetDirectory}\label{wxfilectrlsetdirectory}
196 \func{bool}{SetDirectory}{\param{const wxString\& }{directory}}
198 Sets(changes) the current directory displayed in the control.
200 \wxheading{Return value}
202 Returns \true on success, \false otherwise.
204 \membersection{wxFileCtrl::SetFilename}\label{wxfilectrlsetfilename}
206 \func{bool}{SetFilename}{\param{const wxString\& }{filename}}
208 Selects a certain file.
210 \wxheading{Return value}
212 Returns \true on success, \false otherwise
214 \membersection{wxFileCtrl::SetPath}\label{wxfilectrlsetpath}
216 \func{bool}{SetPath}{\param{const wxString\& }{path}}
218 Selects a certain file using its path (the combined directory and filename).
219 Equivalent to \helpref{SetPath}{wxfilectrlsetpath} then \helpref{SetFilename}{wxfilectrlsetfilename}.
221 \wxheading{Return value}
223 Returns \true on success, \false otherwise.