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