wxrust/generated/methods_h.rs
1use super::*;
2
3// wxHScrolledWindow
4/// This trait represents [C++ `wxHScrolledWindow` class](https://docs.wxwidgets.org/3.2/classwx_h_scrolled_window.html)'s methods and inheritance.
5///
6/// See [`HScrolledWindowIsOwned`] documentation for the class usage.
7pub trait HScrolledWindowMethods: PanelMethods {}
8
9// wxHTMLDataObject
10/// This trait represents [C++ `wxHTMLDataObject` class](https://docs.wxwidgets.org/3.2/classwx_h_t_m_l_data_object.html)'s methods and inheritance.
11///
12/// See [`HTMLDataObjectIsOwned`] documentation for the class usage.
13pub trait HTMLDataObjectMethods: DataObjectSimpleMethods {
14 /// Returns the HTML string.
15 ///
16 /// See [C++ `wxHTMLDataObject::GetHTML()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_h_t_m_l_data_object.html#a40610295fed2754d98a2d753b1f4527c).
17 fn get_html(&self) -> String {
18 unsafe { WxString::from_ptr(ffi::wxHTMLDataObject_GetHTML(self.as_ptr())).into() }
19 }
20 /// Sets the HTML string.
21 ///
22 /// See [C++ `wxHTMLDataObject::SetHTML()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_h_t_m_l_data_object.html#aaa23c38c3e4af0f62c78fb6e76d41be3).
23 fn set_html(&self, html: &str) {
24 unsafe {
25 let html = WxString::from(html);
26 let html = html.as_ptr();
27 ffi::wxHTMLDataObject_SetHTML(self.as_ptr(), html)
28 }
29 }
30}
31
32// wxHVScrolledWindow
33/// This trait represents [C++ `wxHVScrolledWindow` class](https://docs.wxwidgets.org/3.2/classwx_h_v_scrolled_window.html)'s methods and inheritance.
34///
35/// See [`HVScrolledWindowIsOwned`] documentation for the class usage.
36pub trait HVScrolledWindowMethods: PanelMethods {}
37
38// wxHeaderColumn
39/// This trait represents [C++ `wxHeaderColumn` class](https://docs.wxwidgets.org/3.2/classwx_header_column.html)'s methods and inheritance.
40///
41/// See [`HeaderColumnIsOwned`] documentation for the class usage.
42pub trait HeaderColumnMethods: WxRustMethods {
43 /// Get the text shown in the column header.
44 ///
45 /// See [C++ `wxHeaderColumn::GetTitle()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#a47d57c9babac44df16e1f5581156a3ce).
46 fn get_title(&self) -> String {
47 unsafe { WxString::from_ptr(ffi::wxHeaderColumn_GetTitle(self.as_ptr())).into() }
48 }
49 /// This function exists only for backwards compatibility, it's recommended to override GetBitmapBundle() in the new code and override this one to do nothing, as it will never be called if GetBitmapBundle() is overridden.
50 ///
51 /// See [C++ `wxHeaderColumn::GetBitmap()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#aca4d183177667dd1f6f20a61127109af).
52 fn get_bitmap(&self) -> Bitmap {
53 unsafe { Bitmap::from_ptr(ffi::wxHeaderColumn_GetBitmap(self.as_ptr())) }
54 }
55 /// Returns the bitmap in the header of the column, if any.
56 ///
57 /// See [C++ `wxHeaderColumn::GetBitmapBundle()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#aa44eca61f73dec37bf1434041f8dccd8).
58 fn get_bitmap_bundle(&self) -> BitmapBundle {
59 unsafe { BitmapBundle::from_ptr(ffi::wxHeaderColumn_GetBitmapBundle(self.as_ptr())) }
60 }
61 /// Returns the current width of the column.
62 ///
63 /// See [C++ `wxHeaderColumn::GetWidth()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#a992a31984563a35b0222adf5a06b0a77).
64 fn get_width(&self) -> c_int {
65 unsafe { ffi::wxHeaderColumn_GetWidth(self.as_ptr()) }
66 }
67 /// Return the minimal column width.
68 ///
69 /// See [C++ `wxHeaderColumn::GetMinWidth()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#a8a7c17e7f634570246b734cf2eb63fbb).
70 fn get_min_width(&self) -> c_int {
71 unsafe { ffi::wxHeaderColumn_GetMinWidth(self.as_ptr()) }
72 }
73 /// Returns the current column alignment.
74 ///
75 /// See [C++ `wxHeaderColumn::GetAlignment()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#afc7728e0def849ecb6a2b074f2ea0eb8).
76 fn get_alignment(&self) -> c_int {
77 unsafe { ffi::wxHeaderColumn_GetAlignment(self.as_ptr()) }
78 }
79 /// Get the column flags.
80 ///
81 /// See [C++ `wxHeaderColumn::GetFlags()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#a5026f8cf3dde67ab2003da8ec8a892ab).
82 fn get_flags(&self) -> c_int {
83 unsafe { ffi::wxHeaderColumn_GetFlags(self.as_ptr()) }
84 }
85 /// Return true if the specified flag is currently set for this column.
86 ///
87 /// See [C++ `wxHeaderColumn::HasFlag()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#ad9ca1aaba092ae89b0e4efcacc243b12).
88 fn has_flag(&self, flag: c_int) -> bool {
89 unsafe { ffi::wxHeaderColumn_HasFlag(self.as_ptr(), flag) }
90 }
91 /// Return true if the column can be resized by the user.
92 ///
93 /// See [C++ `wxHeaderColumn::IsResizeable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#a5d5bade6f1ade844355fe2a4ee680471).
94 fn is_resizeable(&self) -> bool {
95 unsafe { ffi::wxHeaderColumn_IsResizeable(self.as_ptr()) }
96 }
97 /// Returns true if the column can be clicked by user to sort the control contents by the field in this column.
98 ///
99 /// See [C++ `wxHeaderColumn::IsSortable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#a48e7b0b4c63cfc778b9fc87f0074fb62).
100 fn is_sortable(&self) -> bool {
101 unsafe { ffi::wxHeaderColumn_IsSortable(self.as_ptr()) }
102 }
103 /// Returns true if the column can be dragged by user to change its order.
104 ///
105 /// See [C++ `wxHeaderColumn::IsReorderable()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#a40f94597100d0d1852b61124d32ab871).
106 fn is_reorderable(&self) -> bool {
107 unsafe { ffi::wxHeaderColumn_IsReorderable(self.as_ptr()) }
108 }
109 /// Returns true if the column is currently hidden.
110 ///
111 /// See [C++ `wxHeaderColumn::IsHidden()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#a010ab3ccff0b3c58a1e19b93b0eb09ac).
112 fn is_hidden(&self) -> bool {
113 unsafe { ffi::wxHeaderColumn_IsHidden(self.as_ptr()) }
114 }
115 /// Returns true if the column is currently shown.
116 ///
117 /// See [C++ `wxHeaderColumn::IsShown()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#a14d520b2b990069ea2df289cc346ba44).
118 fn is_shown(&self) -> bool {
119 unsafe { ffi::wxHeaderColumn_IsShown(self.as_ptr()) }
120 }
121 /// Returns true if the column is currently used for sorting.
122 ///
123 /// See [C++ `wxHeaderColumn::IsSortKey()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#a95645523fc113008d66d626bc06c7dd1).
124 fn is_sort_key(&self) -> bool {
125 unsafe { ffi::wxHeaderColumn_IsSortKey(self.as_ptr()) }
126 }
127 /// Returns true, if the sort order is ascending.
128 ///
129 /// See [C++ `wxHeaderColumn::IsSortOrderAscending()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_column.html#a30e41f28c017812c4f53e4b66c62cd4c).
130 fn is_sort_order_ascending(&self) -> bool {
131 unsafe { ffi::wxHeaderColumn_IsSortOrderAscending(self.as_ptr()) }
132 }
133}
134
135// wxHeaderColumnSimple
136/// This trait represents [C++ `wxHeaderColumnSimple` class](https://docs.wxwidgets.org/3.2/classwx_header_column_simple.html)'s methods and inheritance.
137///
138/// See [`HeaderColumnSimpleIsOwned`] documentation for the class usage.
139pub trait HeaderColumnSimpleMethods: SettableHeaderColumnMethods {}
140
141// wxHeaderCtrl
142/// This trait represents [C++ `wxHeaderCtrl` class](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html)'s methods and inheritance.
143///
144/// See [`HeaderCtrlIsOwned`] documentation for the class usage.
145pub trait HeaderCtrlMethods: ControlMethods {
146 /// Set the number of columns in the control.
147 ///
148 /// See [C++ `wxHeaderCtrl::SetColumnCount()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a41ff1c0ad9b13a79b17e61555e81eb25).
149 fn set_column_count(&self, count: c_uint) {
150 unsafe { ffi::wxHeaderCtrl_SetColumnCount(self.as_ptr(), count) }
151 }
152 /// Return the number of columns in the control.
153 ///
154 /// See [C++ `wxHeaderCtrl::GetColumnCount()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a42690da34b54c1ae7a575c3924297dd1).
155 fn get_column_count(&self) -> c_uint {
156 unsafe { ffi::wxHeaderCtrl_GetColumnCount(self.as_ptr()) }
157 }
158 /// Return whether the control has any columns.
159 ///
160 /// See [C++ `wxHeaderCtrl::IsEmpty()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a12706f2e9263701a189b776e2877458d).
161 fn is_empty(&self) -> bool {
162 unsafe { ffi::wxHeaderCtrl_IsEmpty(self.as_ptr()) }
163 }
164 /// Update the column with the given index.
165 ///
166 /// See [C++ `wxHeaderCtrl::UpdateColumn()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a39d92436446d06da3ed011e43fd4d249).
167 fn update_column(&self, idx: c_uint) {
168 unsafe { ffi::wxHeaderCtrl_UpdateColumn(self.as_ptr(), idx) }
169 }
170 /// Change the columns display order.
171 ///
172 /// See [C++ `wxHeaderCtrl::SetColumnsOrder()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a561d03dc7ce13d2deeff41b0df0b8990).
173 fn set_columns_order<A: ArrayIntMethods>(&self, order: &A) {
174 unsafe {
175 let order = order.as_ptr();
176 ffi::wxHeaderCtrl_SetColumnsOrder(self.as_ptr(), order)
177 }
178 }
179 /// Return the array describing the columns display order.
180 ///
181 /// See [C++ `wxHeaderCtrl::GetColumnsOrder()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a9cc12b69fb41bd8bf7c3b106078a8915).
182 fn get_columns_order(&self) -> ArrayInt {
183 unsafe { ArrayInt::from_ptr(ffi::wxHeaderCtrl_GetColumnsOrder(self.as_ptr())) }
184 }
185 /// Return the index of the column displayed at the given position.
186 ///
187 /// See [C++ `wxHeaderCtrl::GetColumnAt()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#ab86cd1ea2dafcafc38a23b3a182f0953).
188 fn get_column_at(&self, pos: c_uint) -> c_uint {
189 unsafe { ffi::wxHeaderCtrl_GetColumnAt(self.as_ptr(), pos) }
190 }
191 /// Get the position at which this column is currently displayed.
192 ///
193 /// See [C++ `wxHeaderCtrl::GetColumnPos()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#af3cadca8793de042fe71666f8c3a8c66).
194 fn get_column_pos(&self, idx: c_uint) -> c_uint {
195 unsafe { ffi::wxHeaderCtrl_GetColumnPos(self.as_ptr(), idx) }
196 }
197 /// Reset the columns order to the natural one.
198 ///
199 /// See [C++ `wxHeaderCtrl::ResetColumnsOrder()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#aec79d0137d1c577741bb883dbb897f0e).
200 fn reset_columns_order(&self) {
201 unsafe { ffi::wxHeaderCtrl_ResetColumnsOrder(self.as_ptr()) }
202 }
203 /// Show the popup menu allowing the user to show or hide the columns.
204 ///
205 /// See [C++ `wxHeaderCtrl::ShowColumnsMenu()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a1662ff7b43136b1ae710d11cbe9e3295).
206 fn show_columns_menu<P: PointMethods>(&self, pt: &P, title: &str) -> bool {
207 unsafe {
208 let pt = pt.as_ptr();
209 let title = WxString::from(title);
210 let title = title.as_ptr();
211 ffi::wxHeaderCtrl_ShowColumnsMenu(self.as_ptr(), pt, title)
212 }
213 }
214 /// Helper function appending the checkable items corresponding to all the columns to the given menu.
215 ///
216 /// See [C++ `wxHeaderCtrl::AddColumnsItems()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a22396560f002df58ecc7c6ed62feaf6e).
217 fn add_columns_items<M: MenuMethods>(&self, menu: &M, id_columns_base: c_int) {
218 unsafe {
219 let menu = menu.as_ptr();
220 ffi::wxHeaderCtrl_AddColumnsItems(self.as_ptr(), menu, id_columns_base)
221 }
222 }
223 /// Show the column customization dialog.
224 ///
225 /// See [C++ `wxHeaderCtrl::ShowCustomizeDialog()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a47f99bb2cfe60decf996f43138c1b32f).
226 fn show_customize_dialog(&self) -> bool {
227 unsafe { ffi::wxHeaderCtrl_ShowCustomizeDialog(self.as_ptr()) }
228 }
229 /// Returns width needed for given column's title.
230 ///
231 /// See [C++ `wxHeaderCtrl::GetColumnTitleWidth()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a317a54720263d266356c685c4c024869).
232 fn get_column_title_width_headercolumn<H: HeaderColumnMethods>(&self, col: &H) -> c_int {
233 unsafe {
234 let col = col.as_ptr();
235 ffi::wxHeaderCtrl_GetColumnTitleWidth(self.as_ptr(), col)
236 }
237 }
238 /// Returns width needed for the column with the given index.
239 ///
240 /// See [C++ `wxHeaderCtrl::GetColumnTitleWidth()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a67efc79baa684de193d725b35db91956).
241 fn get_column_title_width_uint(&self, idx: c_uint) -> c_int {
242 unsafe { ffi::wxHeaderCtrl_GetColumnTitleWidth1(self.as_ptr(), idx) }
243 }
244 /// Helper function to manipulate the array of column indices.
245 ///
246 /// See [C++ `wxHeaderCtrl::MoveColumnInOrderArray()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl.html#a8046ddebbcdf8a6d82f1da144cf868ea).
247 fn move_column_in_order_array<A: ArrayIntMethods>(order: &A, idx: c_uint, pos: c_uint) {
248 unsafe {
249 let order = order.as_ptr();
250 ffi::wxHeaderCtrl_MoveColumnInOrderArray(order, idx, pos)
251 }
252 }
253}
254
255// wxHeaderCtrlEvent
256/// This trait represents [C++ `wxHeaderCtrlEvent` class](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_event.html)'s methods and inheritance.
257///
258/// See [`HeaderCtrlEventIsOwned`] documentation for the class usage.
259pub trait HeaderCtrlEventMethods: NotifyEventMethods {
260 /// Return the index of the column affected by this event.
261 ///
262 /// See [C++ `wxHeaderCtrlEvent::GetColumn()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_event.html#af7eff8f64cb52cf69d32c7e84eba76b2).
263 fn get_column(&self) -> c_int {
264 unsafe { ffi::wxHeaderCtrlEvent_GetColumn(self.as_ptr()) }
265 }
266 ///
267 /// See [C++ `wxHeaderCtrlEvent::SetColumn()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_event.html#a8fb7846e9799d28468bd14a7c505f40d).
268 fn set_column(&self, col: c_int) {
269 unsafe { ffi::wxHeaderCtrlEvent_SetColumn(self.as_ptr(), col) }
270 }
271 /// Return the current width of the column.
272 ///
273 /// See [C++ `wxHeaderCtrlEvent::GetWidth()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_event.html#a7b31e1098c094499703be53f8f5ef55d).
274 fn get_width(&self) -> c_int {
275 unsafe { ffi::wxHeaderCtrlEvent_GetWidth(self.as_ptr()) }
276 }
277 ///
278 /// See [C++ `wxHeaderCtrlEvent::SetWidth()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_event.html#a71bcd3bfaf4d89e586b5bc5bde1820ae).
279 fn set_width(&self, width: c_int) {
280 unsafe { ffi::wxHeaderCtrlEvent_SetWidth(self.as_ptr(), width) }
281 }
282 /// Return the new order of the column.
283 ///
284 /// See [C++ `wxHeaderCtrlEvent::GetNewOrder()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_event.html#ab34f345e08ce51a50f914724369cfe70).
285 fn get_new_order(&self) -> c_uint {
286 unsafe { ffi::wxHeaderCtrlEvent_GetNewOrder(self.as_ptr()) }
287 }
288 ///
289 /// See [C++ `wxHeaderCtrlEvent::SetNewOrder()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_event.html#aeac162a3d7df259e8e34a1c28d5f73ca).
290 fn set_new_order(&self, order: c_uint) {
291 unsafe { ffi::wxHeaderCtrlEvent_SetNewOrder(self.as_ptr(), order) }
292 }
293}
294
295// wxHeaderCtrlSimple
296/// This trait represents [C++ `wxHeaderCtrlSimple` class](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_simple.html)'s methods and inheritance.
297///
298/// See [`HeaderCtrlSimpleIsOwned`] documentation for the class usage.
299pub trait HeaderCtrlSimpleMethods: HeaderCtrlMethods {
300 /// Insert the column at the given position.
301 ///
302 /// See [C++ `wxHeaderCtrlSimple::InsertColumn()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_simple.html#a2da87a48d6020d62649d660a53778098).
303 fn insert_column<H: HeaderColumnSimpleMethods>(&self, col: &H, idx: c_uint) {
304 unsafe {
305 let col = col.as_ptr();
306 ffi::wxHeaderCtrlSimple_InsertColumn(self.as_ptr(), col, idx)
307 }
308 }
309 /// Append the column to the end of the control.
310 ///
311 /// See [C++ `wxHeaderCtrlSimple::AppendColumn()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_simple.html#a953d8f6fcc305cea02182a10eb47cc08).
312 fn append_column<H: HeaderColumnSimpleMethods>(&self, col: &H) {
313 unsafe {
314 let col = col.as_ptr();
315 ffi::wxHeaderCtrlSimple_AppendColumn(self.as_ptr(), col)
316 }
317 }
318 /// Delete the column at the given position.
319 ///
320 /// See [C++ `wxHeaderCtrlSimple::DeleteColumn()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_simple.html#a6b3ca586ed2da4ac964bd57ef0753509).
321 fn delete_column(&self, idx: c_uint) {
322 unsafe { ffi::wxHeaderCtrlSimple_DeleteColumn(self.as_ptr(), idx) }
323 }
324 /// Show or hide the column.
325 ///
326 /// See [C++ `wxHeaderCtrlSimple::ShowColumn()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_simple.html#aca35f2f868e3b5116f132ea5a7ef3bd7).
327 fn show_column(&self, idx: c_uint, show: bool) {
328 unsafe { ffi::wxHeaderCtrlSimple_ShowColumn(self.as_ptr(), idx, show) }
329 }
330 /// Hide the column with the given index.
331 ///
332 /// See [C++ `wxHeaderCtrlSimple::HideColumn()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_simple.html#a39735d2c9a2ab8ba709a142757c47287).
333 fn hide_column(&self, idx: c_uint) {
334 unsafe { ffi::wxHeaderCtrlSimple_HideColumn(self.as_ptr(), idx) }
335 }
336 /// Update the column sort indicator.
337 ///
338 /// See [C++ `wxHeaderCtrlSimple::ShowSortIndicator()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_simple.html#a18c357a62620cf6171ab4a8fa281eee2).
339 fn show_sort_indicator(&self, idx: c_uint, sort_order: bool) {
340 unsafe { ffi::wxHeaderCtrlSimple_ShowSortIndicator(self.as_ptr(), idx, sort_order) }
341 }
342 /// Remove the sort indicator from the column being used as sort key.
343 ///
344 /// See [C++ `wxHeaderCtrlSimple::RemoveSortIndicator()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_header_ctrl_simple.html#a3ad67fca36b463042d91a7d4b0e265ef).
345 fn remove_sort_indicator(&self) {
346 unsafe { ffi::wxHeaderCtrlSimple_RemoveSortIndicator(self.as_ptr()) }
347 }
348}
349
350// wxHelpEvent
351/// This trait represents [C++ `wxHelpEvent` class](https://docs.wxwidgets.org/3.2/classwx_help_event.html)'s methods and inheritance.
352///
353/// See [`HelpEventIsOwned`] documentation for the class usage.
354pub trait HelpEventMethods: CommandEventMethods {
355 // NOT_SUPPORTED: fn GetOrigin()
356 /// Returns the left-click position of the mouse, in screen coordinates.
357 ///
358 /// See [C++ `wxHelpEvent::GetPosition()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_help_event.html#a28bd5a0701bb9d0537dced60743a2292).
359 fn get_position(&self) -> PointIsOwned<false> {
360 unsafe { PointIsOwned::from_ptr(ffi::wxHelpEvent_GetPosition(self.as_ptr())) }
361 }
362 // NOT_SUPPORTED: fn SetOrigin()
363 /// Sets the left-click position of the mouse, in screen coordinates.
364 ///
365 /// See [C++ `wxHelpEvent::SetPosition()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_help_event.html#aceef2981ed1c48fa1ba55cff9c185e81).
366 fn set_position<P: PointMethods>(&self, pt: &P) {
367 unsafe {
368 let pt = pt.as_ptr();
369 ffi::wxHelpEvent_SetPosition(self.as_ptr(), pt)
370 }
371 }
372}
373
374// wxHyperlinkCtrl
375/// This trait represents [C++ `wxHyperlinkCtrl` class](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html)'s methods and inheritance.
376///
377/// See [`HyperlinkCtrlIsOwned`] documentation for the class usage.
378pub trait HyperlinkCtrlMethods: ControlMethods {
379 /// Creates the hyperlink control.
380 ///
381 /// See [C++ `wxHyperlinkCtrl::Create()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html#aa8aa95908e1624daffd352bb404a1113).
382 fn create_str<W: WindowMethods, P: PointMethods, S: SizeMethods>(
383 &self,
384 parent: Option<&W>,
385 id: c_int,
386 label: &str,
387 url: &str,
388 pos: &P,
389 size: &S,
390 style: c_long,
391 name: &str,
392 ) -> bool {
393 unsafe {
394 let parent = match parent {
395 Some(r) => r.as_ptr(),
396 None => ptr::null_mut(),
397 };
398 let label = WxString::from(label);
399 let label = label.as_ptr();
400 let url = WxString::from(url);
401 let url = url.as_ptr();
402 let pos = pos.as_ptr();
403 let size = size.as_ptr();
404 let name = WxString::from(name);
405 let name = name.as_ptr();
406 ffi::wxHyperlinkCtrl_Create(
407 self.as_ptr(),
408 parent,
409 id,
410 label,
411 url,
412 pos,
413 size,
414 style,
415 name,
416 )
417 }
418 }
419 /// Returns the colour used to print the label of the hyperlink when the mouse is over the control.
420 ///
421 /// See [C++ `wxHyperlinkCtrl::GetHoverColour()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html#af61ed9ee14d41ea8c28af63da7cdd9cb).
422 fn get_hover_colour(&self) -> Colour {
423 unsafe { Colour::from_ptr(ffi::wxHyperlinkCtrl_GetHoverColour(self.as_ptr())) }
424 }
425 /// Returns the colour used to print the label when the link has never been clicked before (i.e. the link has not been visited) and the mouse is not over the control.
426 ///
427 /// See [C++ `wxHyperlinkCtrl::GetNormalColour()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html#acf74c7d92a32d32efb84a35698033a90).
428 fn get_normal_colour(&self) -> Colour {
429 unsafe { Colour::from_ptr(ffi::wxHyperlinkCtrl_GetNormalColour(self.as_ptr())) }
430 }
431 /// Returns the URL associated with the hyperlink.
432 ///
433 /// See [C++ `wxHyperlinkCtrl::GetURL()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html#a35d423be99fe82de8f12c97692d58ade).
434 fn get_url(&self) -> String {
435 unsafe { WxString::from_ptr(ffi::wxHyperlinkCtrl_GetURL(self.as_ptr())).into() }
436 }
437 /// Returns true if the hyperlink has already been clicked by the user at least one time.
438 ///
439 /// See [C++ `wxHyperlinkCtrl::GetVisited()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html#a61cc41599177ba3e05c41d7a6b1173e1).
440 fn get_visited(&self) -> bool {
441 unsafe { ffi::wxHyperlinkCtrl_GetVisited(self.as_ptr()) }
442 }
443 /// Returns the colour used to print the label when the mouse is not over the control and the link has already been clicked before (i.e. the link has been visited).
444 ///
445 /// See [C++ `wxHyperlinkCtrl::GetVisitedColour()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html#a1e81064f74b98b5814e56c1f1d7c0f49).
446 fn get_visited_colour(&self) -> Colour {
447 unsafe { Colour::from_ptr(ffi::wxHyperlinkCtrl_GetVisitedColour(self.as_ptr())) }
448 }
449 /// Sets the colour used to print the label of the hyperlink when the mouse is over the control.
450 ///
451 /// See [C++ `wxHyperlinkCtrl::SetHoverColour()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html#a0b96709dc5b7874b4f7ecf5301bc553b).
452 fn set_hover_colour<C: ColourMethods>(&self, colour: &C) {
453 unsafe {
454 let colour = colour.as_ptr();
455 ffi::wxHyperlinkCtrl_SetHoverColour(self.as_ptr(), colour)
456 }
457 }
458 /// Sets the colour used to print the label when the link has never been clicked before (i.e. the link has not been visited) and the mouse is not over the control.
459 ///
460 /// See [C++ `wxHyperlinkCtrl::SetNormalColour()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html#a6081b5336124b2851bf1d33dd48b97f3).
461 fn set_normal_colour<C: ColourMethods>(&self, colour: &C) {
462 unsafe {
463 let colour = colour.as_ptr();
464 ffi::wxHyperlinkCtrl_SetNormalColour(self.as_ptr(), colour)
465 }
466 }
467 /// Sets the URL associated with the hyperlink.
468 ///
469 /// See [C++ `wxHyperlinkCtrl::SetURL()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html#a1cdaf835c456f8395d1574d5d73ec988).
470 fn set_url(&self, url: &str) {
471 unsafe {
472 let url = WxString::from(url);
473 let url = url.as_ptr();
474 ffi::wxHyperlinkCtrl_SetURL(self.as_ptr(), url)
475 }
476 }
477 /// Marks the hyperlink as visited (see wxHyperlinkCtrl::SetVisitedColour).
478 ///
479 /// See [C++ `wxHyperlinkCtrl::SetVisited()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html#a6d2b3cefefa9047fd1bebe8c677a1f12).
480 fn set_visited(&self, visited: bool) {
481 unsafe { ffi::wxHyperlinkCtrl_SetVisited(self.as_ptr(), visited) }
482 }
483 /// Sets the colour used to print the label when the mouse is not over the control and the link has already been clicked before (i.e. the link has been visited).
484 ///
485 /// See [C++ `wxHyperlinkCtrl::SetVisitedColour()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_ctrl.html#add059ac942622177ae7870d341a11054).
486 fn set_visited_colour<C: ColourMethods>(&self, colour: &C) {
487 unsafe {
488 let colour = colour.as_ptr();
489 ffi::wxHyperlinkCtrl_SetVisitedColour(self.as_ptr(), colour)
490 }
491 }
492}
493
494// wxHyperlinkEvent
495/// This trait represents [C++ `wxHyperlinkEvent` class](https://docs.wxwidgets.org/3.2/classwx_hyperlink_event.html)'s methods and inheritance.
496///
497/// See [`HyperlinkEventIsOwned`] documentation for the class usage.
498pub trait HyperlinkEventMethods: CommandEventMethods {
499 /// Returns the URL of the hyperlink where the user has just clicked.
500 ///
501 /// See [C++ `wxHyperlinkEvent::GetURL()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_event.html#a8179561f6e053ba8dffb5e689dc45d8b).
502 fn get_url(&self) -> String {
503 unsafe { WxString::from_ptr(ffi::wxHyperlinkEvent_GetURL(self.as_ptr())).into() }
504 }
505 /// Sets the URL associated with the event.
506 ///
507 /// See [C++ `wxHyperlinkEvent::SetURL()`'s documentation](https://docs.wxwidgets.org/3.2/classwx_hyperlink_event.html#a49a363a38d5fede85e6e3b17694694ce).
508 fn set_url(&self, url: &str) {
509 unsafe {
510 let url = WxString::from(url);
511 let url = url.as_ptr();
512 ffi::wxHyperlinkEvent_SetURL(self.as_ptr(), url)
513 }
514 }
515}