]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/filedlg.tex
change wxTextValidator to use wxArrayString instead of wxStringList
[wxWidgets.git] / docs / latex / wx / filedlg.tex
CommitLineData
a660d684
KB
1\section{\class{wxFileDialog}}\label{wxfiledialog}
2
3This class represents the file chooser dialog.
4
5\wxheading{Derived from}
6
7\helpref{wxDialog}{wxdialog}\\
8\helpref{wxWindow}{wxwindow}\\
9\helpref{wxEvtHandler}{wxevthandler}\\
10\helpref{wxObject}{wxobject}
11
954b8ae6
JS
12\wxheading{Include files}
13
14<wx/filedlg.h>
15
a660d684
KB
16\wxheading{See also}
17
18\helpref{wxFileDialog overview}{wxfiledialogoverview}, \helpref{wxFileSelector}{wxfileselector}
a660d684
KB
19
20\wxheading{Remarks}
21
22Pops up a file selector box. In Windows, this is the common file selector
23dialog. In X, this is a file selector box with somewhat less functionality.
24The path and filename are distinct elements of a full file pathname.
25If path is ``", the current directory will be used. If filename is ``",
26no default filename will be supplied. The wildcard determines what files
27are displayed in the file selector, and file extension supplies a type
28extension for the required filename. Flags may be a combination of wxOPEN,
2f1b667b 29wxSAVE, wxOVERWRITE\_PROMPT, wxFILE\_MUST\_EXIST, wxMULTIPLE or 0.
a660d684
KB
30
31Both the X and Windows versions implement a wildcard filter. Typing a
32filename containing wildcards (*, ?) in the filename text item, and
33clicking on Ok, will result in only those files matching the pattern being
330d6fd0 34displayed. The wildcard may be a specification for multiple
a660d684
KB
35types of file with a description for each, such as:
36
37\begin{verbatim}
8632fc36 38 "BMP and GIF files (*.bmp;*.gif)|*.bmp;*.gif|PNG files (*.png)|*.png"
a660d684
KB
39\end{verbatim}
40
a4e64fb5
MB
41It must be noted that wildcard support in the native Motif file
42dialog is quite limited: only one alternative is supported,
43and it is displayed without the descriptive test; ``BMP files (*.bmp)|*.bmp''
44is displayed as ``*.bmp'', and both
45``BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif'' and
46``Image files|*.bmp;*.gif'' are errors.
47
a660d684
KB
48\latexignore{\rtfignore{\wxheading{Members}}}
49
b236c10f 50\membersection{wxFileDialog::wxFileDialog}\label{wxfiledialogctor}
a660d684
KB
51
52\func{}{wxFileDialog}{\param{wxWindow* }{parent}, \param{const wxString\& }{message = "Choose a file"},\rtfsp
53\param{const wxString\& }{defaultDir = ""}, \param{const wxString\& }{defaultFile = ``"},\rtfsp
54\param{const wxString\& }{wildcard = ``*.*"}, \param{long }{style = 0}, \param{const wxPoint\& }{pos = wxDefaultPosition}}
55
56Constructor. Use \helpref{wxFileDialog::ShowModal}{wxfiledialogshowmodal} to show the dialog.
57
58\wxheading{Parameters}
59
60\docparam{parent}{Parent window.}
61
62\docparam{message}{Message to show on the dialog.}
63
64\docparam{defaultDir}{The default directory, or the empty string.}
65
66\docparam{defaultFile}{The default filename, or the empty string.}
67
a4e64fb5
MB
68\docparam{wildcard}{A wildcard, such as ``*.*" or ``BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
69
70Note that the native Motif dialog has some limitations with respect to
71wildcards; see the Remarks section above.}
a660d684
KB
72
73\docparam{style}{A dialog style. A bitlist of:
74
75\twocolwidtha{5cm}
76\begin{twocollist}
330d6fd0
RR
77\twocolitem{{\bf wxOPEN}}{This is an open dialog.}
78\twocolitem{{\bf wxSAVE}}{This is a save dialog.}
302a1eca 79\twocolitem{{\bf wxOVERWRITE\_PROMPT}}{For save dialog only: prompt for a confirmation if a file will be overwritten.}
3f6638b8 80\twocolitem{{\bf wxMULTIPLE}}{For open dialog only: allows selecting multiple files.}
9c470b60 81\twocolitem{{\bf wxCHANGE\_DIR}}{Change the current working directory to the directory where the file(s) chosen by the user are.}
a660d684
KB
82\end{twocollist}%
83}
84
85\docparam{pos}{Dialog position. Not implemented.}
86
fc2171bd 87{\bf NB:} Previous versions of wxWidgets used {\tt wxCHANGE\_DIR} by default
3f6638b8
VZ
88under MS Windows which allowed the program to simply remember the last
89directory where user selected the files to open/save. This (desired)
90functionality must be implemented in the program itself now (manually remember
91the last path used and pass it to the dialog the next time it is called) or
92by using this flag.
93
b236c10f 94\membersection{wxFileDialog::\destruct{wxFileDialog}}\label{wxfiledialogdtor}
a660d684
KB
95
96\func{}{\destruct{wxFileDialog}}{\void}
97
98Destructor.
99
100\membersection{wxFileDialog::GetDirectory}\label{wxfiledialoggetdirectory}
101
102\constfunc{wxString}{GetDirectory}{\void}
103
104Returns the default directory.
105
106\membersection{wxFileDialog::GetFilename}\label{wxfiledialoggetfilename}
107
108\constfunc{wxString}{GetFilename}{\void}
109
110Returns the default filename.
111
c61f4f6d
VZ
112\membersection{wxFileDialog::GetFilenames}\label{wxfiledialoggetfilenames}
113
114\constfunc{void}{GetFilenames}{\param{wxArrayString\& }{filenames}}
115
116Fills the array {\it filenames} with the names of the files chosen. This
117function should only be used with the dialogs which have {\tt wxMULTIPLE} style,
118use \helpref{GetFilename}{wxfiledialoggetfilename} for the others.
8ad9ca97
JS
119
120Note that under Windows, if the user selects shortcuts, the filenames
121include paths, since the application cannot determine the full path
122of each referenced file by appending the directory containing the shortcuts
123to the filename.
c61f4f6d 124
a660d684
KB
125\membersection{wxFileDialog::GetFilterIndex}\label{wxfiledialoggetfilterindex}
126
127\constfunc{int}{GetFilterIndex}{\void}
128
129Returns the index into the list of filters supplied, optionally, in the wildcard parameter.
130Before the dialog is shown, this is the index which will be used when the dialog is first displayed.
131After the dialog is shown, this is the index selected by the user.
132
133\membersection{wxFileDialog::GetMessage}\label{wxfiledialoggetmessage}
134
135\constfunc{wxString}{GetMessage}{\void}
136
137Returns the message that will be displayed on the dialog.
138
139\membersection{wxFileDialog::GetPath}\label{wxfiledialoggetpath}
140
141\constfunc{wxString}{GetPath}{\void}
142
143Returns the full path (directory and filename) of the selected file.
144
c61f4f6d
VZ
145\membersection{wxFileDialog::GetPaths}\label{wxfiledialoggetpaths}
146
147\constfunc{void}{GetPaths}{\param{wxArrayString\& }{paths}}
148
149Fills the array {\it paths} with the full paths of the files chosen. This
150function should only be used with the dialogs which have {\tt wxMULTIPLE} style,
151use \helpref{GetPath}{wxfiledialoggetpath} for the others.
152
a660d684
KB
153\membersection{wxFileDialog::GetStyle}\label{wxfiledialoggetstyle}
154
155\constfunc{long}{GetStyle}{\void}
156
157Returns the dialog style.
158
159\membersection{wxFileDialog::GetWildcard}\label{wxfiledialoggetwildcard}
160
161\constfunc{wxString}{GetWildcard}{\void}
162
163Returns the file dialog wildcard.
164
165\membersection{wxFileDialog::SetDirectory}\label{wxfiledialogsetdirectory}
166
167\func{void}{SetDirectory}{\param{const wxString\& }{directory}}
168
169Sets the default directory.
170
171\membersection{wxFileDialog::SetFilename}\label{wxfiledialogsetfilename}
172
173\func{void}{SetFilename}{\param{const wxString\& }{setfilename}}
174
175Sets the default filename.
176
177\membersection{wxFileDialog::SetFilterIndex}\label{wxfiledialogsetfilterindex}
178
179\func{void}{SetFilterIndex}{\param{int }{filterIndex}}
180
2b5f62a0 181Sets the default filter index, starting from zero.
a660d684
KB
182
183\membersection{wxFileDialog::SetMessage}\label{wxfiledialogsetmessage}
184
185\func{void}{SetMessage}{\param{const wxString\& }{message}}
186
187Sets the message that will be displayed on the dialog.
188
189\membersection{wxFileDialog::SetPath}\label{wxfiledialogsetpath}
190
191\func{void}{SetPath}{\param{const wxString\& }{path}}
192
193Sets the path (the combined directory and filename that will be returned when the dialog is dismissed).
194
195\membersection{wxFileDialog::SetStyle}\label{wxfiledialogsetstyle}
196
197\func{void}{SetStyle}{\param{long }{style}}
198
b236c10f 199Sets the dialog style. See \helpref{wxFileDialog::wxFileDialog}{wxfiledialogctor} for details.
a660d684
KB
200
201\membersection{wxFileDialog::SetWildcard}\label{wxfiledialogsetwildcard}
202
203\func{void}{SetWildcard}{\param{const wxString\& }{wildCard}}
204
6a611b39
JS
205Sets the wildcard, which can contain multiple file types, for example:
206
207``BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
a660d684 208
a4e64fb5
MB
209Note that the native Motif dialog has some limitations with respect to
210wildcards; see the Remarks section above.
211
a660d684
KB
212\membersection{wxFileDialog::ShowModal}\label{wxfiledialogshowmodal}
213
214\func{int}{ShowModal}{\void}
215
f6bcfd97 216Shows the dialog, returning wxID\_OK if the user pressed OK, and wxID\_CANCEL
a660d684
KB
217otherwise.
218
219