]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/filectrl.tex
document LoadObject() (patch 1873045)
[wxWidgets.git] / docs / latex / wx / filectrl.tex
CommitLineData
0cf3e587
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: filectrl.tex
3%% Purpose: wxFilerCtrl documentation
4%% Author: Diaa M. Sami
5%% Created: 2007-07-25
6%% RCS-ID: $Id: $
7%% Copyright: (c) 2007 Diaa M. Sami
8%% License: wxWindows license
9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
11\section{\class{wxFileCtrl}}\label{wxfilectrl}
12
13This control allows the user to select a file. two implemetations exist, one
14for Gtk and another generic one for anything other than Gtk.
15It is only available if \texttt{wxUSE\_FILECTRL} is set to $1$.
16
17\wxheading{Derived from}
18
19\helpref{wxWindow}{wxwindow}\\
20\helpref{wxEvtHandler}{wxevthandler}\\
21\helpref{wxObject}{wxobject}
22
23\wxheading{Include files}
24
25<wx/filectrl.h>
26
27\wxheading{Window styles}
28
29\twocolwidtha{5cm}%
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.
33Cannot 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)}
37\end{twocollist}
38
39\wxheading{Event handling}
40
41To process a file control event, use these event handler macros to direct
42input to member functions that take a \helpref{wxFileCtrlEvent}{wxfilectrlevent}
43argument.
44
45\twocolwidtha{7cm}%
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)}
9056c785 49\twocolitem{{\bf EVT\_FILECTRL\_FOLDERCHANGED(id, func)}}{The current folder of the file control has been changed}
0cf3e587
VZ
50\end{twocollist}
51
52\wxheading{See also}
53
54\helpref{wxGenericDirCtrl}{wxgenericdirctrl}
55
56\latexignore{\rtfignore{\wxheading{Members}}}
57
58\membersection{wxFileCtrl::wxFileCtrl}\label{wxfilectrlctor}
59
60\func{}{wxFileCtrl}{\void}
61
62Default constructor.
63
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"}}
73
74\wxheading{Parameters}
75
76\docparam{parent}{Parent window, must not be non-\texttt{NULL}.}
77
78\docparam{id}{The identifier for the control.}
79
80\docparam{defaultDirectory}{The initial directory shown in the control. Must be
81a valid path to a directory or the empty string.
82In case it is the empty string, the current working directory is used.}
83
84\docparam{defaultFilename}{The default filename, or the empty string.}
85
86\docparam{wildcard}{A wildcard specifying which files can be selected,
87such as ``*.*" or ``BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".}
88
89\docparam{style}{The window style, see {\tt wxFC\_*} flags.}
90
91\docparam{pos}{Initial position.}
92
93\docparam{size}{Initial size.}
94
95\docparam{name}{Control name.}
96
97\wxheading{Return value}
98
99\true if the control was successfully created or \false if creation failed.
100
101\membersection{wxFileCtrl::Create}\label{wxfilectrlcreate}
102
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"}}
112
113Create function for two-step construction. See \helpref{wxFileCtrl::wxFileCtrl}{wxfilectrlctor} for details.
114
115\membersection{wxFileDialog::GetFilename}\label{wxfilectrlgetfilename}
116
117\constfunc{wxString}{GetFilename}{\void}
118
119Returns the currently selected filename.
120For the controls having the {\tt wxFC\_MULTIPLE} style, use \helpref{GetFilenames}{wxfilectrlgetfilenames}
121instead
122
123\membersection{wxFileCtrl::GetDirectory}\label{wxfilectrlgetdirectory}
124
125\constfunc{wxString}{GetDirectory}{\void}
126
9056c785
VZ
127Returns the current directory of the file control (i.e. the directory shown by
128it).
0cf3e587
VZ
129
130\membersection{wxFileCtrl::GetWildcard}\label{wxfilectrlgetwildcard}
131
132\constfunc{wxString}{GetWildcard}{\void}
133
134Returns the current wildcard.
135
136\membersection{wxFileCtrl::GetPath}\label{wxfilectrlgetpath}
137
138\constfunc{wxString}{GetPath}{\void}
139
140Returns the full path (directory and filename) of the currently selected file.
141For the controls having the {\tt wxFC\_MULTIPLE} style, use \helpref{GetPaths}{wxfilectrlgetpaths}
142instead
143
144\membersection{wxFileCtrl::GetPaths}\label{wxfilectrlgetpaths}
145
146\constfunc{void}{GetPaths}{\param{wxArrayString\& }{paths}}
147
148Fills the array {\it paths} with the full paths of the files chosen. This
149function should be used with the controls having the {\tt wxFC\_MULTIPLE} style,
150use \helpref{GetPath}{wxfilectrlgetpath} otherwise.
151
152\wxheading{Remarks}
153
154{\it paths} is emptied first.
155
156\membersection{wxFileCtrl::GetFilenames}\label{wxfilectrlgetfilenames}
157
158\constfunc{void}{GetFilenames}{\param{wxArrayString\& }{filenames}}
159
160Fills the array {\it filenames} with the filenames only of selected items. This
161function should only be used with the controls having the {\tt wxFC\_MULTIPLE} style,
162use \helpref{GetFilename}{wxfilectrlgetfilename} for the others.
163
164\wxheading{Remarks}
165
166{\it filenames} is emptied first.
167
168\membersection{wxFileCtrl::GetFilterIndex}\label{wxfilectrlgetfilterindex}
169
170\constfunc{int}{GetFilterIndex}{\void}
171
172Returns the zero-based index of the currently selected filter.
173
174\membersection{wxFileCtrl::ShowHidden}\label{wxfilectrlshowhidden}
175
176\func{void}{ShowHidden}{\param{const bool }{show}}
177
178Sets whether hidden files and folders are shown or not.
179
180\membersection{wxFileCtrl::SetWildcard}\label{wxfilectrlsetwildcard}
181
182\func{void}{SetWildcard}{\param{const wxString\& }{wildCard}}
183
184Sets the wildcard, which can contain multiple file types, for example:
185
186``BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
187
188\membersection{wxFileCtrl::SetFilterIndex}\label{wxfilectrlsetfilterindex}
189
190\func{void}{SetFilterIndex}{\param{int }{filterIndex}}
191
192Sets the current filter index, starting from zero.
193
194\membersection{wxFileCtrl::SetDirectory}\label{wxfilectrlsetdirectory}
195
196\func{bool}{SetDirectory}{\param{const wxString\& }{directory}}
197
198Sets(changes) the current directory displayed in the control.
199
200\wxheading{Return value}
201
202Returns \true on success, \false otherwise.
203
204\membersection{wxFileCtrl::SetFilename}\label{wxfilectrlsetfilename}
205
206\func{bool}{SetFilename}{\param{const wxString\& }{filename}}
207
208Selects a certain file.
209
210\wxheading{Return value}
211
212Returns \true on success, \false otherwise
213
214\membersection{wxFileCtrl::SetPath}\label{wxfilectrlsetpath}
215
216\func{bool}{SetPath}{\param{const wxString\& }{path}}
217
218Selects a certain file using its path (the combined directory and filename).
219Equivalent to \helpref{SetPath}{wxfilectrlsetpath} then \helpref{SetFilename}{wxfilectrlsetfilename}.
220
221\wxheading{Return value}
222
223Returns \true on success, \false otherwise.