]>
git.saurik.com Git - wxWidgets.git/blob - interface/filepicker.h
7f749aacaf27354495527f6082b41dc8deae886f
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxFilePickerCtrl class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxFilePickerCtrl
11 @wxheader{filepicker.h}
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
18 It is only available if @c wxUSE_FILEPICKERCTRL is set to 1 (the default).
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.
31 Creates a picker which allows the user to select a file to open.
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
40 @style{wxFLP_CHANGE_DIR}:
41 Change current working directory on each user file selection change.
45 @category{miscpickers}
46 @appearance{filepickerctrl.png}
49 wxFileDialog, wxFileDirPickerEvent
51 class wxFilePickerCtrl
: public wxPickerBase
55 Initializes the object and calls Create() with
58 wxFilePickerCtrl(wxWindow
* parent
, wxWindowID id
,
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");
70 Parent window, must not be non-@NULL.
72 The identifier for the control.
74 The initial file shown in the control. Must be a valid path to a file or
77 The message shown to the user in the wxFileDialog shown by the control.
79 A wildcard which defines user-selectable files (use the same syntax as for
80 wxFileDialog's wildcards).
86 The window style, see wxFLP_* flags.
88 Validator which can be used for additional date checks.
92 @returns @true if the control was successfully created or @false if
95 bool Create(wxWindow
* parent
, wxWindowID id
,
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");
106 Similar to GetPath() but returns the path of
107 the currently selected file as a wxFileName object.
109 wxFileName
GetFileName() const;
112 Returns the absolute path of the currently selected file.
114 wxString
GetPath() const;
117 This method does the same thing as SetPath() but
118 takes a wxFileName object instead of a string.
120 void SetFileName(const wxFileName
& filename
);
123 Sets the absolute path of the currently selected file. This must be a valid
125 the @c wxFLP_FILE_MUST_EXIST style was given.
127 void SetPath(const wxString
& filename
);
132 @class wxDirPickerCtrl
133 @wxheader{filepicker.h}
135 This control allows the user to select a directory. The generic implementation
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
141 It is only available if @c wxUSE_DIRPICKERCTRL is set to 1 (the default).
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
157 @style{wxDIRP_CHANGE_DIR}:
158 Change current working directory on each user directory selection
163 @category{miscpickers}
164 @appearance{dirpickerctrl.png}
167 wxDirDialog, wxFileDirPickerEvent
169 class wxDirPickerCtrl
: public wxPickerBase
173 Initializes the object and calls Create() with
176 wxDirPickerCtrl(wxWindow
* parent
, wxWindowID id
,
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");
187 Parent window, must not be non-@NULL.
189 The identifier for the control.
191 The initial directory shown in the control. Must be a valid path to a
192 directory or the empty string.
194 The message shown to the user in the wxDirDialog shown by the control.
200 The window style, see wxDIRP_* flags.
202 Validator which can be used for additional date checks.
206 @returns @true if the control was successfully created or @false if
209 bool Create(wxWindow
* parent
, wxWindowID id
,
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");
219 Returns the absolute path of the currently selected directory as a wxFileName
221 This function is equivalent to GetPath()
223 wxFileName
GetDirName() const;
226 Returns the absolute path of the currently selected directory.
228 wxString
GetPath() const;
231 Just like SetPath() but this function takes a
234 void SetDirName(const wxFileName
& dirname
);
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.
241 void SetPath(const wxString
& dirname
);
246 @class wxFileDirPickerEvent
247 @wxheader{filepicker.h}
249 This event class is used for the events generated by
250 wxFilePickerCtrl and by wxDirPickerCtrl.
258 class wxFileDirPickerEvent
: public wxCommandEvent
262 The constructor is not normally used by the user code.
264 wxFileDirPickerEvent(wxEventType type
, wxObject
* generator
,
266 const wxString path
);
269 Retrieve the absolute path of the file/directory the user has just selected.
271 wxString
GetPath() const;
274 Set the absolute path of the file/directory associated with the event.
276 void SetPath(const wxString
& path
);