]> git.saurik.com Git - wxWidgets.git/blame - interface/filepicker.h
fixed links to global variables; fixed categories; use @see instead of @seealso
[wxWidgets.git] / interface / filepicker.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: filepicker.h
3// Purpose: documentation for wxFilePickerCtrl class
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxFilePickerCtrl
11 @wxheader{filepicker.h}
7c913512 12
23324ae1
FM
13 This control allows the user to select a file. The generic implementation is
14 a button which brings up a wxFileDialog when clicked. Native implementation
15 may differ but this is usually a (small) widget which give access to the
16 file-chooser
17 dialog.
18 It is only available if @c wxUSE_FILEPICKERCTRL is set to 1 (the default).
7c913512 19
23324ae1
FM
20 @beginStyleTable
21 @style{wxFLP_DEFAULT_STYLE}:
22 The default style: includes wxFLP_OPEN | wxFLP_FILE_MUST_EXIST and,
23 under wxMSW only, wxFLP_USE_TEXTCTRL.
24 @style{wxFLP_USE_TEXTCTRL}:
25 Creates a text control to the left of the picker button which is
26 completely managed by the wxFilePickerCtrl and which can be used by
27 the user to specify a path (see SetPath). The text control is
28 automatically synchronized with button's value. Use functions
29 defined in wxPickerBase to modify the text control.
30 @style{wxFLP_OPEN}:
31 Creates a picker which allows the user to select a file to open.
32 @style{wxFLP_SAVE}:
33 Creates a picker which allows the user to select a file to save.
34 @style{wxFLP_OVERWRITE_PROMPT}:
35 Can be combined with wxFLP_SAVE only: ask confirmation to the user
36 before selecting a file.
37 @style{wxFLP_FILE_MUST_EXIST}:
38 Can be combined with wxFLP_OPEN only: the selected file must be an
39 existing file.
40 @style{wxFLP_CHANGE_DIR}:
41 Change current working directory on each user file selection change.
42 @endStyleTable
7c913512 43
23324ae1
FM
44 @library{wxcore}
45 @category{miscpickers}
46 @appearance{filepickerctrl.png}
7c913512 47
23324ae1
FM
48 @seealso
49 wxFileDialog, wxFileDirPickerEvent
50*/
51class wxFilePickerCtrl : public wxPickerBase
52{
53public:
54 /**
55 Initializes the object and calls Create() with
56 all the parameters.
57 */
4cc4bfaf 58 wxFilePickerCtrl(wxWindow* parent, wxWindowID id,
23324ae1
FM
59 const wxString& path = wxEmptyString,
60 const wxString& message = "Select a file",
61 const wxString& wildcard = ".",
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& size = wxDefaultSize,
64 long style = wxFLP_DEFAULT_STYLE,
65 const wxValidator& validator = wxDefaultValidator,
66 const wxString& name = "filepickerctrl");
67
68 /**
7c913512 69 @param parent
4cc4bfaf 70 Parent window, must not be non-@NULL.
7c913512 71 @param id
4cc4bfaf 72 The identifier for the control.
7c913512 73 @param path
4cc4bfaf
FM
74 The initial file shown in the control. Must be a valid path to a file or
75 the empty string.
7c913512 76 @param message
4cc4bfaf 77 The message shown to the user in the wxFileDialog shown by the control.
7c913512 78 @param wildcard
4cc4bfaf 79 A wildcard which defines user-selectable files (use the same syntax as for
23324ae1 80 wxFileDialog's wildcards).
7c913512 81 @param pos
4cc4bfaf 82 Initial position.
7c913512 83 @param size
4cc4bfaf 84 Initial size.
7c913512 85 @param style
4cc4bfaf 86 The window style, see wxFLP_* flags.
7c913512 87 @param validator
4cc4bfaf 88 Validator which can be used for additional date checks.
7c913512 89 @param name
4cc4bfaf 90 Control name.
23324ae1
FM
91
92 @returns @true if the control was successfully created or @false if
4cc4bfaf 93 creation failed.
23324ae1 94 */
4cc4bfaf 95 bool Create(wxWindow* parent, wxWindowID id,
23324ae1
FM
96 const wxString& path = wxEmptyString,
97 const wxString& message = "Select a file",
98 const wxString& wildcard = ".",
99 const wxPoint& pos = wxDefaultPosition,
100 const wxSize& size = wxDefaultSize,
101 long style = wxFLP_DEFAULT_STYLE,
102 const wxValidator& validator = wxDefaultValidator,
103 const wxString& name = "filepickerctrl");
104
105 /**
106 Similar to GetPath() but returns the path of
107 the currently selected file as a wxFileName object.
108 */
328f5751 109 wxFileName GetFileName() const;
23324ae1
FM
110
111 /**
112 Returns the absolute path of the currently selected file.
113 */
328f5751 114 wxString GetPath() const;
23324ae1
FM
115
116 /**
117 This method does the same thing as SetPath() but
118 takes a wxFileName object instead of a string.
119 */
4cc4bfaf 120 void SetFileName(const wxFileName& filename);
23324ae1
FM
121
122 /**
123 Sets the absolute path of the currently selected file. This must be a valid
124 file if
125 the @c wxFLP_FILE_MUST_EXIST style was given.
126 */
4cc4bfaf 127 void SetPath(const wxString& filename);
23324ae1
FM
128};
129
130
131/**
132 @class wxDirPickerCtrl
133 @wxheader{filepicker.h}
7c913512 134
23324ae1
FM
135 This control allows the user to select a directory. The generic implementation
136 is
137 a button which brings up a wxDirDialog when clicked. Native implementation
138 may differ but this is usually a (small) widget which give access to the
139 dir-chooser
140 dialog.
141 It is only available if @c wxUSE_DIRPICKERCTRL is set to 1 (the default).
7c913512 142
23324ae1
FM
143 @beginStyleTable
144 @style{wxDIRP_DEFAULT_STYLE}:
145 The default style: includes wxDIRP_DIR_MUST_EXIST and, under wxMSW
146 only, wxDIRP_USE_TEXTCTRL.
147 @style{wxDIRP_USE_TEXTCTRL}:
148 Creates a text control to the left of the picker button which is
149 completely managed by the wxDirPickerCtrl and which can be used by
150 the user to specify a path (see SetPath). The text control is
151 automatically synchronized with button's value. Use functions
152 defined in wxPickerBase to modify the text control.
153 @style{wxDIRP_DIR_MUST_EXIST}:
154 Creates a picker which allows to select only existing directories.
155 wxGTK control always adds this flag internally as it does not
156 support its absence.
157 @style{wxDIRP_CHANGE_DIR}:
158 Change current working directory on each user directory selection
159 change.
160 @endStyleTable
7c913512 161
23324ae1
FM
162 @library{wxcore}
163 @category{miscpickers}
164 @appearance{dirpickerctrl.png}
7c913512 165
23324ae1
FM
166 @seealso
167 wxDirDialog, wxFileDirPickerEvent
168*/
169class wxDirPickerCtrl : public wxPickerBase
170{
171public:
172 /**
173 Initializes the object and calls Create() with
174 all the parameters.
175 */
4cc4bfaf 176 wxDirPickerCtrl(wxWindow* parent, wxWindowID id,
23324ae1
FM
177 const wxString& path = wxEmptyString,
178 const wxString& message = "Select a folder",
179 const wxPoint& pos = wxDefaultPosition,
180 const wxSize& size = wxDefaultSize,
181 long style = wxDIRP_DEFAULT_STYLE,
182 const wxValidator& validator = wxDefaultValidator,
183 const wxString& name = "dirpickerctrl");
184
185 /**
7c913512 186 @param parent
4cc4bfaf 187 Parent window, must not be non-@NULL.
7c913512 188 @param id
4cc4bfaf 189 The identifier for the control.
7c913512 190 @param path
4cc4bfaf
FM
191 The initial directory shown in the control. Must be a valid path to a
192 directory or the empty string.
7c913512 193 @param message
4cc4bfaf 194 The message shown to the user in the wxDirDialog shown by the control.
7c913512 195 @param pos
4cc4bfaf 196 Initial position.
7c913512 197 @param size
4cc4bfaf 198 Initial size.
7c913512 199 @param style
4cc4bfaf 200 The window style, see wxDIRP_* flags.
7c913512 201 @param validator
4cc4bfaf 202 Validator which can be used for additional date checks.
7c913512 203 @param name
4cc4bfaf 204 Control name.
23324ae1
FM
205
206 @returns @true if the control was successfully created or @false if
4cc4bfaf 207 creation failed.
23324ae1 208 */
4cc4bfaf 209 bool Create(wxWindow* parent, wxWindowID id,
23324ae1
FM
210 const wxString& path = wxEmptyString,
211 const wxString& message = "Select a folder",
212 const wxPoint& pos = wxDefaultPosition,
213 const wxSize& size = wxDefaultSize,
214 long style = wxDIRP_DEFAULT_STYLE,
215 const wxValidator& validator = wxDefaultValidator,
216 const wxString& name = "dirpickerctrl");
217
218 /**
219 Returns the absolute path of the currently selected directory as a wxFileName
220 object.
221 This function is equivalent to GetPath()
222 */
328f5751 223 wxFileName GetDirName() const;
23324ae1
FM
224
225 /**
226 Returns the absolute path of the currently selected directory.
227 */
328f5751 228 wxString GetPath() const;
23324ae1
FM
229
230 /**
231 Just like SetPath() but this function takes a
232 wxFileName object.
233 */
4cc4bfaf 234 void SetDirName(const wxFileName& dirname);
23324ae1
FM
235
236 /**
237 Sets the absolute path of (the default converter uses current locale's
238 charset)the currently selected directory. This must be a valid directory if
239 @c wxDIRP_DIR_MUST_EXIST style was given.
240 */
4cc4bfaf 241 void SetPath(const wxString& dirname);
23324ae1
FM
242};
243
244
245/**
246 @class wxFileDirPickerEvent
247 @wxheader{filepicker.h}
7c913512 248
23324ae1
FM
249 This event class is used for the events generated by
250 wxFilePickerCtrl and by wxDirPickerCtrl.
7c913512 251
23324ae1
FM
252 @library{wxcore}
253 @category{FIXME}
7c913512 254
23324ae1
FM
255 @seealso
256 wxfilepickerctrl
257*/
258class wxFileDirPickerEvent : public wxCommandEvent
259{
260public:
261 /**
262 The constructor is not normally used by the user code.
263 */
4cc4bfaf 264 wxFileDirPickerEvent(wxEventType type, wxObject* generator,
23324ae1
FM
265 int id,
266 const wxString path);
267
268 /**
269 Retrieve the absolute path of the file/directory the user has just selected.
270 */
328f5751 271 wxString GetPath() const;
23324ae1
FM
272
273 /**
274 Set the absolute path of the file/directory associated with the event.
275 */
4cc4bfaf 276 void SetPath(const wxString& path);
23324ae1 277};