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