wxrust/generated/methods_f.rs
1use super::*;
2
3// wxFileCtrl
4/// This trait represents [C++ `wxFileCtrl` class](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html)'s methods and inheritance.
5///
6/// See [`FileCtrlIsOwned`] documentation for the class usage.
7pub trait FileCtrlMethods: ControlMethods {
8 /// Create function for two-step construction.
9 ///
10 /// See [C++ `wxFileCtrl::Create()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#adfd64c940ac90a72a5b5931404c12c79).
11 fn create_str<W: WindowMethods, P: PointMethods, S: SizeMethods>(
12 &self,
13 parent: Option<&W>,
14 id: c_int,
15 default_directory: &str,
16 default_filename: &str,
17 wild_card: &str,
18 style: c_long,
19 pos: &P,
20 size: &S,
21 name: &str,
22 ) -> bool {
23 unsafe {
24 let parent = match parent {
25 Some(r) => r.as_ptr(),
26 None => ptr::null_mut(),
27 };
28 let default_directory = WxString::from(default_directory);
29 let default_directory = default_directory.as_ptr();
30 let default_filename = WxString::from(default_filename);
31 let default_filename = default_filename.as_ptr();
32 let wild_card = WxString::from(wild_card);
33 let wild_card = wild_card.as_ptr();
34 let pos = pos.as_ptr();
35 let size = size.as_ptr();
36 let name = WxString::from(name);
37 let name = name.as_ptr();
38 ffi::wxFileCtrl_Create(
39 self.as_ptr(),
40 parent,
41 id,
42 default_directory,
43 default_filename,
44 wild_card,
45 style,
46 pos,
47 size,
48 name,
49 )
50 }
51 }
52 /// Returns the current directory of the file control (i.e. the directory shown by it).
53 ///
54 /// See [C++ `wxFileCtrl::GetDirectory()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#a660189a738b48e42f682e616295a9657).
55 fn get_directory(&self) -> String {
56 unsafe { WxString::from_ptr(ffi::wxFileCtrl_GetDirectory(self.as_ptr())).into() }
57 }
58 /// Returns the currently selected filename.
59 ///
60 /// See [C++ `wxFileCtrl::GetFilename()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#aaf4b92dbfc7c0df9d55c90722872720c).
61 fn get_filename(&self) -> String {
62 unsafe { WxString::from_ptr(ffi::wxFileCtrl_GetFilename(self.as_ptr())).into() }
63 }
64 /// Fills the array filenames with the filenames only of selected items.
65 ///
66 /// See [C++ `wxFileCtrl::GetFilenames()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#a4e4018fdaccdb32cae774fec077432f9).
67 fn get_filenames<A: ArrayStringMethods>(&self, filenames: &A) {
68 unsafe {
69 let filenames = filenames.as_ptr();
70 ffi::wxFileCtrl_GetFilenames(self.as_ptr(), filenames)
71 }
72 }
73 /// Returns the zero-based index of the currently selected filter.
74 ///
75 /// See [C++ `wxFileCtrl::GetFilterIndex()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#af94c3a066652014972eb2090b6fd0b2d).
76 fn get_filter_index(&self) -> c_int {
77 unsafe { ffi::wxFileCtrl_GetFilterIndex(self.as_ptr()) }
78 }
79 /// Returns the full path (directory and filename) of the currently selected file.
80 ///
81 /// See [C++ `wxFileCtrl::GetPath()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#a3ba040d726dd6478c1f8c622e275cdd5).
82 fn get_path(&self) -> String {
83 unsafe { WxString::from_ptr(ffi::wxFileCtrl_GetPath(self.as_ptr())).into() }
84 }
85 /// Fills the array paths with the full paths of the files chosen.
86 ///
87 /// See [C++ `wxFileCtrl::GetPaths()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#a51aa11d5765bb4ce7050496e03774a8c).
88 fn get_paths<A: ArrayStringMethods>(&self, paths: &A) {
89 unsafe {
90 let paths = paths.as_ptr();
91 ffi::wxFileCtrl_GetPaths(self.as_ptr(), paths)
92 }
93 }
94 /// Returns the current wildcard.
95 ///
96 /// See [C++ `wxFileCtrl::GetWildcard()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#a5c5f14c67967b6eedbbec191897f8ca5).
97 fn get_wildcard(&self) -> String {
98 unsafe { WxString::from_ptr(ffi::wxFileCtrl_GetWildcard(self.as_ptr())).into() }
99 }
100 /// Sets(changes) the current directory displayed in the control.
101 ///
102 /// See [C++ `wxFileCtrl::SetDirectory()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#afc5c972073949ff303acd9f9834b0543).
103 fn set_directory(&self, directory: &str) -> bool {
104 unsafe {
105 let directory = WxString::from(directory);
106 let directory = directory.as_ptr();
107 ffi::wxFileCtrl_SetDirectory(self.as_ptr(), directory)
108 }
109 }
110 /// Selects a certain file.
111 ///
112 /// See [C++ `wxFileCtrl::SetFilename()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#aa6672f8ae14c8d59eb8312d8935eebd6).
113 fn set_filename(&self, filename: &str) -> bool {
114 unsafe {
115 let filename = WxString::from(filename);
116 let filename = filename.as_ptr();
117 ffi::wxFileCtrl_SetFilename(self.as_ptr(), filename)
118 }
119 }
120 /// Changes to a certain directory and selects a certain file.
121 ///
122 /// See [C++ `wxFileCtrl::SetPath()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#a588d1276adfe6ab5b53f41c7cf67a30d).
123 fn set_path(&self, path: &str) -> bool {
124 unsafe {
125 let path = WxString::from(path);
126 let path = path.as_ptr();
127 ffi::wxFileCtrl_SetPath(self.as_ptr(), path)
128 }
129 }
130 /// Sets the current filter index, starting from zero.
131 ///
132 /// See [C++ `wxFileCtrl::SetFilterIndex()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#a3e69759abe6cf646c4aff13d4bb32145).
133 fn set_filter_index(&self, filter_index: c_int) {
134 unsafe { ffi::wxFileCtrl_SetFilterIndex(self.as_ptr(), filter_index) }
135 }
136 /// Sets the wildcard, which can contain multiple file types, for example: "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
137 ///
138 /// See [C++ `wxFileCtrl::SetWildcard()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#a7599cc5356e0d0f2b851374d591d9aeb).
139 fn set_wildcard(&self, wild_card: &str) {
140 unsafe {
141 let wild_card = WxString::from(wild_card);
142 let wild_card = wild_card.as_ptr();
143 ffi::wxFileCtrl_SetWildcard(self.as_ptr(), wild_card)
144 }
145 }
146 /// Sets whether hidden files and folders are shown or not.
147 ///
148 /// See [C++ `wxFileCtrl::ShowHidden()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl.html#a062c1bbdd9c31f647286db8cac2990b8).
149 fn show_hidden(&self, show: bool) {
150 unsafe { ffi::wxFileCtrl_ShowHidden(self.as_ptr(), show) }
151 }
152}
153
154// wxFileCtrlEvent
155/// This trait represents [C++ `wxFileCtrlEvent` class](https://docs.wxwidgets.org/3.2/classwx_file_ctrl_event.html)'s methods and inheritance.
156///
157/// See [`FileCtrlEventIsOwned`] documentation for the class usage.
158pub trait FileCtrlEventMethods: CommandEventMethods {
159 /// Returns the current directory.
160 ///
161 /// See [C++ `wxFileCtrlEvent::GetDirectory()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl_event.html#a49aaa8fa4695ac25354f6bce528c1ace).
162 fn get_directory(&self) -> String {
163 unsafe { WxString::from_ptr(ffi::wxFileCtrlEvent_GetDirectory(self.as_ptr())).into() }
164 }
165 /// Returns the file selected (assuming it is only one file).
166 ///
167 /// See [C++ `wxFileCtrlEvent::GetFile()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl_event.html#a8cdf46598822faaff51128e20c2df43e).
168 fn get_file(&self) -> String {
169 unsafe { WxString::from_ptr(ffi::wxFileCtrlEvent_GetFile(self.as_ptr())).into() }
170 }
171 /// Returns the files selected.
172 ///
173 /// See [C++ `wxFileCtrlEvent::GetFiles()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl_event.html#a615897eec0a3bb9a963cd5bd892d8c85).
174 fn get_files(&self) -> ArrayString {
175 unsafe { ArrayString::from_ptr(ffi::wxFileCtrlEvent_GetFiles(self.as_ptr())) }
176 }
177 /// Returns the current file filter index.
178 ///
179 /// See [C++ `wxFileCtrlEvent::GetFilterIndex()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl_event.html#a241db981f38e2cda43c6e2cbb7a1398f).
180 fn get_filter_index(&self) -> c_int {
181 unsafe { ffi::wxFileCtrlEvent_GetFilterIndex(self.as_ptr()) }
182 }
183 /// Sets the files changed by this event.
184 ///
185 /// See [C++ `wxFileCtrlEvent::SetFiles()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl_event.html#aa318626624419fedcfdb66e99f162371).
186 fn set_files<A: ArrayStringMethods>(&self, files: &A) {
187 unsafe {
188 let files = files.as_ptr();
189 ffi::wxFileCtrlEvent_SetFiles(self.as_ptr(), files)
190 }
191 }
192 /// Sets the directory of this event.
193 ///
194 /// See [C++ `wxFileCtrlEvent::SetDirectory()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl_event.html#a17fb78dfee5c02fc9c51bbd8dac02481).
195 fn set_directory(&self, directory: &str) {
196 unsafe {
197 let directory = WxString::from(directory);
198 let directory = directory.as_ptr();
199 ffi::wxFileCtrlEvent_SetDirectory(self.as_ptr(), directory)
200 }
201 }
202 /// Sets the filter index changed by this event.
203 ///
204 /// See [C++ `wxFileCtrlEvent::SetFilterIndex()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_ctrl_event.html#a24e26be83fabc7368fc53134789da2db).
205 fn set_filter_index(&self, index: c_int) {
206 unsafe { ffi::wxFileCtrlEvent_SetFilterIndex(self.as_ptr(), index) }
207 }
208}
209
210// wxFileDataObject
211/// This trait represents [C++ `wxFileDataObject` class](https://docs.wxwidgets.org/3.2/classwx_file_data_object.html)'s methods and inheritance.
212///
213/// See [`FileDataObjectIsOwned`] documentation for the class usage.
214pub trait FileDataObjectMethods: DataObjectSimpleMethods {
215 /// Adds a file to the file list represented by this data object (Windows only).
216 ///
217 /// See [C++ `wxFileDataObject::AddFile()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_data_object.html#af2e24d5d093a189b1a410a7f862123ba).
218 fn add_file(&self, file: &str) {
219 unsafe {
220 let file = WxString::from(file);
221 let file = file.as_ptr();
222 ffi::wxFileDataObject_AddFile(self.as_ptr(), file)
223 }
224 }
225 /// Returns the array of file names.
226 ///
227 /// See [C++ `wxFileDataObject::GetFilenames()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_data_object.html#a40727417bb94728bb759b63314138b5b).
228 fn get_filenames(&self) -> ArrayStringIsOwned<false> {
229 unsafe { ArrayStringIsOwned::from_ptr(ffi::wxFileDataObject_GetFilenames(self.as_ptr())) }
230 }
231}
232
233// wxFileDialog
234/// This trait represents [C++ `wxFileDialog` class](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html)'s methods and inheritance.
235///
236/// See [`FileDialogIsOwned`] documentation for the class usage.
237pub trait FileDialogMethods: DialogMethods {
238 // DTOR: fn ~wxFileDialog()
239 /// Returns the path of the file currently selected in dialog.
240 ///
241 /// See [C++ `wxFileDialog::GetCurrentlySelectedFilename()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#a05107400272572b7abec4ac831ef50c0).
242 fn get_currently_selected_filename(&self) -> String {
243 unsafe {
244 WxString::from_ptr(ffi::wxFileDialog_GetCurrentlySelectedFilename(
245 self.as_ptr(),
246 ))
247 .into()
248 }
249 }
250 /// Returns the file type filter index currently selected in dialog.
251 ///
252 /// See [C++ `wxFileDialog::GetCurrentlySelectedFilterIndex()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#aec472cd5877d704244bb9b770bf5d910).
253 fn get_currently_selected_filter_index(&self) -> c_int {
254 unsafe { ffi::wxFileDialog_GetCurrentlySelectedFilterIndex(self.as_ptr()) }
255 }
256 /// Returns the default directory.
257 ///
258 /// See [C++ `wxFileDialog::GetDirectory()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#ac9db32a1d92c89c00270dc2a2a865135).
259 fn get_directory(&self) -> String {
260 unsafe { WxString::from_ptr(ffi::wxFileDialog_GetDirectory(self.as_ptr())).into() }
261 }
262 /// If functions SetExtraControlCreator() and ShowModal() were called, returns the extra window.
263 ///
264 /// See [C++ `wxFileDialog::GetExtraControl()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#a6ca6f9056340144945754b32f77ea838).
265 fn get_extra_control(&self) -> WeakRef<Window> {
266 unsafe { WeakRef::<Window>::from(ffi::wxFileDialog_GetExtraControl(self.as_ptr())) }
267 }
268 /// Returns the default filename.
269 ///
270 /// See [C++ `wxFileDialog::GetFilename()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#a4d0948d01b050738c4b00dc11a26400b).
271 fn get_filename(&self) -> String {
272 unsafe { WxString::from_ptr(ffi::wxFileDialog_GetFilename(self.as_ptr())).into() }
273 }
274 /// Fills the array filenames with the names of the files chosen.
275 ///
276 /// See [C++ `wxFileDialog::GetFilenames()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#ac2c5811b6231008687e07b5a735e6063).
277 fn get_filenames<A: ArrayStringMethods>(&self, filenames: &A) {
278 unsafe {
279 let filenames = filenames.as_ptr();
280 ffi::wxFileDialog_GetFilenames(self.as_ptr(), filenames)
281 }
282 }
283 /// Returns the index into the list of filters supplied, optionally, in the wildcard parameter.
284 ///
285 /// See [C++ `wxFileDialog::GetFilterIndex()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#abf751784b7fff13f62c9679ec0963df0).
286 fn get_filter_index(&self) -> c_int {
287 unsafe { ffi::wxFileDialog_GetFilterIndex(self.as_ptr()) }
288 }
289 /// Returns the message that will be displayed on the dialog.
290 ///
291 /// See [C++ `wxFileDialog::GetMessage()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#ad79729f7d758ac5b25a5991dbae94bdb).
292 fn get_message(&self) -> String {
293 unsafe { WxString::from_ptr(ffi::wxFileDialog_GetMessage(self.as_ptr())).into() }
294 }
295 /// Returns the full path (directory and filename) of the selected file.
296 ///
297 /// See [C++ `wxFileDialog::GetPath()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#a9b81a1a4a9c6e6d22b5edd635862aff5).
298 fn get_path(&self) -> String {
299 unsafe { WxString::from_ptr(ffi::wxFileDialog_GetPath(self.as_ptr())).into() }
300 }
301 /// Fills the array paths with the full paths of the files chosen.
302 ///
303 /// See [C++ `wxFileDialog::GetPaths()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#a0bc1a3ed7ef7c91720b64acc778e2c5c).
304 fn get_paths<A: ArrayStringMethods>(&self, paths: &A) {
305 unsafe {
306 let paths = paths.as_ptr();
307 ffi::wxFileDialog_GetPaths(self.as_ptr(), paths)
308 }
309 }
310 /// Returns the file dialog wildcard.
311 ///
312 /// See [C++ `wxFileDialog::GetWildcard()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#afb4ad06b7cc2df4c160bbfcb174e93c8).
313 fn get_wildcard(&self) -> String {
314 unsafe { WxString::from_ptr(ffi::wxFileDialog_GetWildcard(self.as_ptr())).into() }
315 }
316 /// Set the hook to be used for customizing the dialog contents.
317 ///
318 /// See [C++ `wxFileDialog::SetCustomizeHook()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#ab02b1018e1e045904656e1d094010bc2).
319 fn set_customize_hook(&self, customize_hook: *mut c_void) -> bool {
320 unsafe { ffi::wxFileDialog_SetCustomizeHook(self.as_ptr(), customize_hook) }
321 }
322 /// Sets the default directory.
323 ///
324 /// See [C++ `wxFileDialog::SetDirectory()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#ac9d3622241e377b3d7dae6fc80acdf88).
325 fn set_directory(&self, directory: &str) {
326 unsafe {
327 let directory = WxString::from(directory);
328 let directory = directory.as_ptr();
329 ffi::wxFileDialog_SetDirectory(self.as_ptr(), directory)
330 }
331 }
332 // NOT_SUPPORTED: fn SetExtraControlCreator()
333 /// Sets the default filename.
334 ///
335 /// See [C++ `wxFileDialog::SetFilename()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#afb7fe41fee49450402a598dfa3526a61).
336 fn set_filename(&self, setfilename: &str) {
337 unsafe {
338 let setfilename = WxString::from(setfilename);
339 let setfilename = setfilename.as_ptr();
340 ffi::wxFileDialog_SetFilename(self.as_ptr(), setfilename)
341 }
342 }
343 /// Sets the default filter index, starting from zero.
344 ///
345 /// See [C++ `wxFileDialog::SetFilterIndex()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#a49a27f0f2550b9bc79ad26c9a19eaf28).
346 fn set_filter_index(&self, filter_index: c_int) {
347 unsafe { ffi::wxFileDialog_SetFilterIndex(self.as_ptr(), filter_index) }
348 }
349 /// Sets the message that will be displayed on the dialog.
350 ///
351 /// See [C++ `wxFileDialog::SetMessage()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#a6b3ac95e95750179164111b36ec4e0ec).
352 fn set_message(&self, message: &str) {
353 unsafe {
354 let message = WxString::from(message);
355 let message = message.as_ptr();
356 ffi::wxFileDialog_SetMessage(self.as_ptr(), message)
357 }
358 }
359 /// Sets the path (the combined directory and filename that will be returned when the dialog is dismissed).
360 ///
361 /// See [C++ `wxFileDialog::SetPath()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#af81f0017c66440e2987648e5bc64f856).
362 fn set_path(&self, path: &str) {
363 unsafe {
364 let path = WxString::from(path);
365 let path = path.as_ptr();
366 ffi::wxFileDialog_SetPath(self.as_ptr(), path)
367 }
368 }
369 /// Sets the wildcard, which can contain multiple file types, for example: "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
370 ///
371 /// See [C++ `wxFileDialog::SetWildcard()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dialog.html#aeb0137b721770bb390043b77cf2c09ff).
372 fn set_wildcard(&self, wild_card: &str) {
373 unsafe {
374 let wild_card = WxString::from(wild_card);
375 let wild_card = wild_card.as_ptr();
376 ffi::wxFileDialog_SetWildcard(self.as_ptr(), wild_card)
377 }
378 }
379}
380
381// wxFileDirPickerEvent
382/// This trait represents [C++ `wxFileDirPickerEvent` class](https://docs.wxwidgets.org/3.2/classwx_file_dir_picker_event.html)'s methods and inheritance.
383///
384/// See [`FileDirPickerEventIsOwned`] documentation for the class usage.
385pub trait FileDirPickerEventMethods: CommandEventMethods {
386 /// Retrieve the absolute path of the file/directory the user has just selected.
387 ///
388 /// See [C++ `wxFileDirPickerEvent::GetPath()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dir_picker_event.html#ae6259bdc805313ceb5cdb826794aafe7).
389 fn get_path(&self) -> String {
390 unsafe { WxString::from_ptr(ffi::wxFileDirPickerEvent_GetPath(self.as_ptr())).into() }
391 }
392 /// Set the absolute path of the file/directory associated with the event.
393 ///
394 /// See [C++ `wxFileDirPickerEvent::SetPath()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_dir_picker_event.html#a4bdc140322bb16344da7ecf51aa216ce).
395 fn set_path(&self, path: &str) {
396 unsafe {
397 let path = WxString::from(path);
398 let path = path.as_ptr();
399 ffi::wxFileDirPickerEvent_SetPath(self.as_ptr(), path)
400 }
401 }
402}
403
404// wxFileDropTarget
405/// This trait represents [C++ `wxFileDropTarget` class](https://docs.wxwidgets.org/3.2/classwx_file_drop_target.html)'s methods and inheritance.
406///
407/// See [`FileDropTargetIsOwned`] documentation for the class usage.
408pub trait FileDropTargetMethods: DropTargetMethods {
409 /// Override this function to receive dropped files.
410 ///
411 /// See [C++ `wxFileDropTarget::OnDropFiles()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_drop_target.html#ad4f15d965332e232a59fe985e37d48f9).
412 fn on_drop_files<A: ArrayStringMethods>(&self, x: c_int, y: c_int, filenames: &A) -> bool {
413 unsafe {
414 let filenames = filenames.as_ptr();
415 ffi::wxFileDropTarget_OnDropFiles(self.as_ptr(), x, y, filenames)
416 }
417 }
418}
419
420// wxFileHistory
421/// This trait represents [C++ `wxFileHistory` class](https://docs.wxwidgets.org/3.2/classwx_file_history.html)'s methods and inheritance.
422///
423/// See [`FileHistoryIsOwned`] documentation for the class usage.
424pub trait FileHistoryMethods: ObjectMethods {
425 // DTOR: fn ~wxFileHistory()
426 /// Adds a file to the file history list, if the object has a pointer to an appropriate file menu.
427 ///
428 /// See [C++ `wxFileHistory::AddFileToHistory()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#a835839c473dfa42feecc78bb4798c79d).
429 fn add_file_to_history(&self, filename: &str) {
430 unsafe {
431 let filename = WxString::from(filename);
432 let filename = filename.as_ptr();
433 ffi::wxFileHistory_AddFileToHistory(self.as_ptr(), filename)
434 }
435 }
436 /// Appends the files in the history list, to all menus managed by the file history object.
437 ///
438 /// See [C++ `wxFileHistory::AddFilesToMenu()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#a8c77c1d51e18be0b54639953745481a6).
439 fn add_files_to_menu(&self) {
440 unsafe { ffi::wxFileHistory_AddFilesToMenu(self.as_ptr()) }
441 }
442 /// Appends the files in the history list, to the given menu only.
443 ///
444 /// See [C++ `wxFileHistory::AddFilesToMenu()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#a285f936b4c746f5214059a69357d049f).
445 fn add_files_to_menu_menu<M: MenuMethods>(&self, menu: Option<&M>) {
446 unsafe {
447 let menu = match menu {
448 Some(r) => r.as_ptr(),
449 None => ptr::null_mut(),
450 };
451 ffi::wxFileHistory_AddFilesToMenu1(self.as_ptr(), menu)
452 }
453 }
454 /// Returns the base identifier for the range used for appending items.
455 ///
456 /// See [C++ `wxFileHistory::GetBaseId()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#ad4ac1e52985ede2e653d2b0cbc3d0fe9).
457 fn get_base_id(&self) -> c_int {
458 unsafe { ffi::wxFileHistory_GetBaseId(self.as_ptr()) }
459 }
460 /// Returns the number of files currently stored in the file history.
461 ///
462 /// See [C++ `wxFileHistory::GetCount()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#a27cf5fe852e6fae1fb4cd390c8b48ff4).
463 fn get_count(&self) -> usize {
464 unsafe { ffi::wxFileHistory_GetCount(self.as_ptr()) }
465 }
466 /// Returns the file at this index (zero-based).
467 ///
468 /// See [C++ `wxFileHistory::GetHistoryFile()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#ad6e3e5fc63641cb3066ac41641e6a905).
469 fn get_history_file(&self, index: usize) -> String {
470 unsafe {
471 WxString::from_ptr(ffi::wxFileHistory_GetHistoryFile(self.as_ptr(), index)).into()
472 }
473 }
474 /// Returns the maximum number of files that can be stored.
475 ///
476 /// See [C++ `wxFileHistory::GetMaxFiles()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#aecb9ad3cb5e1953a8d6731672b84e37f).
477 fn get_max_files(&self) -> c_int {
478 unsafe { ffi::wxFileHistory_GetMaxFiles(self.as_ptr()) }
479 }
480 // BLOCKED: fn GetMenus()
481 /// Loads the file history from the given config object.
482 ///
483 /// See [C++ `wxFileHistory::Load()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#a2537201495686a3a6a26701e158ecfb3).
484 fn load(&self, config: *const c_void) {
485 unsafe { ffi::wxFileHistory_Load(self.as_ptr(), config) }
486 }
487 /// Removes the specified file from the history.
488 ///
489 /// See [C++ `wxFileHistory::RemoveFileFromHistory()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#ad9e2db9f45b538c19a240c55ccd60448).
490 fn remove_file_from_history(&self, i: usize) {
491 unsafe { ffi::wxFileHistory_RemoveFileFromHistory(self.as_ptr(), i) }
492 }
493 /// Removes this menu from the list of those managed by this object.
494 ///
495 /// See [C++ `wxFileHistory::RemoveMenu()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#a5ed5eb530eb2fce7207ff8688535423c).
496 fn remove_menu<M: MenuMethods>(&self, menu: Option<&M>) {
497 unsafe {
498 let menu = match menu {
499 Some(r) => r.as_ptr(),
500 None => ptr::null_mut(),
501 };
502 ffi::wxFileHistory_RemoveMenu(self.as_ptr(), menu)
503 }
504 }
505 /// Saves the file history into the given config object.
506 ///
507 /// See [C++ `wxFileHistory::Save()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#a0552296e381e7a3500e0813d2263930e).
508 fn save(&self, config: *mut c_void) {
509 unsafe { ffi::wxFileHistory_Save(self.as_ptr(), config) }
510 }
511 /// Sets the base identifier for the range used for appending items.
512 ///
513 /// See [C++ `wxFileHistory::SetBaseId()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#ae778a6e4ade91d08b048082c3ec3566f).
514 fn set_base_id(&self, base_id: c_int) {
515 unsafe { ffi::wxFileHistory_SetBaseId(self.as_ptr(), base_id) }
516 }
517 /// Adds this menu to the list of those menus that are managed by this file history object.
518 ///
519 /// See [C++ `wxFileHistory::UseMenu()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_history.html#ad73800aba67b30fc9d0dc94f17c4cc09).
520 fn use_menu<M: MenuMethods>(&self, menu: Option<&M>) {
521 unsafe {
522 let menu = match menu {
523 Some(r) => r.as_ptr(),
524 None => ptr::null_mut(),
525 };
526 ffi::wxFileHistory_UseMenu(self.as_ptr(), menu)
527 }
528 }
529 // NOT_SUPPORTED: fn SetMenuPathStyle()
530 // NOT_SUPPORTED: fn GetMenuPathStyle()
531}
532
533// wxFilePickerCtrl
534/// This trait represents [C++ `wxFilePickerCtrl` class](https://docs.wxwidgets.org/3.2/classwx_file_picker_ctrl.html)'s methods and inheritance.
535///
536/// See [`FilePickerCtrlIsOwned`] documentation for the class usage.
537pub trait FilePickerCtrlMethods: PickerBaseMethods {
538 /// Creates this widget with the given parameters.
539 ///
540 /// See [C++ `wxFilePickerCtrl::Create()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_picker_ctrl.html#a8e643314daae74a584fc1b25ade9c5bd).
541 fn create_str<W: WindowMethods, P: PointMethods, S: SizeMethods, V: ValidatorMethods>(
542 &self,
543 parent: Option<&W>,
544 id: c_int,
545 path: &str,
546 message: &str,
547 wildcard: &str,
548 pos: &P,
549 size: &S,
550 style: c_long,
551 validator: &V,
552 name: &str,
553 ) -> bool {
554 unsafe {
555 let parent = match parent {
556 Some(r) => r.as_ptr(),
557 None => ptr::null_mut(),
558 };
559 let path = WxString::from(path);
560 let path = path.as_ptr();
561 let message = WxString::from(message);
562 let message = message.as_ptr();
563 let wildcard = WxString::from(wildcard);
564 let wildcard = wildcard.as_ptr();
565 let pos = pos.as_ptr();
566 let size = size.as_ptr();
567 let validator = validator.as_ptr();
568 let name = WxString::from(name);
569 let name = name.as_ptr();
570 ffi::wxFilePickerCtrl_Create(
571 self.as_ptr(),
572 parent,
573 id,
574 path,
575 message,
576 wildcard,
577 pos,
578 size,
579 style,
580 validator,
581 name,
582 )
583 }
584 }
585 /// Similar to GetPath() but returns the path of the currently selected file as a wxFileName object.
586 ///
587 /// See [C++ `wxFilePickerCtrl::GetFileName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_picker_ctrl.html#a252a2d16ef4de7649d77e013bf1a5f51).
588 fn get_file_name(&self) -> FileName {
589 unsafe { FileName::from_ptr(ffi::wxFilePickerCtrl_GetFileName(self.as_ptr())) }
590 }
591 /// Returns the absolute path of the currently selected file.
592 ///
593 /// See [C++ `wxFilePickerCtrl::GetPath()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_picker_ctrl.html#a38c4aa4c15e6b001aabebcb91f176a89).
594 fn get_path(&self) -> String {
595 unsafe { WxString::from_ptr(ffi::wxFilePickerCtrl_GetPath(self.as_ptr())).into() }
596 }
597 /// This method does the same thing as SetPath() but takes a wxFileName object instead of a string.
598 ///
599 /// See [C++ `wxFilePickerCtrl::SetFileName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_picker_ctrl.html#ae191b11ea4a93273b84aba880a97e122).
600 fn set_file_name<F: FileNameMethods>(&self, filename: &F) {
601 unsafe {
602 let filename = filename.as_ptr();
603 ffi::wxFilePickerCtrl_SetFileName(self.as_ptr(), filename)
604 }
605 }
606 /// Set the directory to show when starting to browse for files.
607 ///
608 /// See [C++ `wxFilePickerCtrl::SetInitialDirectory()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_picker_ctrl.html#ab36700ece10509deb7384f30ebf0baea).
609 fn set_initial_directory(&self, dir: &str) {
610 unsafe {
611 let dir = WxString::from(dir);
612 let dir = dir.as_ptr();
613 ffi::wxFilePickerCtrl_SetInitialDirectory(self.as_ptr(), dir)
614 }
615 }
616 /// Sets the absolute path of the currently selected file.
617 ///
618 /// See [C++ `wxFilePickerCtrl::SetPath()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_file_picker_ctrl.html#aa18c0c1598d60bc6ef526f7749c1e156).
619 fn set_path(&self, filename: &str) {
620 unsafe {
621 let filename = WxString::from(filename);
622 let filename = filename.as_ptr();
623 ffi::wxFilePickerCtrl_SetPath(self.as_ptr(), filename)
624 }
625 }
626}
627
628// wxFindDialogEvent
629/// This trait represents [C++ `wxFindDialogEvent` class](https://docs.wxwidgets.org/3.2/classwx_find_dialog_event.html)'s methods and inheritance.
630///
631/// See [`FindDialogEventIsOwned`] documentation for the class usage.
632pub trait FindDialogEventMethods: CommandEventMethods {
633 /// Return the pointer to the dialog which generated this event.
634 ///
635 /// See [C++ `wxFindDialogEvent::GetDialog()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_find_dialog_event.html#a95a25700a04a3459f587648875bfc98c).
636 fn get_dialog(&self) -> WeakRef<FindReplaceDialog> {
637 unsafe {
638 WeakRef::<FindReplaceDialog>::from(ffi::wxFindDialogEvent_GetDialog(self.as_ptr()))
639 }
640 }
641 /// Return the string to find (never empty).
642 ///
643 /// See [C++ `wxFindDialogEvent::GetFindString()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_find_dialog_event.html#a45c2ae8d7dd483e6e5a3503512aaabb1).
644 fn get_find_string(&self) -> String {
645 unsafe { WxString::from_ptr(ffi::wxFindDialogEvent_GetFindString(self.as_ptr())).into() }
646 }
647 /// Get the currently selected flags: this is the combination of the wxFindReplaceFlags enumeration values.
648 ///
649 /// See [C++ `wxFindDialogEvent::GetFlags()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_find_dialog_event.html#affe96aed3118b675aa372db502071022).
650 fn get_flags(&self) -> c_int {
651 unsafe { ffi::wxFindDialogEvent_GetFlags(self.as_ptr()) }
652 }
653 /// Return the string to replace the search string with (only for replace and replace all events).
654 ///
655 /// See [C++ `wxFindDialogEvent::GetReplaceString()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_find_dialog_event.html#a513ab8b8cfbb0f1eac38f4ef2f40c65d).
656 fn get_replace_string(&self) -> String {
657 unsafe { WxString::from_ptr(ffi::wxFindDialogEvent_GetReplaceString(self.as_ptr())).into() }
658 }
659}
660
661// wxFindReplaceData
662/// This trait represents [C++ `wxFindReplaceData` class](https://docs.wxwidgets.org/3.2/classwx_find_replace_data.html)'s methods and inheritance.
663///
664/// See [`FindReplaceDataIsOwned`] documentation for the class usage.
665pub trait FindReplaceDataMethods: ObjectMethods {
666 /// Get the string to find.
667 ///
668 /// See [C++ `wxFindReplaceData::GetFindString()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_find_replace_data.html#af47ad3d2d9a9af5bac9a05f0a0a13259).
669 fn get_find_string(&self) -> String {
670 unsafe { WxString::from_ptr(ffi::wxFindReplaceData_GetFindString(self.as_ptr())).into() }
671 }
672 /// Get the combination of wxFindReplaceFlags values.
673 ///
674 /// See [C++ `wxFindReplaceData::GetFlags()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_find_replace_data.html#a7699fbfe922095e879801fcdce59ad0e).
675 fn get_flags(&self) -> c_int {
676 unsafe { ffi::wxFindReplaceData_GetFlags(self.as_ptr()) }
677 }
678 /// Get the replacement string.
679 ///
680 /// See [C++ `wxFindReplaceData::GetReplaceString()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_find_replace_data.html#a6a71a17d3e59180e44a693df725800af).
681 fn get_replace_string(&self) -> String {
682 unsafe { WxString::from_ptr(ffi::wxFindReplaceData_GetReplaceString(self.as_ptr())).into() }
683 }
684 /// Set the string to find (used as initial value by the dialog).
685 ///
686 /// See [C++ `wxFindReplaceData::SetFindString()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_find_replace_data.html#ae8762e9353ddf76a6e1887b5f6b53d11).
687 fn set_find_string(&self, str: &str) {
688 unsafe {
689 let str = WxString::from(str);
690 let str = str.as_ptr();
691 ffi::wxFindReplaceData_SetFindString(self.as_ptr(), str)
692 }
693 }
694 // NOT_SUPPORTED: fn SetFlags()
695 /// Set the replacement string (used as initial value by the dialog).
696 ///
697 /// See [C++ `wxFindReplaceData::SetReplaceString()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_find_replace_data.html#ae9371cf3a1e68a288cd4508f67f2a8d9).
698 fn set_replace_string(&self, str: &str) {
699 unsafe {
700 let str = WxString::from(str);
701 let str = str.as_ptr();
702 ffi::wxFindReplaceData_SetReplaceString(self.as_ptr(), str)
703 }
704 }
705}
706
707// wxFindReplaceDialog
708/// This trait represents [C++ `wxFindReplaceDialog` class](https://docs.wxwidgets.org/3.2/classwx_find_replace_dialog.html)'s methods and inheritance.
709///
710/// See [`FindReplaceDialogIsOwned`] documentation for the class usage.
711pub trait FindReplaceDialogMethods: DialogMethods {
712 // DTOR: fn ~wxFindReplaceDialog()
713 /// Creates the dialog; use wxWindow::Show to show it on screen.
714 ///
715 /// See [C++ `wxFindReplaceDialog::Create()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_find_replace_dialog.html#aa2f0a45997f9f2380eae2e3e635d6c94).
716 fn create_findreplacedata<W: WindowMethods, F: FindReplaceDataMethods>(
717 &self,
718 parent: Option<&W>,
719 data: Option<&F>,
720 title: &str,
721 style: c_int,
722 ) -> bool {
723 unsafe {
724 let parent = match parent {
725 Some(r) => r.as_ptr(),
726 None => ptr::null_mut(),
727 };
728 let data = match data {
729 Some(r) => r.as_ptr(),
730 None => ptr::null_mut(),
731 };
732 let title = WxString::from(title);
733 let title = title.as_ptr();
734 ffi::wxFindReplaceDialog_Create(self.as_ptr(), parent, data, title, style)
735 }
736 }
737 /// Get the wxFindReplaceData object used by this dialog.
738 ///
739 /// See [C++ `wxFindReplaceDialog::GetData()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_find_replace_dialog.html#afa6c61f0e1b6af69cc6f2ec062440e68).
740 fn get_data(&self) -> Option<FindReplaceDataIsOwned<false>> {
741 unsafe { FindReplaceData::option_from(ffi::wxFindReplaceDialog_GetData(self.as_ptr())) }
742 }
743}
744
745// wxFlexGridSizer
746/// This trait represents [C++ `wxFlexGridSizer` class](https://docs.wxwidgets.org/3.2/classwx_flex_grid_sizer.html)'s methods and inheritance.
747///
748/// See [`FlexGridSizerIsOwned`] documentation for the class usage.
749pub trait FlexGridSizerMethods: GridSizerMethods {
750 /// Specifies that column idx (starting from zero) should be grown if there is extra space available to the sizer.
751 ///
752 /// See [C++ `wxFlexGridSizer::AddGrowableCol()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_flex_grid_sizer.html#a7d22045257180999e3705fbcd5585b6e).
753 fn add_growable_col(&self, idx: usize, proportion: c_int) {
754 unsafe { ffi::wxFlexGridSizer_AddGrowableCol(self.as_ptr(), idx, proportion) }
755 }
756 /// Specifies that row idx (starting from zero) should be grown if there is extra space available to the sizer.
757 ///
758 /// See [C++ `wxFlexGridSizer::AddGrowableRow()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_flex_grid_sizer.html#a7c91a92ad1e01aac56222d36c4342d00).
759 fn add_growable_row(&self, idx: usize, proportion: c_int) {
760 unsafe { ffi::wxFlexGridSizer_AddGrowableRow(self.as_ptr(), idx, proportion) }
761 }
762 /// Returns a wxOrientation value that specifies whether the sizer flexibly resizes its columns, rows, or both (default).
763 ///
764 /// See [C++ `wxFlexGridSizer::GetFlexibleDirection()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_flex_grid_sizer.html#a27b2da0ec57edc710bc0ad5c7d4d04d5).
765 fn get_flexible_direction(&self) -> c_int {
766 unsafe { ffi::wxFlexGridSizer_GetFlexibleDirection(self.as_ptr()) }
767 }
768 // NOT_SUPPORTED: fn GetNonFlexibleGrowMode()
769 /// Returns true if column idx is growable.
770 ///
771 /// See [C++ `wxFlexGridSizer::IsColGrowable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_flex_grid_sizer.html#a04d611af7165db02e9971f9b19fad799).
772 fn is_col_growable(&self, idx: usize) -> bool {
773 unsafe { ffi::wxFlexGridSizer_IsColGrowable(self.as_ptr(), idx) }
774 }
775 /// Returns true if row idx is growable.
776 ///
777 /// See [C++ `wxFlexGridSizer::IsRowGrowable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_flex_grid_sizer.html#a80e787496ee23a9dd5801f06d1dda55b).
778 fn is_row_growable(&self, idx: usize) -> bool {
779 unsafe { ffi::wxFlexGridSizer_IsRowGrowable(self.as_ptr(), idx) }
780 }
781 /// Specifies that the idx column index is no longer growable.
782 ///
783 /// See [C++ `wxFlexGridSizer::RemoveGrowableCol()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_flex_grid_sizer.html#aa25bb73aba1e3bba89ab65854692026b).
784 fn remove_growable_col(&self, idx: usize) {
785 unsafe { ffi::wxFlexGridSizer_RemoveGrowableCol(self.as_ptr(), idx) }
786 }
787 /// Specifies that the idx row index is no longer growable.
788 ///
789 /// See [C++ `wxFlexGridSizer::RemoveGrowableRow()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_flex_grid_sizer.html#a8247a1ee496f60efe4e56b6460ed5ec8).
790 fn remove_growable_row(&self, idx: usize) {
791 unsafe { ffi::wxFlexGridSizer_RemoveGrowableRow(self.as_ptr(), idx) }
792 }
793 /// Specifies whether the sizer should flexibly resize its columns, rows, or both.
794 ///
795 /// See [C++ `wxFlexGridSizer::SetFlexibleDirection()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_flex_grid_sizer.html#a5c206d868699abb1e550cdbaa6cb19bc).
796 fn set_flexible_direction(&self, direction: c_int) {
797 unsafe { ffi::wxFlexGridSizer_SetFlexibleDirection(self.as_ptr(), direction) }
798 }
799 // NOT_SUPPORTED: fn SetNonFlexibleGrowMode()
800 /// Returns a read-only array containing the heights of the rows in the sizer.
801 ///
802 /// See [C++ `wxFlexGridSizer::GetRowHeights()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_flex_grid_sizer.html#a6552b94de617ab2c022e2b9758c6e4f4).
803 fn get_row_heights(&self) -> ArrayIntIsOwned<false> {
804 unsafe { ArrayIntIsOwned::from_ptr(ffi::wxFlexGridSizer_GetRowHeights(self.as_ptr())) }
805 }
806 /// Returns a read-only array containing the widths of the columns in the sizer.
807 ///
808 /// See [C++ `wxFlexGridSizer::GetColWidths()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_flex_grid_sizer.html#a719895a5bc97030744fdeed198ab6507).
809 fn get_col_widths(&self) -> ArrayIntIsOwned<false> {
810 unsafe { ArrayIntIsOwned::from_ptr(ffi::wxFlexGridSizer_GetColWidths(self.as_ptr())) }
811 }
812}
813
814// wxFocusEvent
815/// This trait represents [C++ `wxFocusEvent` class](https://docs.wxwidgets.org/3.2/classwx_focus_event.html)'s methods and inheritance.
816///
817/// See [`FocusEventIsOwned`] documentation for the class usage.
818pub trait FocusEventMethods: EventMethods {
819 /// Returns the window associated with this event, that is the window which had the focus before for the wxEVT_SET_FOCUS event and the window which is going to receive focus for the wxEVT_KILL_FOCUS one.
820 ///
821 /// See [C++ `wxFocusEvent::GetWindow()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_focus_event.html#a395fb0d49e650fc1900be64cfafedc7c).
822 fn get_window(&self) -> WeakRef<Window> {
823 unsafe { WeakRef::<Window>::from(ffi::wxFocusEvent_GetWindow(self.as_ptr())) }
824 }
825 ///
826 /// See [C++ `wxFocusEvent::SetWindow()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_focus_event.html#a0761d1e6d4d6e987ad4e2a8ee9e63f32).
827 fn set_window<W: WindowMethods>(&self, win: Option<&W>) {
828 unsafe {
829 let win = match win {
830 Some(r) => r.as_ptr(),
831 None => ptr::null_mut(),
832 };
833 ffi::wxFocusEvent_SetWindow(self.as_ptr(), win)
834 }
835 }
836}
837
838// wxFont
839/// This trait represents [C++ `wxFont` class](https://docs.wxwidgets.org/3.2/classwx_font.html)'s methods and inheritance.
840///
841/// See [`FontIsOwned`] documentation for the class usage.
842pub trait FontMethods: GDIObjectMethods {
843 /// Returns a font with the same face/size as the given one but with normal weight and style and not underlined nor stricken through.
844 ///
845 /// See [C++ `wxFont::GetBaseFont()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#acdf46cdb37733a76e8a5024331095df9).
846 fn get_base_font(&self) -> Font {
847 unsafe { Font::from_ptr(ffi::wxFont_GetBaseFont(self.as_ptr())) }
848 }
849 // NOT_SUPPORTED: fn GetEncoding()
850 /// Returns the face name associated with the font, or the empty string if there is no face information.
851 ///
852 /// See [C++ `wxFont::GetFaceName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a589ad627e9594e5dfeabdd5c063dc01d).
853 fn get_face_name(&self) -> String {
854 unsafe { WxString::from_ptr(ffi::wxFont_GetFaceName(self.as_ptr())).into() }
855 }
856 // NOT_SUPPORTED: fn GetFamily()
857 /// Returns the platform-dependent string completely describing this font.
858 ///
859 /// See [C++ `wxFont::GetNativeFontInfoDesc()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a0668df773eaf781cd9979ec6707efe4e).
860 fn get_native_font_info_desc(&self) -> String {
861 unsafe { WxString::from_ptr(ffi::wxFont_GetNativeFontInfoDesc(self.as_ptr())).into() }
862 }
863 /// Returns a user-friendly string for this font object.
864 ///
865 /// See [C++ `wxFont::GetNativeFontInfoUserDesc()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a52abf8643ff20cbc7364de2a59cadf0c).
866 fn get_native_font_info_user_desc(&self) -> String {
867 unsafe { WxString::from_ptr(ffi::wxFont_GetNativeFontInfoUserDesc(self.as_ptr())).into() }
868 }
869 /// Returns a font with the same face/size as the given one but with normal weight and style and not underlined nor stricken through.
870 ///
871 /// See [C++ `wxFont::GetNativeFontInfo()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a4141a77677772ea283c1ce737695c77d).
872 fn get_native_font_info(&self) -> Option<NativeFontInfoIsOwned<false>> {
873 unsafe { NativeFontInfo::option_from(ffi::wxFont_GetNativeFontInfo(self.as_ptr())) }
874 }
875 /// Gets the point size as an integer number.
876 ///
877 /// See [C++ `wxFont::GetPointSize()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a0bb323d97e6628d1caffe4bd4f472623).
878 fn get_point_size(&self) -> c_int {
879 unsafe { ffi::wxFont_GetPointSize(self.as_ptr()) }
880 }
881 /// Gets the point size as a floating number.
882 ///
883 /// See [C++ `wxFont::GetFractionalPointSize()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a796687d506688f24128559423da7ac5a).
884 fn get_fractional_point_size(&self) -> c_double {
885 unsafe { ffi::wxFont_GetFractionalPointSize(self.as_ptr()) }
886 }
887 /// Gets the pixel size.
888 ///
889 /// See [C++ `wxFont::GetPixelSize()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a5c052abc341453c2ef1002c61df383b9).
890 fn get_pixel_size(&self) -> Size {
891 unsafe { Size::from_ptr(ffi::wxFont_GetPixelSize(self.as_ptr())) }
892 }
893 // NOT_SUPPORTED: fn GetStyle()
894 /// Returns true if the font is underlined, false otherwise.
895 ///
896 /// See [C++ `wxFont::GetUnderlined()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#aa12d8be740d3bff6001e578aa0c97349).
897 fn get_underlined(&self) -> bool {
898 unsafe { ffi::wxFont_GetUnderlined(self.as_ptr()) }
899 }
900 /// Returns true if the font is stricken-through, false otherwise.
901 ///
902 /// See [C++ `wxFont::GetStrikethrough()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#aa11f9f946a14876d0736545e33c43645).
903 fn get_strikethrough(&self) -> bool {
904 unsafe { ffi::wxFont_GetStrikethrough(self.as_ptr()) }
905 }
906 // NOT_SUPPORTED: fn GetWeight()
907 /// Gets the font weight as an integer value.
908 ///
909 /// See [C++ `wxFont::GetNumericWeight()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a38a79006439e19d247fb680745f3cc7c).
910 fn get_numeric_weight(&self) -> c_int {
911 unsafe { ffi::wxFont_GetNumericWeight(self.as_ptr()) }
912 }
913 /// Returns true if the font is a fixed width (or monospaced) font, false if it is a proportional one or font is invalid.
914 ///
915 /// See [C++ `wxFont::IsFixedWidth()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#adb4f2ad5f09f178b76f0822574500c39).
916 fn is_fixed_width(&self) -> bool {
917 unsafe { ffi::wxFont_IsFixedWidth(self.as_ptr()) }
918 }
919 /// Returns true if this object is a valid font, false otherwise.
920 ///
921 /// See [C++ `wxFont::IsOk()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#aa5a818ce69a9867f9ca05bdf57b7badf).
922 fn is_ok(&self) -> bool {
923 unsafe { ffi::wxFont_IsOk(self.as_ptr()) }
924 }
925 /// Specify the name of a file containing a TrueType font to be made available to the current application.
926 ///
927 /// See [C++ `wxFont::AddPrivateFont()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#ab96266bba385bc770a40ec4c7d1ec620).
928 fn add_private_font(filename: &str) -> bool {
929 unsafe {
930 let filename = WxString::from(filename);
931 let filename = filename.as_ptr();
932 ffi::wxFont_AddPrivateFont(filename)
933 }
934 }
935 /// Returns a bold version of this font.
936 ///
937 /// See [C++ `wxFont::Bold()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#ad7b49b796335499ce86dffa8d02e30c1).
938 fn bold(&self) -> Font {
939 unsafe { Font::from_ptr(ffi::wxFont_Bold(self.as_ptr())) }
940 }
941 /// Returns an italic version of this font.
942 ///
943 /// See [C++ `wxFont::Italic()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a986c623afc3441b32c4fff892cb6a7ed).
944 fn italic(&self) -> Font {
945 unsafe { Font::from_ptr(ffi::wxFont_Italic(self.as_ptr())) }
946 }
947 /// Returns a larger version of this font.
948 ///
949 /// See [C++ `wxFont::Larger()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a5ae0c8f11dd3b78b84be30f4aadb1c68).
950 fn larger(&self) -> Font {
951 unsafe { Font::from_ptr(ffi::wxFont_Larger(self.as_ptr())) }
952 }
953 /// Returns a smaller version of this font.
954 ///
955 /// See [C++ `wxFont::Smaller()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#acfeb26bc0fe1bce3d21c0a06daef1625).
956 fn smaller(&self) -> Font {
957 unsafe { Font::from_ptr(ffi::wxFont_Smaller(self.as_ptr())) }
958 }
959 /// Returns underlined version of this font.
960 ///
961 /// See [C++ `wxFont::Underlined()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a662846a3dfb53bc7d4f97ffe9b0b3897).
962 fn underlined(&self) -> Font {
963 unsafe { Font::from_ptr(ffi::wxFont_Underlined(self.as_ptr())) }
964 }
965 /// Returns stricken-through version of this font.
966 ///
967 /// See [C++ `wxFont::Strikethrough()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#af8b9ec6118e82bfa11ef43028d834512).
968 fn strikethrough(&self) -> Font {
969 unsafe { Font::from_ptr(ffi::wxFont_Strikethrough(self.as_ptr())) }
970 }
971 /// Changes this font to be bold.
972 ///
973 /// See [C++ `wxFont::MakeBold()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a80a2a8ee3d458e5e76179bc52dbd6bad).
974 fn make_bold(&self) -> &Self {
975 unsafe {
976 ffi::wxFont_MakeBold(self.as_ptr());
977 &self
978 }
979 }
980 /// Changes this font to be italic.
981 ///
982 /// See [C++ `wxFont::MakeItalic()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#afa489cd41ca406afdfa4ba42aa6c7458).
983 fn make_italic(&self) -> &Self {
984 unsafe {
985 ffi::wxFont_MakeItalic(self.as_ptr());
986 &self
987 }
988 }
989 /// Changes this font to be larger.
990 ///
991 /// See [C++ `wxFont::MakeLarger()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a2aad6f665ebc3a97419758fb372e3511).
992 fn make_larger(&self) -> &Self {
993 unsafe {
994 ffi::wxFont_MakeLarger(self.as_ptr());
995 &self
996 }
997 }
998 /// Changes this font to be smaller.
999 ///
1000 /// See [C++ `wxFont::MakeSmaller()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a181bba83280f4e898c69a273ba9c4055).
1001 fn make_smaller(&self) -> &Self {
1002 unsafe {
1003 ffi::wxFont_MakeSmaller(self.as_ptr());
1004 &self
1005 }
1006 }
1007 /// Changes this font to be underlined.
1008 ///
1009 /// See [C++ `wxFont::MakeUnderlined()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a8d41bd009bf9f630d8efa312ccfdc388).
1010 fn make_underlined(&self) -> &Self {
1011 unsafe {
1012 ffi::wxFont_MakeUnderlined(self.as_ptr());
1013 &self
1014 }
1015 }
1016 /// Changes this font to be stricken-through.
1017 ///
1018 /// See [C++ `wxFont::MakeStrikethrough()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#ad0fc68e7e9af9221f5be84d0beb8edaa).
1019 fn make_strikethrough(&self) -> &Self {
1020 unsafe {
1021 ffi::wxFont_MakeStrikethrough(self.as_ptr());
1022 &self
1023 }
1024 }
1025 // NOT_SUPPORTED: fn Scale()
1026 // NOT_SUPPORTED: fn Scaled()
1027 // NOT_SUPPORTED: fn SetEncoding()
1028 /// Sets the facename for the font.
1029 ///
1030 /// See [C++ `wxFont::SetFaceName()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a97456a61332a1b6d44a76f0b57b01709).
1031 fn set_face_name(&self, face_name: &str) -> bool {
1032 unsafe {
1033 let face_name = WxString::from(face_name);
1034 let face_name = face_name.as_ptr();
1035 ffi::wxFont_SetFaceName(self.as_ptr(), face_name)
1036 }
1037 }
1038 // NOT_SUPPORTED: fn SetFamily()
1039 /// Creates the font corresponding to the given native font description string which must have been previously returned by GetNativeFontInfoDesc().
1040 ///
1041 /// See [C++ `wxFont::SetNativeFontInfo()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#aaef8dc8fc6c8b81246af000a201b52c5).
1042 fn set_native_font_info_str(&self, info: &str) -> bool {
1043 unsafe {
1044 let info = WxString::from(info);
1045 let info = info.as_ptr();
1046 ffi::wxFont_SetNativeFontInfo(self.as_ptr(), info)
1047 }
1048 }
1049 /// Creates the font corresponding to the given native font description string and returns true if the creation was successful.
1050 ///
1051 /// See [C++ `wxFont::SetNativeFontInfoUserDesc()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#afa8eb67298aea006e3a262bd7b0c8493).
1052 fn set_native_font_info_user_desc(&self, info: &str) -> bool {
1053 unsafe {
1054 let info = WxString::from(info);
1055 let info = info.as_ptr();
1056 ffi::wxFont_SetNativeFontInfoUserDesc(self.as_ptr(), info)
1057 }
1058 }
1059 /// Sets the encoding for this font.
1060 ///
1061 /// See [C++ `wxFont::SetNativeFontInfo()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a31bb8005da8e4172a0f8e3fecc04efef).
1062 fn set_native_font_info_nativefontinfo<N: NativeFontInfoMethods>(&self, info: &N) {
1063 unsafe {
1064 let info = info.as_ptr();
1065 ffi::wxFont_SetNativeFontInfo1(self.as_ptr(), info)
1066 }
1067 }
1068 /// Sets the font size in points to an integer value.
1069 ///
1070 /// See [C++ `wxFont::SetPointSize()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a32d54af99749f180991c4cdab9f9a7dd).
1071 fn set_point_size(&self, point_size: c_int) {
1072 unsafe { ffi::wxFont_SetPointSize(self.as_ptr(), point_size) }
1073 }
1074 /// Sets the font size in points.
1075 ///
1076 /// See [C++ `wxFont::SetFractionalPointSize()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#aee03b736fa49851362444b74794c2c60).
1077 fn set_fractional_point_size(&self, point_size: c_double) {
1078 unsafe { ffi::wxFont_SetFractionalPointSize(self.as_ptr(), point_size) }
1079 }
1080 /// Sets the pixel size.
1081 ///
1082 /// See [C++ `wxFont::SetPixelSize()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a94f364735647de9ddd065dfa992ad4e4).
1083 fn set_pixel_size<S: SizeMethods>(&self, pixel_size: &S) {
1084 unsafe {
1085 let pixel_size = pixel_size.as_ptr();
1086 ffi::wxFont_SetPixelSize(self.as_ptr(), pixel_size)
1087 }
1088 }
1089 // NOT_SUPPORTED: fn SetStyle()
1090 // NOT_SUPPORTED: fn SetSymbolicSize()
1091 // NOT_SUPPORTED: fn SetSymbolicSizeRelativeTo()
1092 /// Sets underlining.
1093 ///
1094 /// See [C++ `wxFont::SetUnderlined()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a2a8a3a71090bfa4ed957dfd1ffcc524c).
1095 fn set_underlined(&self, underlined: bool) {
1096 unsafe { ffi::wxFont_SetUnderlined(self.as_ptr(), underlined) }
1097 }
1098 /// Sets strike-through attribute of the font.
1099 ///
1100 /// See [C++ `wxFont::SetStrikethrough()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a074f14f7bea2d493d7ec14a65f76a3b7).
1101 fn set_strikethrough(&self, strikethrough: bool) {
1102 unsafe { ffi::wxFont_SetStrikethrough(self.as_ptr(), strikethrough) }
1103 }
1104 // NOT_SUPPORTED: fn SetWeight()
1105 /// Sets the font weight using an integer value.
1106 ///
1107 /// See [C++ `wxFont::SetNumericWeight()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#ad527c7be417f4a1d4789ad0f60ceaec0).
1108 fn set_numeric_weight(&self, weight: c_int) {
1109 unsafe { ffi::wxFont_SetNumericWeight(self.as_ptr(), weight) }
1110 }
1111 // BLOCKED: fn operator!=()
1112 // BLOCKED: fn operator==()
1113 // BLOCKED: fn operator=()
1114 // NOT_SUPPORTED: fn GetDefaultEncoding()
1115 // NOT_SUPPORTED: fn SetDefaultEncoding()
1116 // NOT_SUPPORTED: fn GetNumericWeightOf()
1117 // NOT_SUPPORTED: fn New()
1118 // NOT_SUPPORTED: fn New1()
1119 // NOT_SUPPORTED: fn New2()
1120 // NOT_SUPPORTED: fn New3()
1121 /// Sets the encoding for this font.
1122 ///
1123 /// See [C++ `wxFont::New()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a554845d97040706a2c3407dd968e9f62).
1124 fn new_nativefontinfo<N: NativeFontInfoMethods>(native_info: &N) -> Option<FontIsOwned<false>> {
1125 unsafe {
1126 let native_info = native_info.as_ptr();
1127 Font::option_from(ffi::wxFont_New4(native_info))
1128 }
1129 }
1130 /// Sets the encoding for this font.
1131 ///
1132 /// See [C++ `wxFont::New()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font.html#a6cfbe4bb51490bec78637204d3f18edd).
1133 fn new_str(native_info_string: &str) -> Option<FontIsOwned<false>> {
1134 unsafe {
1135 let native_info_string = WxString::from(native_info_string);
1136 let native_info_string = native_info_string.as_ptr();
1137 Font::option_from(ffi::wxFont_New5(native_info_string))
1138 }
1139 }
1140 // DTOR: fn ~wxFont()
1141}
1142
1143// wxFontData
1144/// This trait represents [C++ `wxFontData` class](https://docs.wxwidgets.org/3.2/classwx_font_data.html)'s methods and inheritance.
1145///
1146/// See [`FontDataIsOwned`] documentation for the class usage.
1147pub trait FontDataMethods: ObjectMethods {
1148 /// Enables or disables "effects" under Windows or generic only.
1149 ///
1150 /// See [C++ `wxFontData::EnableEffects()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#a5d2430c6959bea4a023a87c0e606c31a).
1151 fn enable_effects(&self, enable: bool) {
1152 unsafe { ffi::wxFontData_EnableEffects(self.as_ptr(), enable) }
1153 }
1154 /// Under Windows, returns a flag determining whether symbol fonts can be selected.
1155 ///
1156 /// See [C++ `wxFontData::GetAllowSymbols()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#a0804c60917cf51d289f004838a8fc0ef).
1157 fn get_allow_symbols(&self) -> bool {
1158 unsafe { ffi::wxFontData_GetAllowSymbols(self.as_ptr()) }
1159 }
1160 /// Gets the font chosen by the user if the user pressed OK (wxFontDialog::ShowModal() returned wxID_OK).
1161 ///
1162 /// See [C++ `wxFontData::GetChosenFont()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#a066dead81cc01854df744ba711ac606e).
1163 fn get_chosen_font(&self) -> Font {
1164 unsafe { Font::from_ptr(ffi::wxFontData_GetChosenFont(self.as_ptr())) }
1165 }
1166 /// Gets the colour associated with the font dialog.
1167 ///
1168 /// See [C++ `wxFontData::GetColour()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#ab64b3bc54a2c518d2124f93197646ff8).
1169 fn get_colour(&self) -> ColourIsOwned<false> {
1170 unsafe { ColourIsOwned::from_ptr(ffi::wxFontData_GetColour(self.as_ptr())) }
1171 }
1172 /// Determines whether "effects" are enabled under Windows.
1173 ///
1174 /// See [C++ `wxFontData::GetEnableEffects()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#a3a5598ba073c197a65e8ca6f29a3a528).
1175 fn get_enable_effects(&self) -> bool {
1176 unsafe { ffi::wxFontData_GetEnableEffects(self.as_ptr()) }
1177 }
1178 /// Returns the state of the flags restricting the selection.
1179 ///
1180 /// See [C++ `wxFontData::GetRestrictSelection()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#a74416a26717eb9e8ea8e461c88047e65).
1181 fn get_restrict_selection(&self) -> c_int {
1182 unsafe { ffi::wxFontData_GetRestrictSelection(self.as_ptr()) }
1183 }
1184 /// Gets the font that will be initially used by the font dialog.
1185 ///
1186 /// See [C++ `wxFontData::GetInitialFont()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#a92124db2663fba43472ea374182ee664).
1187 fn get_initial_font(&self) -> Font {
1188 unsafe { Font::from_ptr(ffi::wxFontData_GetInitialFont(self.as_ptr())) }
1189 }
1190 /// Returns true if the Help button will be shown (Windows only).
1191 ///
1192 /// See [C++ `wxFontData::GetShowHelp()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#aa5fc469cbbc12ab6d61588a617b66f4a).
1193 fn get_show_help(&self) -> bool {
1194 unsafe { ffi::wxFontData_GetShowHelp(self.as_ptr()) }
1195 }
1196 /// Restricts the selection to a subset of the available fonts.
1197 ///
1198 /// See [C++ `wxFontData::RestrictSelection()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#a2cdfe592ee6b3ba9dced7bc4e08fc0be).
1199 fn restrict_selection(&self, flags: c_int) {
1200 unsafe { ffi::wxFontData_RestrictSelection(self.as_ptr(), flags) }
1201 }
1202 /// Under Windows, determines whether symbol fonts can be selected.
1203 ///
1204 /// See [C++ `wxFontData::SetAllowSymbols()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#a0bd2d264044fcf568c1d731e9d19c32c).
1205 fn set_allow_symbols(&self, allow_symbols: bool) {
1206 unsafe { ffi::wxFontData_SetAllowSymbols(self.as_ptr(), allow_symbols) }
1207 }
1208 /// Sets the font that will be returned to the user (for internal use only).
1209 ///
1210 /// See [C++ `wxFontData::SetChosenFont()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#a316d4574ef7100e4e5f3e12bff7d98dc).
1211 fn set_chosen_font<F: FontMethods>(&self, font: &F) {
1212 unsafe {
1213 let font = font.as_ptr();
1214 ffi::wxFontData_SetChosenFont(self.as_ptr(), font)
1215 }
1216 }
1217 /// Sets the colour that will be used for the font foreground colour.
1218 ///
1219 /// See [C++ `wxFontData::SetColour()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#a52e4308bf17d933b5b2948f6eb469608).
1220 fn set_colour<C: ColourMethods>(&self, colour: &C) {
1221 unsafe {
1222 let colour = colour.as_ptr();
1223 ffi::wxFontData_SetColour(self.as_ptr(), colour)
1224 }
1225 }
1226 /// Sets the font that will be initially used by the font dialog.
1227 ///
1228 /// See [C++ `wxFontData::SetInitialFont()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#a24fd79c0a3eb6764cc7d525acba9aaeb).
1229 fn set_initial_font<F: FontMethods>(&self, font: &F) {
1230 unsafe {
1231 let font = font.as_ptr();
1232 ffi::wxFontData_SetInitialFont(self.as_ptr(), font)
1233 }
1234 }
1235 /// Sets the valid range for the font point size (Windows only).
1236 ///
1237 /// See [C++ `wxFontData::SetRange()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#ac3d2f78a59cd50d5e3a045775a83fff5).
1238 fn set_range(&self, min: c_int, max: c_int) {
1239 unsafe { ffi::wxFontData_SetRange(self.as_ptr(), min, max) }
1240 }
1241 /// Determines whether the Help button will be displayed in the font dialog (Windows only).
1242 ///
1243 /// See [C++ `wxFontData::SetShowHelp()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_data.html#ad203acb97b8278907994f254f96f63ce).
1244 fn set_show_help(&self, show_help: bool) {
1245 unsafe { ffi::wxFontData_SetShowHelp(self.as_ptr(), show_help) }
1246 }
1247 // BLOCKED: fn operator=()
1248}
1249
1250// wxFontDialog
1251/// This trait represents [C++ `wxFontDialog` class](https://docs.wxwidgets.org/3.2/classwx_font_dialog.html)'s methods and inheritance.
1252///
1253/// See [`FontDialogIsOwned`] documentation for the class usage.
1254pub trait FontDialogMethods: DialogMethods {
1255 /// Creates the dialog if the wxFontDialog object had been initialized using the default constructor.
1256 ///
1257 /// See [C++ `wxFontDialog::Create()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_dialog.html#aa03d1bdc247fee02c20360373a4bb228).
1258 fn create<W: WindowMethods>(&self, parent: Option<&W>) -> bool {
1259 unsafe {
1260 let parent = match parent {
1261 Some(r) => r.as_ptr(),
1262 None => ptr::null_mut(),
1263 };
1264 ffi::wxFontDialog_Create(self.as_ptr(), parent)
1265 }
1266 }
1267 /// Creates the dialog if the wxFontDialog object had been initialized using the default constructor.
1268 ///
1269 /// See [C++ `wxFontDialog::Create()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_dialog.html#a3d1125778e41dea1ea2dd357f74c2749).
1270 fn create_fontdata<W: WindowMethods, F: FontDataMethods>(
1271 &self,
1272 parent: Option<&W>,
1273 data: &F,
1274 ) -> bool {
1275 unsafe {
1276 let parent = match parent {
1277 Some(r) => r.as_ptr(),
1278 None => ptr::null_mut(),
1279 };
1280 let data = data.as_ptr();
1281 ffi::wxFontDialog_Create1(self.as_ptr(), parent, data)
1282 }
1283 }
1284 // BLOCKED: fn GetFontData()
1285 ///
1286 /// See [C++ `wxFontDialog::GetFontData()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_dialog.html#a5c0f427480a66edca8bef13eccd67b2c).
1287 fn get_font_data(&self) -> FontDataIsOwned<false> {
1288 unsafe { FontDataIsOwned::from_ptr(ffi::wxFontDialog_GetFontData1(self.as_ptr())) }
1289 }
1290}
1291
1292// wxFontEnumerator
1293/// This trait represents [C++ `wxFontEnumerator` class](https://docs.wxwidgets.org/3.2/classwx_font_enumerator.html)'s methods and inheritance.
1294///
1295/// See [`FontEnumeratorIsOwned`] documentation for the class usage.
1296pub trait FontEnumeratorMethods: WxRustMethods {
1297 // DTOR: fn ~wxFontEnumerator()
1298 /// Call OnFontEncoding() for each encoding supported by the given font - or for each encoding supported by at least some font if font is not specified.
1299 ///
1300 /// See [C++ `wxFontEnumerator::EnumerateEncodings()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_enumerator.html#a38dfb993bdb5ba19359679eb37f4296b).
1301 fn enumerate_encodings(&self, font: &str) -> bool {
1302 unsafe {
1303 let font = WxString::from(font);
1304 let font = font.as_ptr();
1305 ffi::wxFontEnumerator_EnumerateEncodings(self.as_ptr(), font)
1306 }
1307 }
1308 // NOT_SUPPORTED: fn EnumerateFacenames()
1309 /// Called by EnumerateFacenames() for each match.
1310 ///
1311 /// See [C++ `wxFontEnumerator::OnFacename()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_enumerator.html#ad9566d37c45e857c7e885f6d23a66848).
1312 fn on_facename(&self, font: &str) -> bool {
1313 unsafe {
1314 let font = WxString::from(font);
1315 let font = font.as_ptr();
1316 ffi::wxFontEnumerator_OnFacename(self.as_ptr(), font)
1317 }
1318 }
1319 /// Called by EnumerateEncodings() for each match.
1320 ///
1321 /// See [C++ `wxFontEnumerator::OnFontEncoding()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_enumerator.html#a5a100fb6f9cf812d0982ab83a0c07644).
1322 fn on_font_encoding(&self, font: &str, encoding: &str) -> bool {
1323 unsafe {
1324 let font = WxString::from(font);
1325 let font = font.as_ptr();
1326 let encoding = WxString::from(encoding);
1327 let encoding = encoding.as_ptr();
1328 ffi::wxFontEnumerator_OnFontEncoding(self.as_ptr(), font, encoding)
1329 }
1330 }
1331 /// Return array of strings containing all encodings found by EnumerateEncodings().
1332 ///
1333 /// See [C++ `wxFontEnumerator::GetEncodings()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_enumerator.html#a66503923926dbdc9bcf050fe3e15af06).
1334 fn get_encodings(facename: &str) -> ArrayString {
1335 unsafe {
1336 let facename = WxString::from(facename);
1337 let facename = facename.as_ptr();
1338 ArrayString::from_ptr(ffi::wxFontEnumerator_GetEncodings(facename))
1339 }
1340 }
1341 // NOT_SUPPORTED: fn GetFacenames()
1342 /// Returns true if the given string is valid face name, i.e.
1343 ///
1344 /// See [C++ `wxFontEnumerator::IsValidFacename()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_enumerator.html#a8e11919b1a3bbbd662ba6087c7bc9943).
1345 fn is_valid_facename(facename: &str) -> bool {
1346 unsafe {
1347 let facename = WxString::from(facename);
1348 let facename = facename.as_ptr();
1349 ffi::wxFontEnumerator_IsValidFacename(facename)
1350 }
1351 }
1352 /// Invalidate cache used by some of the methods of this class internally.
1353 ///
1354 /// See [C++ `wxFontEnumerator::InvalidateCache()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_enumerator.html#aad3227af9b6479ae40b833d255622d2f).
1355 fn invalidate_cache() {
1356 unsafe { ffi::wxFontEnumerator_InvalidateCache() }
1357 }
1358}
1359
1360// wxFontList
1361/// This trait represents [C++ `wxFontList` class](https://docs.wxwidgets.org/3.2/classwx_font_list.html)'s methods and inheritance.
1362///
1363/// See [`FontListIsOwned`] documentation for the class usage.
1364pub trait FontListMethods: WxRustMethods {
1365 // NOT_SUPPORTED: fn FindOrCreateFont()
1366 /// Finds a font of the given specification, or creates one and adds it to the list.
1367 ///
1368 /// See [C++ `wxFontList::FindOrCreateFont()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_list.html#a13af1bba1c223887cefc59544a91cbcc).
1369 fn find_or_create_font(&self, font_info: *const c_void) -> Option<FontIsOwned<false>> {
1370 unsafe { Font::option_from(ffi::wxFontList_FindOrCreateFont1(self.as_ptr(), font_info)) }
1371 }
1372}
1373
1374// wxFontMapper
1375/// This trait represents [C++ `wxFontMapper` class](https://docs.wxwidgets.org/3.2/classwx_font_mapper.html)'s methods and inheritance.
1376///
1377/// See [`FontMapperIsOwned`] documentation for the class usage.
1378pub trait FontMapperMethods: WxRustMethods {
1379 // DTOR: fn ~wxFontMapper()
1380 // NOT_SUPPORTED: fn CharsetToEncoding()
1381 // NOT_SUPPORTED: fn GetAltForEncoding()
1382 // NOT_SUPPORTED: fn GetAltForEncoding1()
1383 // NOT_SUPPORTED: fn IsEncodingAvailable()
1384 /// Set the root config path to use (should be an absolute path).
1385 ///
1386 /// See [C++ `wxFontMapper::SetConfigPath()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_mapper.html#a5999b3950e0a78e3e8890d96abe37a97).
1387 fn set_config_path(&self, prefix: &str) {
1388 unsafe {
1389 let prefix = WxString::from(prefix);
1390 let prefix = prefix.as_ptr();
1391 ffi::wxFontMapper_SetConfigPath(self.as_ptr(), prefix)
1392 }
1393 }
1394 /// The parent window for modal dialogs.
1395 ///
1396 /// See [C++ `wxFontMapper::SetDialogParent()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_mapper.html#a2fc0db252f9a52356f1484c684c6f8b0).
1397 fn set_dialog_parent<W: WindowMethods>(&self, parent: Option<&W>) {
1398 unsafe {
1399 let parent = match parent {
1400 Some(r) => r.as_ptr(),
1401 None => ptr::null_mut(),
1402 };
1403 ffi::wxFontMapper_SetDialogParent(self.as_ptr(), parent)
1404 }
1405 }
1406 /// The title for the dialogs (note that default is quite reasonable).
1407 ///
1408 /// See [C++ `wxFontMapper::SetDialogTitle()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_mapper.html#a7459de236727f25d40a57414f10850c1).
1409 fn set_dialog_title(&self, title: &str) {
1410 unsafe {
1411 let title = WxString::from(title);
1412 let title = title.as_ptr();
1413 ffi::wxFontMapper_SetDialogTitle(self.as_ptr(), title)
1414 }
1415 }
1416 /// Get the current font mapper object.
1417 ///
1418 /// See [C++ `wxFontMapper::Get()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_mapper.html#ae0718e57b4e91c1b2f38cac352c0a9d5).
1419 fn get() -> Option<FontMapperIsOwned<false>> {
1420 unsafe { FontMapper::option_from(ffi::wxFontMapper_Get()) }
1421 }
1422 // NOT_SUPPORTED: fn GetAllEncodingNames()
1423 // NOT_SUPPORTED: fn GetEncoding()
1424 // NOT_SUPPORTED: fn GetEncodingDescription()
1425 // NOT_SUPPORTED: fn GetEncodingFromName()
1426 // NOT_SUPPORTED: fn GetEncodingName()
1427 /// Returns the number of the font encodings supported by this class.
1428 ///
1429 /// See [C++ `wxFontMapper::GetSupportedEncodingsCount()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_mapper.html#a49c41e77de4bb68d8ceb2c22d182a819).
1430 fn get_supported_encodings_count() -> usize {
1431 unsafe { ffi::wxFontMapper_GetSupportedEncodingsCount() }
1432 }
1433 /// Set the current font mapper object and return previous one (may be NULL).
1434 ///
1435 /// See [C++ `wxFontMapper::Set()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_mapper.html#a41b0051189bfe57f3fabde0f42c5635c).
1436 fn set<F: FontMapperMethods>(mapper: Option<&F>) -> Option<FontMapperIsOwned<false>> {
1437 unsafe {
1438 let mapper = match mapper {
1439 Some(r) => r.as_ptr(),
1440 None => ptr::null_mut(),
1441 };
1442 FontMapper::option_from(ffi::wxFontMapper_Set(mapper))
1443 }
1444 }
1445}
1446
1447// wxFontPickerCtrl
1448/// This trait represents [C++ `wxFontPickerCtrl` class](https://docs.wxwidgets.org/3.2/classwx_font_picker_ctrl.html)'s methods and inheritance.
1449///
1450/// See [`FontPickerCtrlIsOwned`] documentation for the class usage.
1451pub trait FontPickerCtrlMethods: PickerBaseMethods {
1452 /// Creates this widget with given parameters.
1453 ///
1454 /// See [C++ `wxFontPickerCtrl::Create()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_picker_ctrl.html#aee60a47fb3de5b61f4c79823fcf2bd29).
1455 fn create_font<
1456 W: WindowMethods,
1457 F: FontMethods,
1458 P: PointMethods,
1459 S: SizeMethods,
1460 V: ValidatorMethods,
1461 >(
1462 &self,
1463 parent: Option<&W>,
1464 id: c_int,
1465 font: &F,
1466 pos: &P,
1467 size: &S,
1468 style: c_long,
1469 validator: &V,
1470 name: &str,
1471 ) -> bool {
1472 unsafe {
1473 let parent = match parent {
1474 Some(r) => r.as_ptr(),
1475 None => ptr::null_mut(),
1476 };
1477 let font = font.as_ptr();
1478 let pos = pos.as_ptr();
1479 let size = size.as_ptr();
1480 let validator = validator.as_ptr();
1481 let name = WxString::from(name);
1482 let name = name.as_ptr();
1483 ffi::wxFontPickerCtrl_Create(
1484 self.as_ptr(),
1485 parent,
1486 id,
1487 font,
1488 pos,
1489 size,
1490 style,
1491 validator,
1492 name,
1493 )
1494 }
1495 }
1496 /// Returns the maximum point size value allowed for the user-chosen font.
1497 ///
1498 /// See [C++ `wxFontPickerCtrl::GetMaxPointSize()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_picker_ctrl.html#a800e8e8c3d682a62be54090a01c7da84).
1499 fn get_max_point_size(&self) -> c_uint {
1500 unsafe { ffi::wxFontPickerCtrl_GetMaxPointSize(self.as_ptr()) }
1501 }
1502 /// Returns the minimum point size value allowed for the user-chosen font.
1503 ///
1504 /// See [C++ `wxFontPickerCtrl::GetMinPointSize()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_picker_ctrl.html#a6558efa57fcbe1c49881587e5c0ef213).
1505 fn get_min_point_size(&self) -> c_uint {
1506 unsafe { ffi::wxFontPickerCtrl_GetMinPointSize(self.as_ptr()) }
1507 }
1508 /// Returns the currently selected colour.
1509 ///
1510 /// See [C++ `wxFontPickerCtrl::GetSelectedColour()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_picker_ctrl.html#a9f92eb7430015cc4c3e2193e7a0c3362).
1511 fn get_selected_colour(&self) -> Colour {
1512 unsafe { Colour::from_ptr(ffi::wxFontPickerCtrl_GetSelectedColour(self.as_ptr())) }
1513 }
1514 /// Returns the currently selected font.
1515 ///
1516 /// See [C++ `wxFontPickerCtrl::GetSelectedFont()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_picker_ctrl.html#a853e238c49133786fe421f1093e5695a).
1517 fn get_selected_font(&self) -> Font {
1518 unsafe { Font::from_ptr(ffi::wxFontPickerCtrl_GetSelectedFont(self.as_ptr())) }
1519 }
1520 /// Sets the maximum point size value allowed for the user-chosen font.
1521 ///
1522 /// See [C++ `wxFontPickerCtrl::SetMaxPointSize()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_picker_ctrl.html#a63b4c361a3b9162ce101e00673828721).
1523 fn set_max_point_size(&self, max: c_uint) {
1524 unsafe { ffi::wxFontPickerCtrl_SetMaxPointSize(self.as_ptr(), max) }
1525 }
1526 /// Sets the minimum point size value allowed for the user-chosen font.
1527 ///
1528 /// See [C++ `wxFontPickerCtrl::SetMinPointSize()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_picker_ctrl.html#ad0177fdae6d9ed31a4a4672cd872e2b1).
1529 fn set_min_point_size(&self, min: c_uint) {
1530 unsafe { ffi::wxFontPickerCtrl_SetMinPointSize(self.as_ptr(), min) }
1531 }
1532 /// Sets the font colour.
1533 ///
1534 /// See [C++ `wxFontPickerCtrl::SetSelectedColour()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_picker_ctrl.html#a37e28bb0369f95bcb5da71302f643307).
1535 fn set_selected_colour<C: ColourMethods>(&self, colour: &C) {
1536 unsafe {
1537 let colour = colour.as_ptr();
1538 ffi::wxFontPickerCtrl_SetSelectedColour(self.as_ptr(), colour)
1539 }
1540 }
1541 /// Sets the currently selected font.
1542 ///
1543 /// See [C++ `wxFontPickerCtrl::SetSelectedFont()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_picker_ctrl.html#ada07e418ed99431e5012fb9409b729a7).
1544 fn set_selected_font<F: FontMethods>(&self, font: &F) {
1545 unsafe {
1546 let font = font.as_ptr();
1547 ffi::wxFontPickerCtrl_SetSelectedFont(self.as_ptr(), font)
1548 }
1549 }
1550}
1551
1552// wxFontPickerEvent
1553/// This trait represents [C++ `wxFontPickerEvent` class](https://docs.wxwidgets.org/3.2/classwx_font_picker_event.html)'s methods and inheritance.
1554///
1555/// See [`FontPickerEventIsOwned`] documentation for the class usage.
1556pub trait FontPickerEventMethods: CommandEventMethods {
1557 /// Retrieve the font the user has just selected.
1558 ///
1559 /// See [C++ `wxFontPickerEvent::GetFont()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_picker_event.html#a1bbde3a3dbd884754c7d18a7a5b52354).
1560 fn get_font(&self) -> Font {
1561 unsafe { Font::from_ptr(ffi::wxFontPickerEvent_GetFont(self.as_ptr())) }
1562 }
1563 /// Set the font associated with the event.
1564 ///
1565 /// See [C++ `wxFontPickerEvent::SetFont()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_font_picker_event.html#a4731df639d37c8056b96f9dec9db52d0).
1566 fn set_font<F: FontMethods>(&self, f: &F) {
1567 unsafe {
1568 let f = f.as_ptr();
1569 ffi::wxFontPickerEvent_SetFont(self.as_ptr(), f)
1570 }
1571 }
1572}
1573
1574// wxFrame
1575/// This trait represents [C++ `wxFrame` class](https://docs.wxwidgets.org/3.2/classwx_frame.html)'s methods and inheritance.
1576///
1577/// See [`FrameIsOwned`] documentation for the class usage.
1578pub trait FrameMethods: TopLevelWindowMethods {
1579 // DTOR: fn ~wxFrame()
1580 /// Creates a status bar at the bottom of the frame.
1581 ///
1582 /// See [C++ `wxFrame::CreateStatusBar()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a76709944aa2a1bae45c48bf2be4908b2).
1583 fn create_status_bar(
1584 &self,
1585 number: c_int,
1586 style: c_long,
1587 id: c_int,
1588 name: &str,
1589 ) -> WeakRef<StatusBar> {
1590 unsafe {
1591 let name = WxString::from(name);
1592 let name = name.as_ptr();
1593 WeakRef::<StatusBar>::from(ffi::wxFrame_CreateStatusBar(
1594 self.as_ptr(),
1595 number,
1596 style,
1597 id,
1598 name,
1599 ))
1600 }
1601 }
1602 /// Creates a toolbar at the top or left of the frame.
1603 ///
1604 /// See [C++ `wxFrame::CreateToolBar()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#ab133b1f25421d2932f1bafcc3a8fd1f1).
1605 fn create_tool_bar(&self, style: c_long, id: c_int, name: &str) -> WeakRef<ToolBar> {
1606 unsafe {
1607 let name = WxString::from(name);
1608 let name = name.as_ptr();
1609 WeakRef::<ToolBar>::from(ffi::wxFrame_CreateToolBar(self.as_ptr(), style, id, name))
1610 }
1611 }
1612 /// Method used to show help string of the selected menu toolbar item.
1613 ///
1614 /// See [C++ `wxFrame::DoGiveHelp()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#ab316b7ec4a5c63810cdb05318d5aeb26).
1615 fn do_give_help(&self, text: &str, show: bool) {
1616 unsafe {
1617 let text = WxString::from(text);
1618 let text = text.as_ptr();
1619 ffi::wxFrame_DoGiveHelp(self.as_ptr(), text, show)
1620 }
1621 }
1622 /// Returns a pointer to the menubar currently associated with the frame (if any).
1623 ///
1624 /// See [C++ `wxFrame::GetMenuBar()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a468c573ad848c17543dddc4550cae351).
1625 fn get_menu_bar(&self) -> WeakRef<MenuBar> {
1626 unsafe { WeakRef::<MenuBar>::from(ffi::wxFrame_GetMenuBar(self.as_ptr())) }
1627 }
1628 /// Returns a pointer to the status bar currently associated with the frame (if any).
1629 ///
1630 /// See [C++ `wxFrame::GetStatusBar()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a075a4c41c80819bc252c8cbd27258ef3).
1631 fn get_status_bar(&self) -> WeakRef<StatusBar> {
1632 unsafe { WeakRef::<StatusBar>::from(ffi::wxFrame_GetStatusBar(self.as_ptr())) }
1633 }
1634 /// Returns the status bar pane used to display menu and toolbar help.
1635 ///
1636 /// See [C++ `wxFrame::GetStatusBarPane()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#ad36e13c10ea3675c18f2fe480cd7b952).
1637 fn get_status_bar_pane(&self) -> c_int {
1638 unsafe { ffi::wxFrame_GetStatusBarPane(self.as_ptr()) }
1639 }
1640 /// Returns a pointer to the toolbar currently associated with the frame (if any).
1641 ///
1642 /// See [C++ `wxFrame::GetToolBar()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#aa6c57209ee6b5efb6a4661ac0d9923f4).
1643 fn get_tool_bar(&self) -> WeakRef<ToolBar> {
1644 unsafe { WeakRef::<ToolBar>::from(ffi::wxFrame_GetToolBar(self.as_ptr())) }
1645 }
1646 /// Virtual function called when a status bar is requested by CreateStatusBar().
1647 ///
1648 /// See [C++ `wxFrame::OnCreateStatusBar()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#adb6d9e361ae0fe2f0cb17cf9d5030dcf).
1649 fn on_create_status_bar(
1650 &self,
1651 number: c_int,
1652 style: c_long,
1653 id: c_int,
1654 name: &str,
1655 ) -> WeakRef<StatusBar> {
1656 unsafe {
1657 let name = WxString::from(name);
1658 let name = name.as_ptr();
1659 WeakRef::<StatusBar>::from(ffi::wxFrame_OnCreateStatusBar(
1660 self.as_ptr(),
1661 number,
1662 style,
1663 id,
1664 name,
1665 ))
1666 }
1667 }
1668 /// Virtual function called when a toolbar is requested by CreateToolBar().
1669 ///
1670 /// See [C++ `wxFrame::OnCreateToolBar()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a2c23ede57762d475a8d0a6741983ab9f).
1671 fn on_create_tool_bar(&self, style: c_long, id: c_int, name: &str) -> WeakRef<ToolBar> {
1672 unsafe {
1673 let name = WxString::from(name);
1674 let name = name.as_ptr();
1675 WeakRef::<ToolBar>::from(ffi::wxFrame_OnCreateToolBar(self.as_ptr(), style, id, name))
1676 }
1677 }
1678 /// Simulate a menu command.
1679 ///
1680 /// See [C++ `wxFrame::ProcessCommand()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a3dfab71a356ba08da4f065ca6c108b74).
1681 fn process_command(&self, id: c_int) -> bool {
1682 unsafe { ffi::wxFrame_ProcessCommand(self.as_ptr(), id) }
1683 }
1684 /// Tells the frame to show the given menu bar.
1685 ///
1686 /// See [C++ `wxFrame::SetMenuBar()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a83e63c48e1a3f14e661de3ccd434cbbf).
1687 fn set_menu_bar<M: MenuBarMethods>(&self, menu_bar: Option<&M>) {
1688 unsafe {
1689 let menu_bar = match menu_bar {
1690 Some(r) => r.as_ptr(),
1691 None => ptr::null_mut(),
1692 };
1693 ffi::wxFrame_SetMenuBar(self.as_ptr(), menu_bar)
1694 }
1695 }
1696 /// Associates a status bar with the frame.
1697 ///
1698 /// See [C++ `wxFrame::SetStatusBar()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a1c3714836fab3f8b892e18b45eb011b0).
1699 fn set_status_bar<S: StatusBarMethods>(&self, status_bar: Option<&S>) {
1700 unsafe {
1701 let status_bar = match status_bar {
1702 Some(r) => r.as_ptr(),
1703 None => ptr::null_mut(),
1704 };
1705 ffi::wxFrame_SetStatusBar(self.as_ptr(), status_bar)
1706 }
1707 }
1708 /// Set the status bar pane used to display menu and toolbar help.
1709 ///
1710 /// See [C++ `wxFrame::SetStatusBarPane()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a8a82de139a9a44ce638fe978c00ac07f).
1711 fn set_status_bar_pane(&self, n: c_int) {
1712 unsafe { ffi::wxFrame_SetStatusBarPane(self.as_ptr(), n) }
1713 }
1714 /// Sets the status bar text and updates the status bar display.
1715 ///
1716 /// See [C++ `wxFrame::SetStatusText()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a0026c883df35e1d1f8818e229c41249f).
1717 fn set_status_text(&self, text: &str, number: c_int) {
1718 unsafe {
1719 let text = WxString::from(text);
1720 let text = text.as_ptr();
1721 ffi::wxFrame_SetStatusText(self.as_ptr(), text, number)
1722 }
1723 }
1724 /// Sets the widths of the fields in the status bar.
1725 ///
1726 /// See [C++ `wxFrame::SetStatusWidths()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a5e872935a702d136a4dafb808c4a2456).
1727 fn set_status_widths(&self, n: c_int, widths_field: *const c_void) {
1728 unsafe { ffi::wxFrame_SetStatusWidths(self.as_ptr(), n, widths_field) }
1729 }
1730 /// Associates a toolbar with the frame.
1731 ///
1732 /// See [C++ `wxFrame::SetToolBar()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#ab4017f727aa97560f51457d7302b0ca5).
1733 fn set_tool_bar<T: ToolBarMethods>(&self, tool_bar: Option<&T>) {
1734 unsafe {
1735 let tool_bar = match tool_bar {
1736 Some(r) => r.as_ptr(),
1737 None => ptr::null_mut(),
1738 };
1739 ffi::wxFrame_SetToolBar(self.as_ptr(), tool_bar)
1740 }
1741 }
1742 /// MSW-specific function for accessing the taskbar button under Windows 7 or later.
1743 ///
1744 /// See [C++ `wxFrame::MSWGetTaskBarButton()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a555acbda4f137bedaec8895262f1617a).
1745 fn msw_get_task_bar_button(&self) -> *mut c_void {
1746 unsafe { ffi::wxFrame_MSWGetTaskBarButton(self.as_ptr()) }
1747 }
1748 ///
1749 /// See [C++ `wxFrame::PushStatusText()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#a65346afc0ded65a824c13fedca1bf7a5).
1750 fn push_status_text(&self, text: &str, number: c_int) {
1751 unsafe {
1752 let text = WxString::from(text);
1753 let text = text.as_ptr();
1754 ffi::wxFrame_PushStatusText(self.as_ptr(), text, number)
1755 }
1756 }
1757 ///
1758 /// See [C++ `wxFrame::PopStatusText()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_frame.html#aec7e735264adfd53e99fb0ccb506f87c).
1759 fn pop_status_text(&self, number: c_int) {
1760 unsafe { ffi::wxFrame_PopStatusText(self.as_ptr(), number) }
1761 }
1762}