]>
Commit | Line | Data |
---|---|---|
1 | \section{\class{wxFileDialog}}\label{wxfiledialog} | |
2 | ||
3 | This 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 | ||
12 | \wxheading{Include files} | |
13 | ||
14 | <wx/filedlg.h> | |
15 | ||
16 | \wxheading{See also} | |
17 | ||
18 | \helpref{wxFileDialog overview}{wxfiledialogoverview}, \helpref{wxFileSelector}{wxfileselector} | |
19 | ||
20 | \wxheading{Remarks} | |
21 | ||
22 | Pops up a file selector box. In Windows, this is the common file selector | |
23 | dialog. In X, this is a file selector box with somewhat less functionality. | |
24 | The path and filename are distinct elements of a full file pathname. | |
25 | If path is ``", the current directory will be used. If filename is ``", | |
26 | no default filename will be supplied. The wildcard determines what files | |
27 | are displayed in the file selector, and file extension supplies a type | |
28 | extension for the required filename. Flags may be a combination of wxOPEN, | |
29 | wxSAVE, wxOVERWRITE\_PROMPT, wxHIDE\_READONLY, wxFILE\_MUST\_EXIST, wxMULTIPLE or 0. | |
30 | ||
31 | Both the X and Windows versions implement a wildcard filter. Typing a | |
32 | filename containing wildcards (*, ?) in the filename text item, and | |
33 | clicking on Ok, will result in only those files matching the pattern being | |
34 | displayed. The wildcard may be a specification for multiple | |
35 | types of file with a description for each, such as: | |
36 | ||
37 | \begin{verbatim} | |
38 | "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif" | |
39 | \end{verbatim} | |
40 | ||
41 | \latexignore{\rtfignore{\wxheading{Members}}} | |
42 | ||
43 | \membersection{wxFileDialog::wxFileDialog}\label{wxfiledialogconstr} | |
44 | ||
45 | \func{}{wxFileDialog}{\param{wxWindow* }{parent}, \param{const wxString\& }{message = "Choose a file"},\rtfsp | |
46 | \param{const wxString\& }{defaultDir = ""}, \param{const wxString\& }{defaultFile = ``"},\rtfsp | |
47 | \param{const wxString\& }{wildcard = ``*.*"}, \param{long }{style = 0}, \param{const wxPoint\& }{pos = wxDefaultPosition}} | |
48 | ||
49 | Constructor. Use \helpref{wxFileDialog::ShowModal}{wxfiledialogshowmodal} to show the dialog. | |
50 | ||
51 | \wxheading{Parameters} | |
52 | ||
53 | \docparam{parent}{Parent window.} | |
54 | ||
55 | \docparam{message}{Message to show on the dialog.} | |
56 | ||
57 | \docparam{defaultDir}{The default directory, or the empty string.} | |
58 | ||
59 | \docparam{defaultFile}{The default filename, or the empty string.} | |
60 | ||
61 | \docparam{wildcard}{A wildcard, such as ``*.*".} | |
62 | ||
63 | \docparam{style}{A dialog style. A bitlist of: | |
64 | ||
65 | \twocolwidtha{5cm} | |
66 | \begin{twocollist} | |
67 | \twocolitem{{\bf wxOPEN}}{This is an open dialog.} | |
68 | \twocolitem{{\bf wxSAVE}}{This is a save dialog.} | |
69 | \twocolitem{{\bf wxHIDE\_READONLY}}{Hide read-only files.} | |
70 | \twocolitem{{\bf wxOVERWRITE\_PROMPT}}{Prompt for a conformation if a file will be overridden.} | |
71 | \twocolitem{{\bf wxMULTIPLE}}{For open dialog only: allows selecting multiple files} | |
72 | \end{twocollist}% | |
73 | } | |
74 | ||
75 | \docparam{pos}{Dialog position. Not implemented.} | |
76 | ||
77 | \membersection{wxFileDialog::\destruct{wxFileDialog}} | |
78 | ||
79 | \func{}{\destruct{wxFileDialog}}{\void} | |
80 | ||
81 | Destructor. | |
82 | ||
83 | \membersection{wxFileDialog::GetDirectory}\label{wxfiledialoggetdirectory} | |
84 | ||
85 | \constfunc{wxString}{GetDirectory}{\void} | |
86 | ||
87 | Returns the default directory. | |
88 | ||
89 | \membersection{wxFileDialog::GetFilename}\label{wxfiledialoggetfilename} | |
90 | ||
91 | \constfunc{wxString}{GetFilename}{\void} | |
92 | ||
93 | Returns the default filename. | |
94 | ||
95 | \membersection{wxFileDialog::GetFilenames}\label{wxfiledialoggetfilenames} | |
96 | ||
97 | \constfunc{void}{GetFilenames}{\param{wxArrayString\& }{filenames}} | |
98 | ||
99 | Fills the array {\it filenames} with the names of the files chosen. This | |
100 | function should only be used with the dialogs which have {\tt wxMULTIPLE} style, | |
101 | use \helpref{GetFilename}{wxfiledialoggetfilename} for the others. | |
102 | ||
103 | \membersection{wxFileDialog::GetFilterIndex}\label{wxfiledialoggetfilterindex} | |
104 | ||
105 | \constfunc{int}{GetFilterIndex}{\void} | |
106 | ||
107 | Returns the index into the list of filters supplied, optionally, in the wildcard parameter. | |
108 | Before the dialog is shown, this is the index which will be used when the dialog is first displayed. | |
109 | After the dialog is shown, this is the index selected by the user. | |
110 | ||
111 | \membersection{wxFileDialog::GetMessage}\label{wxfiledialoggetmessage} | |
112 | ||
113 | \constfunc{wxString}{GetMessage}{\void} | |
114 | ||
115 | Returns the message that will be displayed on the dialog. | |
116 | ||
117 | \membersection{wxFileDialog::GetPath}\label{wxfiledialoggetpath} | |
118 | ||
119 | \constfunc{wxString}{GetPath}{\void} | |
120 | ||
121 | Returns the full path (directory and filename) of the selected file. | |
122 | ||
123 | \membersection{wxFileDialog::GetPaths}\label{wxfiledialoggetpaths} | |
124 | ||
125 | \constfunc{void}{GetPaths}{\param{wxArrayString\& }{paths}} | |
126 | ||
127 | Fills the array {\it paths} with the full paths of the files chosen. This | |
128 | function should only be used with the dialogs which have {\tt wxMULTIPLE} style, | |
129 | use \helpref{GetPath}{wxfiledialoggetpath} for the others. | |
130 | ||
131 | \membersection{wxFileDialog::GetStyle}\label{wxfiledialoggetstyle} | |
132 | ||
133 | \constfunc{long}{GetStyle}{\void} | |
134 | ||
135 | Returns the dialog style. | |
136 | ||
137 | \membersection{wxFileDialog::GetWildcard}\label{wxfiledialoggetwildcard} | |
138 | ||
139 | \constfunc{wxString}{GetWildcard}{\void} | |
140 | ||
141 | Returns the file dialog wildcard. | |
142 | ||
143 | \membersection{wxFileDialog::SetDirectory}\label{wxfiledialogsetdirectory} | |
144 | ||
145 | \func{void}{SetDirectory}{\param{const wxString\& }{directory}} | |
146 | ||
147 | Sets the default directory. | |
148 | ||
149 | \membersection{wxFileDialog::SetFilename}\label{wxfiledialogsetfilename} | |
150 | ||
151 | \func{void}{SetFilename}{\param{const wxString\& }{setfilename}} | |
152 | ||
153 | Sets the default filename. | |
154 | ||
155 | \membersection{wxFileDialog::SetFilterIndex}\label{wxfiledialogsetfilterindex} | |
156 | ||
157 | \func{void}{SetFilterIndex}{\param{int }{filterIndex}} | |
158 | ||
159 | Sets the default filter index, starting from zero. Windows only. | |
160 | ||
161 | \membersection{wxFileDialog::SetMessage}\label{wxfiledialogsetmessage} | |
162 | ||
163 | \func{void}{SetMessage}{\param{const wxString\& }{message}} | |
164 | ||
165 | Sets the message that will be displayed on the dialog. | |
166 | ||
167 | \membersection{wxFileDialog::SetPath}\label{wxfiledialogsetpath} | |
168 | ||
169 | \func{void}{SetPath}{\param{const wxString\& }{path}} | |
170 | ||
171 | Sets the path (the combined directory and filename that will be returned when the dialog is dismissed). | |
172 | ||
173 | \membersection{wxFileDialog::SetStyle}\label{wxfiledialogsetstyle} | |
174 | ||
175 | \func{void}{SetStyle}{\param{long }{style}} | |
176 | ||
177 | Sets the dialog style. See \helpref{wxFileDialog::wxFileDialog}{wxfiledialogconstr} for details. | |
178 | ||
179 | \membersection{wxFileDialog::SetWildcard}\label{wxfiledialogsetwildcard} | |
180 | ||
181 | \func{void}{SetWildcard}{\param{const wxString\& }{wildCard}} | |
182 | ||
183 | Sets the wildcard, which in Windows can contain multiple file types. | |
184 | ||
185 | \membersection{wxFileDialog::ShowModal}\label{wxfiledialogshowmodal} | |
186 | ||
187 | \func{int}{ShowModal}{\void} | |
188 | ||
189 | Shows the dialog, returning wxID\_OK if the user pressed OK, and wxOK\_CANCEL | |
190 | otherwise. | |
191 | ||
192 |