1#![allow(deprecated)]
5
6use crate::{
7 ffi, Accessible, Align, Allocation, Buildable, ConstraintTarget, DirectionType,
8 EventController, LayoutManager, Native, Orientation, Overflow, PickFlags, Requisition, Root,
9 Settings, SizeRequestMode, Snapshot, StateFlags, StyleContext, TextDirection, Tooltip,
10};
11use glib::{
12 object::ObjectType as _,
13 prelude::*,
14 signal::{connect_raw, SignalHandlerId},
15 translate::*,
16};
17use std::boxed::Box as Box_;
18
19glib::wrapper! {
20 #[doc(alias = "GtkWidget")]
21 pub struct Widget(Object<ffi::GtkWidget, ffi::GtkWidgetClass>) @implements Accessible, Buildable, ConstraintTarget;
22
23 match fn {
24 type_ => || ffi::gtk_widget_get_type(),
25 }
26}
27
28impl Widget {
29 pub const NONE: Option<&'static Widget> = None;
30
31 #[doc(alias = "gtk_widget_get_default_direction")]
32 #[doc(alias = "get_default_direction")]
33 pub fn default_direction() -> TextDirection {
34 assert_initialized_main_thread!();
35 unsafe { from_glib(ffi::gtk_widget_get_default_direction()) }
36 }
37
38 #[doc(alias = "gtk_widget_set_default_direction")]
39 pub fn set_default_direction(dir: TextDirection) {
40 assert_initialized_main_thread!();
41 unsafe {
42 ffi::gtk_widget_set_default_direction(dir.into_glib());
43 }
44 }
45}
46
47impl std::fmt::Display for Widget {
48 #[inline]
49 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
50 f.write_str(&WidgetExt::widget_name(self))
51 }
52}
53
54pub trait WidgetExt: IsA<Widget> + 'static {
55 #[doc(alias = "gtk_widget_action_set_enabled")]
56 fn action_set_enabled(&self, action_name: &str, enabled: bool) {
57 unsafe {
58 ffi::gtk_widget_action_set_enabled(
59 self.as_ref().to_glib_none().0,
60 action_name.to_glib_none().0,
61 enabled.into_glib(),
62 );
63 }
64 }
65
66 #[doc(alias = "gtk_widget_activate")]
67 fn activate(&self) -> bool {
68 unsafe { from_glib(ffi::gtk_widget_activate(self.as_ref().to_glib_none().0)) }
69 }
70
71 #[doc(alias = "gtk_widget_activate_action_variant")]
72 #[doc(alias = "activate_action_variant")]
73 fn activate_action(
74 &self,
75 name: &str,
76 args: Option<&glib::Variant>,
77 ) -> Result<(), glib::error::BoolError> {
78 unsafe {
79 glib::result_from_gboolean!(
80 ffi::gtk_widget_activate_action_variant(
81 self.as_ref().to_glib_none().0,
82 name.to_glib_none().0,
83 args.to_glib_none().0
84 ),
85 "Action does not exist"
86 )
87 }
88 }
89
90 #[doc(alias = "gtk_widget_activate_default")]
91 fn activate_default(&self) {
92 unsafe {
93 ffi::gtk_widget_activate_default(self.as_ref().to_glib_none().0);
94 }
95 }
96
97 #[doc(alias = "gtk_widget_add_controller")]
98 fn add_controller(&self, controller: impl IsA<EventController>) {
99 unsafe {
100 ffi::gtk_widget_add_controller(
101 self.as_ref().to_glib_none().0,
102 controller.upcast().into_glib_ptr(),
103 );
104 }
105 }
106
107 #[doc(alias = "gtk_widget_add_css_class")]
108 fn add_css_class(&self, css_class: &str) {
109 unsafe {
110 ffi::gtk_widget_add_css_class(
111 self.as_ref().to_glib_none().0,
112 css_class.to_glib_none().0,
113 );
114 }
115 }
116
117 #[doc(alias = "gtk_widget_add_mnemonic_label")]
118 fn add_mnemonic_label(&self, label: &impl IsA<Widget>) {
119 unsafe {
120 ffi::gtk_widget_add_mnemonic_label(
121 self.as_ref().to_glib_none().0,
122 label.as_ref().to_glib_none().0,
123 );
124 }
125 }
126
127 #[doc(alias = "gtk_widget_allocate")]
128 fn allocate(&self, width: i32, height: i32, baseline: i32, transform: Option<gsk::Transform>) {
129 unsafe {
130 ffi::gtk_widget_allocate(
131 self.as_ref().to_glib_none().0,
132 width,
133 height,
134 baseline,
135 transform.into_glib_ptr(),
136 );
137 }
138 }
139
140 #[doc(alias = "gtk_widget_child_focus")]
141 fn child_focus(&self, direction: DirectionType) -> bool {
142 unsafe {
143 from_glib(ffi::gtk_widget_child_focus(
144 self.as_ref().to_glib_none().0,
145 direction.into_glib(),
146 ))
147 }
148 }
149
150 #[doc(alias = "gtk_widget_compute_bounds")]
151 fn compute_bounds(&self, target: &impl IsA<Widget>) -> Option<graphene::Rect> {
152 unsafe {
153 let mut out_bounds = graphene::Rect::uninitialized();
154 let ret = from_glib(ffi::gtk_widget_compute_bounds(
155 self.as_ref().to_glib_none().0,
156 target.as_ref().to_glib_none().0,
157 out_bounds.to_glib_none_mut().0,
158 ));
159 if ret {
160 Some(out_bounds)
161 } else {
162 None
163 }
164 }
165 }
166
167 #[doc(alias = "gtk_widget_compute_expand")]
168 fn compute_expand(&self, orientation: Orientation) -> bool {
169 unsafe {
170 from_glib(ffi::gtk_widget_compute_expand(
171 self.as_ref().to_glib_none().0,
172 orientation.into_glib(),
173 ))
174 }
175 }
176
177 #[doc(alias = "gtk_widget_compute_point")]
178 fn compute_point(
179 &self,
180 target: &impl IsA<Widget>,
181 point: &graphene::Point,
182 ) -> Option<graphene::Point> {
183 unsafe {
184 let mut out_point = graphene::Point::uninitialized();
185 let ret = from_glib(ffi::gtk_widget_compute_point(
186 self.as_ref().to_glib_none().0,
187 target.as_ref().to_glib_none().0,
188 point.to_glib_none().0,
189 out_point.to_glib_none_mut().0,
190 ));
191 if ret {
192 Some(out_point)
193 } else {
194 None
195 }
196 }
197 }
198
199 #[doc(alias = "gtk_widget_compute_transform")]
200 fn compute_transform(&self, target: &impl IsA<Widget>) -> Option<graphene::Matrix> {
201 unsafe {
202 let mut out_transform = graphene::Matrix::uninitialized();
203 let ret = from_glib(ffi::gtk_widget_compute_transform(
204 self.as_ref().to_glib_none().0,
205 target.as_ref().to_glib_none().0,
206 out_transform.to_glib_none_mut().0,
207 ));
208 if ret {
209 Some(out_transform)
210 } else {
211 None
212 }
213 }
214 }
215
216 #[doc(alias = "gtk_widget_contains")]
217 fn contains(&self, x: f64, y: f64) -> bool {
218 unsafe {
219 from_glib(ffi::gtk_widget_contains(
220 self.as_ref().to_glib_none().0,
221 x,
222 y,
223 ))
224 }
225 }
226
227 #[doc(alias = "gtk_widget_create_pango_context")]
228 fn create_pango_context(&self) -> pango::Context {
229 unsafe {
230 from_glib_full(ffi::gtk_widget_create_pango_context(
231 self.as_ref().to_glib_none().0,
232 ))
233 }
234 }
235
236 #[doc(alias = "gtk_widget_create_pango_layout")]
237 fn create_pango_layout(&self, text: Option<&str>) -> pango::Layout {
238 unsafe {
239 from_glib_full(ffi::gtk_widget_create_pango_layout(
240 self.as_ref().to_glib_none().0,
241 text.to_glib_none().0,
242 ))
243 }
244 }
245
246 #[doc(alias = "gtk_drag_check_threshold")]
247 fn drag_check_threshold(
248 &self,
249 start_x: i32,
250 start_y: i32,
251 current_x: i32,
252 current_y: i32,
253 ) -> bool {
254 unsafe {
255 from_glib(ffi::gtk_drag_check_threshold(
256 self.as_ref().to_glib_none().0,
257 start_x,
258 start_y,
259 current_x,
260 current_y,
261 ))
262 }
263 }
264
265 #[doc(alias = "gtk_widget_error_bell")]
266 fn error_bell(&self) {
267 unsafe {
268 ffi::gtk_widget_error_bell(self.as_ref().to_glib_none().0);
269 }
270 }
271
272 #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
273 #[allow(deprecated)]
274 #[doc(alias = "gtk_widget_get_allocated_baseline")]
275 #[doc(alias = "get_allocated_baseline")]
276 fn allocated_baseline(&self) -> i32 {
277 unsafe { ffi::gtk_widget_get_allocated_baseline(self.as_ref().to_glib_none().0) }
278 }
279
280 #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
281 #[allow(deprecated)]
282 #[doc(alias = "gtk_widget_get_allocated_height")]
283 #[doc(alias = "get_allocated_height")]
284 fn allocated_height(&self) -> i32 {
285 unsafe { ffi::gtk_widget_get_allocated_height(self.as_ref().to_glib_none().0) }
286 }
287
288 #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
289 #[allow(deprecated)]
290 #[doc(alias = "gtk_widget_get_allocated_width")]
291 #[doc(alias = "get_allocated_width")]
292 fn allocated_width(&self) -> i32 {
293 unsafe { ffi::gtk_widget_get_allocated_width(self.as_ref().to_glib_none().0) }
294 }
295
296 #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
297 #[allow(deprecated)]
298 #[doc(alias = "gtk_widget_get_allocation")]
299 #[doc(alias = "get_allocation")]
300 fn allocation(&self) -> Allocation {
301 unsafe {
302 let mut allocation = Allocation::uninitialized();
303 ffi::gtk_widget_get_allocation(
304 self.as_ref().to_glib_none().0,
305 allocation.to_glib_none_mut().0,
306 );
307 allocation
308 }
309 }
310
311 #[doc(alias = "gtk_widget_get_ancestor")]
312 #[doc(alias = "get_ancestor")]
313 #[must_use]
314 fn ancestor(&self, widget_type: glib::types::Type) -> Option<Widget> {
315 unsafe {
316 from_glib_none(ffi::gtk_widget_get_ancestor(
317 self.as_ref().to_glib_none().0,
318 widget_type.into_glib(),
319 ))
320 }
321 }
322
323 #[cfg(feature = "v4_12")]
324 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
325 #[doc(alias = "gtk_widget_get_baseline")]
326 #[doc(alias = "get_baseline")]
327 fn baseline(&self) -> i32 {
328 unsafe { ffi::gtk_widget_get_baseline(self.as_ref().to_glib_none().0) }
329 }
330
331 #[doc(alias = "gtk_widget_get_can_focus")]
332 #[doc(alias = "get_can_focus")]
333 #[doc(alias = "can-focus")]
334 fn can_focus(&self) -> bool {
335 unsafe {
336 from_glib(ffi::gtk_widget_get_can_focus(
337 self.as_ref().to_glib_none().0,
338 ))
339 }
340 }
341
342 #[doc(alias = "gtk_widget_get_can_target")]
343 #[doc(alias = "get_can_target")]
344 #[doc(alias = "can-target")]
345 fn can_target(&self) -> bool {
346 unsafe {
347 from_glib(ffi::gtk_widget_get_can_target(
348 self.as_ref().to_glib_none().0,
349 ))
350 }
351 }
352
353 #[doc(alias = "gtk_widget_get_child_visible")]
354 #[doc(alias = "get_child_visible")]
355 fn is_child_visible(&self) -> bool {
356 unsafe {
357 from_glib(ffi::gtk_widget_get_child_visible(
358 self.as_ref().to_glib_none().0,
359 ))
360 }
361 }
362
363 #[doc(alias = "gtk_widget_get_clipboard")]
364 #[doc(alias = "get_clipboard")]
365 fn clipboard(&self) -> gdk::Clipboard {
366 unsafe {
367 from_glib_none(ffi::gtk_widget_get_clipboard(
368 self.as_ref().to_glib_none().0,
369 ))
370 }
371 }
372
373 #[cfg(feature = "v4_10")]
374 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
375 #[doc(alias = "gtk_widget_get_color")]
376 #[doc(alias = "get_color")]
377 fn color(&self) -> gdk::RGBA {
378 unsafe {
379 let mut color = gdk::RGBA::uninitialized();
380 ffi::gtk_widget_get_color(self.as_ref().to_glib_none().0, color.to_glib_none_mut().0);
381 color
382 }
383 }
384
385 #[doc(alias = "gtk_widget_get_css_classes")]
386 #[doc(alias = "get_css_classes")]
387 #[doc(alias = "css-classes")]
388 fn css_classes(&self) -> Vec<glib::GString> {
389 unsafe {
390 FromGlibPtrContainer::from_glib_full(ffi::gtk_widget_get_css_classes(
391 self.as_ref().to_glib_none().0,
392 ))
393 }
394 }
395
396 #[doc(alias = "gtk_widget_get_css_name")]
397 #[doc(alias = "get_css_name")]
398 #[doc(alias = "css-name")]
399 fn css_name(&self) -> glib::GString {
400 unsafe { from_glib_none(ffi::gtk_widget_get_css_name(self.as_ref().to_glib_none().0)) }
401 }
402
403 #[doc(alias = "gtk_widget_get_cursor")]
404 #[doc(alias = "get_cursor")]
405 fn cursor(&self) -> Option<gdk::Cursor> {
406 unsafe { from_glib_none(ffi::gtk_widget_get_cursor(self.as_ref().to_glib_none().0)) }
407 }
408
409 #[doc(alias = "gtk_widget_get_direction")]
410 #[doc(alias = "get_direction")]
411 fn direction(&self) -> TextDirection {
412 unsafe {
413 from_glib(ffi::gtk_widget_get_direction(
414 self.as_ref().to_glib_none().0,
415 ))
416 }
417 }
418
419 #[doc(alias = "gtk_widget_get_display")]
420 #[doc(alias = "get_display")]
421 fn display(&self) -> gdk::Display {
422 unsafe { from_glib_none(ffi::gtk_widget_get_display(self.as_ref().to_glib_none().0)) }
423 }
424
425 #[doc(alias = "gtk_widget_get_first_child")]
426 #[doc(alias = "get_first_child")]
427 #[must_use]
428 fn first_child(&self) -> Option<Widget> {
429 unsafe {
430 from_glib_none(ffi::gtk_widget_get_first_child(
431 self.as_ref().to_glib_none().0,
432 ))
433 }
434 }
435
436 #[doc(alias = "gtk_widget_get_focus_child")]
437 #[doc(alias = "get_focus_child")]
438 #[must_use]
439 fn focus_child(&self) -> Option<Widget> {
440 unsafe {
441 from_glib_none(ffi::gtk_widget_get_focus_child(
442 self.as_ref().to_glib_none().0,
443 ))
444 }
445 }
446
447 #[doc(alias = "gtk_widget_get_focus_on_click")]
448 #[doc(alias = "get_focus_on_click")]
449 #[doc(alias = "focus-on-click")]
450 fn gets_focus_on_click(&self) -> bool {
451 unsafe {
452 from_glib(ffi::gtk_widget_get_focus_on_click(
453 self.as_ref().to_glib_none().0,
454 ))
455 }
456 }
457
458 #[doc(alias = "gtk_widget_get_focusable")]
459 #[doc(alias = "get_focusable")]
460 #[doc(alias = "focusable")]
461 fn is_focusable(&self) -> bool {
462 unsafe {
463 from_glib(ffi::gtk_widget_get_focusable(
464 self.as_ref().to_glib_none().0,
465 ))
466 }
467 }
468
469 #[doc(alias = "gtk_widget_get_font_map")]
470 #[doc(alias = "get_font_map")]
471 fn font_map(&self) -> Option<pango::FontMap> {
472 unsafe { from_glib_none(ffi::gtk_widget_get_font_map(self.as_ref().to_glib_none().0)) }
473 }
474
475 #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")]
476 #[allow(deprecated)]
477 #[doc(alias = "gtk_widget_get_font_options")]
478 #[doc(alias = "get_font_options")]
479 fn font_options(&self) -> Option<cairo::FontOptions> {
480 unsafe {
481 from_glib_none(ffi::gtk_widget_get_font_options(
482 self.as_ref().to_glib_none().0,
483 ))
484 }
485 }
486
487 #[doc(alias = "gtk_widget_get_frame_clock")]
488 #[doc(alias = "get_frame_clock")]
489 fn frame_clock(&self) -> Option<gdk::FrameClock> {
490 unsafe {
491 from_glib_none(ffi::gtk_widget_get_frame_clock(
492 self.as_ref().to_glib_none().0,
493 ))
494 }
495 }
496
497 #[doc(alias = "gtk_widget_get_halign")]
498 #[doc(alias = "get_halign")]
499 fn halign(&self) -> Align {
500 unsafe { from_glib(ffi::gtk_widget_get_halign(self.as_ref().to_glib_none().0)) }
501 }
502
503 #[doc(alias = "gtk_widget_get_has_tooltip")]
504 #[doc(alias = "get_has_tooltip")]
505 #[doc(alias = "has-tooltip")]
506 fn has_tooltip(&self) -> bool {
507 unsafe {
508 from_glib(ffi::gtk_widget_get_has_tooltip(
509 self.as_ref().to_glib_none().0,
510 ))
511 }
512 }
513
514 #[doc(alias = "gtk_widget_get_height")]
515 #[doc(alias = "get_height")]
516 fn height(&self) -> i32 {
517 unsafe { ffi::gtk_widget_get_height(self.as_ref().to_glib_none().0) }
518 }
519
520 #[doc(alias = "gtk_widget_get_hexpand")]
521 #[doc(alias = "get_hexpand")]
522 #[doc(alias = "hexpand")]
523 fn hexpands(&self) -> bool {
524 unsafe { from_glib(ffi::gtk_widget_get_hexpand(self.as_ref().to_glib_none().0)) }
525 }
526
527 #[doc(alias = "gtk_widget_get_hexpand_set")]
528 #[doc(alias = "get_hexpand_set")]
529 #[doc(alias = "hexpand-set")]
530 fn is_hexpand_set(&self) -> bool {
531 unsafe {
532 from_glib(ffi::gtk_widget_get_hexpand_set(
533 self.as_ref().to_glib_none().0,
534 ))
535 }
536 }
537
538 #[doc(alias = "gtk_widget_get_last_child")]
539 #[doc(alias = "get_last_child")]
540 #[must_use]
541 fn last_child(&self) -> Option<Widget> {
542 unsafe {
543 from_glib_none(ffi::gtk_widget_get_last_child(
544 self.as_ref().to_glib_none().0,
545 ))
546 }
547 }
548
549 #[doc(alias = "gtk_widget_get_layout_manager")]
550 #[doc(alias = "get_layout_manager")]
551 #[doc(alias = "layout-manager")]
552 fn layout_manager(&self) -> Option<LayoutManager> {
553 unsafe {
554 from_glib_none(ffi::gtk_widget_get_layout_manager(
555 self.as_ref().to_glib_none().0,
556 ))
557 }
558 }
559
560 #[cfg(feature = "v4_18")]
561 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
562 #[doc(alias = "gtk_widget_get_limit_events")]
563 #[doc(alias = "get_limit_events")]
564 #[doc(alias = "limit-events")]
565 fn is_limit_events(&self) -> bool {
566 unsafe {
567 from_glib(ffi::gtk_widget_get_limit_events(
568 self.as_ref().to_glib_none().0,
569 ))
570 }
571 }
572
573 #[doc(alias = "gtk_widget_get_mapped")]
574 #[doc(alias = "get_mapped")]
575 fn is_mapped(&self) -> bool {
576 unsafe { from_glib(ffi::gtk_widget_get_mapped(self.as_ref().to_glib_none().0)) }
577 }
578
579 #[doc(alias = "gtk_widget_get_margin_bottom")]
580 #[doc(alias = "get_margin_bottom")]
581 #[doc(alias = "margin-bottom")]
582 fn margin_bottom(&self) -> i32 {
583 unsafe { ffi::gtk_widget_get_margin_bottom(self.as_ref().to_glib_none().0) }
584 }
585
586 #[doc(alias = "gtk_widget_get_margin_end")]
587 #[doc(alias = "get_margin_end")]
588 #[doc(alias = "margin-end")]
589 fn margin_end(&self) -> i32 {
590 unsafe { ffi::gtk_widget_get_margin_end(self.as_ref().to_glib_none().0) }
591 }
592
593 #[doc(alias = "gtk_widget_get_margin_start")]
594 #[doc(alias = "get_margin_start")]
595 #[doc(alias = "margin-start")]
596 fn margin_start(&self) -> i32 {
597 unsafe { ffi::gtk_widget_get_margin_start(self.as_ref().to_glib_none().0) }
598 }
599
600 #[doc(alias = "gtk_widget_get_margin_top")]
601 #[doc(alias = "get_margin_top")]
602 #[doc(alias = "margin-top")]
603 fn margin_top(&self) -> i32 {
604 unsafe { ffi::gtk_widget_get_margin_top(self.as_ref().to_glib_none().0) }
605 }
606
607 #[doc(alias = "gtk_widget_get_name")]
608 #[doc(alias = "get_name")]
609 #[doc(alias = "name")]
610 fn widget_name(&self) -> glib::GString {
611 unsafe { from_glib_none(ffi::gtk_widget_get_name(self.as_ref().to_glib_none().0)) }
612 }
613
614 #[doc(alias = "gtk_widget_get_native")]
615 #[doc(alias = "get_native")]
616 fn native(&self) -> Option<Native> {
617 unsafe { from_glib_none(ffi::gtk_widget_get_native(self.as_ref().to_glib_none().0)) }
618 }
619
620 #[doc(alias = "gtk_widget_get_next_sibling")]
621 #[doc(alias = "get_next_sibling")]
622 #[must_use]
623 fn next_sibling(&self) -> Option<Widget> {
624 unsafe {
625 from_glib_none(ffi::gtk_widget_get_next_sibling(
626 self.as_ref().to_glib_none().0,
627 ))
628 }
629 }
630
631 #[doc(alias = "gtk_widget_get_opacity")]
632 #[doc(alias = "get_opacity")]
633 fn opacity(&self) -> f64 {
634 unsafe { ffi::gtk_widget_get_opacity(self.as_ref().to_glib_none().0) }
635 }
636
637 #[doc(alias = "gtk_widget_get_overflow")]
638 #[doc(alias = "get_overflow")]
639 fn overflow(&self) -> Overflow {
640 unsafe { from_glib(ffi::gtk_widget_get_overflow(self.as_ref().to_glib_none().0)) }
641 }
642
643 #[doc(alias = "gtk_widget_get_pango_context")]
644 #[doc(alias = "get_pango_context")]
645 fn pango_context(&self) -> pango::Context {
646 unsafe {
647 from_glib_none(ffi::gtk_widget_get_pango_context(
648 self.as_ref().to_glib_none().0,
649 ))
650 }
651 }
652
653 #[doc(alias = "gtk_widget_get_parent")]
654 #[doc(alias = "get_parent")]
655 #[must_use]
656 fn parent(&self) -> Option<Widget> {
657 unsafe { from_glib_none(ffi::gtk_widget_get_parent(self.as_ref().to_glib_none().0)) }
658 }
659
660 #[doc(alias = "gtk_widget_get_preferred_size")]
661 #[doc(alias = "get_preferred_size")]
662 fn preferred_size(&self) -> (Requisition, Requisition) {
663 unsafe {
664 let mut minimum_size = Requisition::uninitialized();
665 let mut natural_size = Requisition::uninitialized();
666 ffi::gtk_widget_get_preferred_size(
667 self.as_ref().to_glib_none().0,
668 minimum_size.to_glib_none_mut().0,
669 natural_size.to_glib_none_mut().0,
670 );
671 (minimum_size, natural_size)
672 }
673 }
674
675 #[doc(alias = "gtk_widget_get_prev_sibling")]
676 #[doc(alias = "get_prev_sibling")]
677 #[must_use]
678 fn prev_sibling(&self) -> Option<Widget> {
679 unsafe {
680 from_glib_none(ffi::gtk_widget_get_prev_sibling(
681 self.as_ref().to_glib_none().0,
682 ))
683 }
684 }
685
686 #[doc(alias = "gtk_widget_get_primary_clipboard")]
687 #[doc(alias = "get_primary_clipboard")]
688 fn primary_clipboard(&self) -> gdk::Clipboard {
689 unsafe {
690 from_glib_none(ffi::gtk_widget_get_primary_clipboard(
691 self.as_ref().to_glib_none().0,
692 ))
693 }
694 }
695
696 #[doc(alias = "gtk_widget_get_realized")]
697 #[doc(alias = "get_realized")]
698 fn is_realized(&self) -> bool {
699 unsafe { from_glib(ffi::gtk_widget_get_realized(self.as_ref().to_glib_none().0)) }
700 }
701
702 #[doc(alias = "gtk_widget_get_receives_default")]
703 #[doc(alias = "get_receives_default")]
704 #[doc(alias = "receives-default")]
705 fn receives_default(&self) -> bool {
706 unsafe {
707 from_glib(ffi::gtk_widget_get_receives_default(
708 self.as_ref().to_glib_none().0,
709 ))
710 }
711 }
712
713 #[doc(alias = "gtk_widget_get_request_mode")]
714 #[doc(alias = "get_request_mode")]
715 fn request_mode(&self) -> SizeRequestMode {
716 unsafe {
717 from_glib(ffi::gtk_widget_get_request_mode(
718 self.as_ref().to_glib_none().0,
719 ))
720 }
721 }
722
723 #[doc(alias = "gtk_widget_get_root")]
724 #[doc(alias = "get_root")]
725 fn root(&self) -> Option<Root> {
726 unsafe { from_glib_none(ffi::gtk_widget_get_root(self.as_ref().to_glib_none().0)) }
727 }
728
729 #[doc(alias = "gtk_widget_get_scale_factor")]
730 #[doc(alias = "get_scale_factor")]
731 #[doc(alias = "scale-factor")]
732 fn scale_factor(&self) -> i32 {
733 unsafe { ffi::gtk_widget_get_scale_factor(self.as_ref().to_glib_none().0) }
734 }
735
736 #[doc(alias = "gtk_widget_get_sensitive")]
737 #[doc(alias = "sensitive")]
738 fn get_sensitive(&self) -> bool {
739 unsafe {
740 from_glib(ffi::gtk_widget_get_sensitive(
741 self.as_ref().to_glib_none().0,
742 ))
743 }
744 }
745
746 #[doc(alias = "gtk_widget_get_settings")]
747 #[doc(alias = "get_settings")]
748 fn settings(&self) -> Settings {
749 unsafe { from_glib_none(ffi::gtk_widget_get_settings(self.as_ref().to_glib_none().0)) }
750 }
751
752 #[doc(alias = "gtk_widget_get_size")]
753 #[doc(alias = "get_size")]
754 fn size(&self, orientation: Orientation) -> i32 {
755 unsafe { ffi::gtk_widget_get_size(self.as_ref().to_glib_none().0, orientation.into_glib()) }
756 }
757
758 #[doc(alias = "gtk_widget_get_size_request")]
759 #[doc(alias = "get_size_request")]
760 fn size_request(&self) -> (i32, i32) {
761 unsafe {
762 let mut width = std::mem::MaybeUninit::uninit();
763 let mut height = std::mem::MaybeUninit::uninit();
764 ffi::gtk_widget_get_size_request(
765 self.as_ref().to_glib_none().0,
766 width.as_mut_ptr(),
767 height.as_mut_ptr(),
768 );
769 (width.assume_init(), height.assume_init())
770 }
771 }
772
773 #[doc(alias = "gtk_widget_get_state_flags")]
774 #[doc(alias = "get_state_flags")]
775 fn state_flags(&self) -> StateFlags {
776 unsafe {
777 from_glib(ffi::gtk_widget_get_state_flags(
778 self.as_ref().to_glib_none().0,
779 ))
780 }
781 }
782
783 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
784 #[allow(deprecated)]
785 #[doc(alias = "gtk_widget_get_style_context")]
786 #[doc(alias = "get_style_context")]
787 fn style_context(&self) -> StyleContext {
788 unsafe {
789 from_glib_none(ffi::gtk_widget_get_style_context(
790 self.as_ref().to_glib_none().0,
791 ))
792 }
793 }
794
795 #[doc(alias = "gtk_widget_get_tooltip_markup")]
796 #[doc(alias = "get_tooltip_markup")]
797 #[doc(alias = "tooltip-markup")]
798 fn tooltip_markup(&self) -> Option<glib::GString> {
799 unsafe {
800 from_glib_none(ffi::gtk_widget_get_tooltip_markup(
801 self.as_ref().to_glib_none().0,
802 ))
803 }
804 }
805
806 #[doc(alias = "gtk_widget_get_tooltip_text")]
807 #[doc(alias = "get_tooltip_text")]
808 #[doc(alias = "tooltip-text")]
809 fn tooltip_text(&self) -> Option<glib::GString> {
810 unsafe {
811 from_glib_none(ffi::gtk_widget_get_tooltip_text(
812 self.as_ref().to_glib_none().0,
813 ))
814 }
815 }
816
817 #[doc(alias = "gtk_widget_get_valign")]
818 #[doc(alias = "get_valign")]
819 fn valign(&self) -> Align {
820 unsafe { from_glib(ffi::gtk_widget_get_valign(self.as_ref().to_glib_none().0)) }
821 }
822
823 #[doc(alias = "gtk_widget_get_vexpand")]
824 #[doc(alias = "get_vexpand")]
825 #[doc(alias = "vexpand")]
826 fn vexpands(&self) -> bool {
827 unsafe { from_glib(ffi::gtk_widget_get_vexpand(self.as_ref().to_glib_none().0)) }
828 }
829
830 #[doc(alias = "gtk_widget_get_vexpand_set")]
831 #[doc(alias = "get_vexpand_set")]
832 #[doc(alias = "vexpand-set")]
833 fn is_vexpand_set(&self) -> bool {
834 unsafe {
835 from_glib(ffi::gtk_widget_get_vexpand_set(
836 self.as_ref().to_glib_none().0,
837 ))
838 }
839 }
840
841 #[doc(alias = "gtk_widget_get_visible")]
842 #[doc(alias = "visible")]
843 fn get_visible(&self) -> bool {
844 unsafe { from_glib(ffi::gtk_widget_get_visible(self.as_ref().to_glib_none().0)) }
845 }
846
847 #[doc(alias = "gtk_widget_get_width")]
848 #[doc(alias = "get_width")]
849 fn width(&self) -> i32 {
850 unsafe { ffi::gtk_widget_get_width(self.as_ref().to_glib_none().0) }
851 }
852
853 #[doc(alias = "gtk_widget_grab_focus")]
854 fn grab_focus(&self) -> bool {
855 unsafe { from_glib(ffi::gtk_widget_grab_focus(self.as_ref().to_glib_none().0)) }
856 }
857
858 #[doc(alias = "gtk_widget_has_css_class")]
859 fn has_css_class(&self, css_class: &str) -> bool {
860 unsafe {
861 from_glib(ffi::gtk_widget_has_css_class(
862 self.as_ref().to_glib_none().0,
863 css_class.to_glib_none().0,
864 ))
865 }
866 }
867
868 #[doc(alias = "gtk_widget_has_default")]
869 #[doc(alias = "has-default")]
870 fn has_default(&self) -> bool {
871 unsafe { from_glib(ffi::gtk_widget_has_default(self.as_ref().to_glib_none().0)) }
872 }
873
874 #[doc(alias = "gtk_widget_has_focus")]
875 #[doc(alias = "has-focus")]
876 fn has_focus(&self) -> bool {
877 unsafe { from_glib(ffi::gtk_widget_has_focus(self.as_ref().to_glib_none().0)) }
878 }
879
880 #[doc(alias = "gtk_widget_has_visible_focus")]
881 fn has_visible_focus(&self) -> bool {
882 unsafe {
883 from_glib(ffi::gtk_widget_has_visible_focus(
884 self.as_ref().to_glib_none().0,
885 ))
886 }
887 }
888
889 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
890 #[allow(deprecated)]
891 #[doc(alias = "gtk_widget_hide")]
892 fn hide(&self) {
893 unsafe {
894 ffi::gtk_widget_hide(self.as_ref().to_glib_none().0);
895 }
896 }
897
898 #[doc(alias = "gtk_widget_in_destruction")]
899 fn in_destruction(&self) -> bool {
900 unsafe {
901 from_glib(ffi::gtk_widget_in_destruction(
902 self.as_ref().to_glib_none().0,
903 ))
904 }
905 }
906
907 #[doc(alias = "gtk_widget_insert_action_group")]
908 fn insert_action_group(&self, name: &str, group: Option<&impl IsA<gio::ActionGroup>>) {
909 unsafe {
910 ffi::gtk_widget_insert_action_group(
911 self.as_ref().to_glib_none().0,
912 name.to_glib_none().0,
913 group.map(|p| p.as_ref()).to_glib_none().0,
914 );
915 }
916 }
917
918 #[doc(alias = "gtk_widget_insert_after")]
919 fn insert_after(&self, parent: &impl IsA<Widget>, previous_sibling: Option<&impl IsA<Widget>>) {
920 unsafe {
921 ffi::gtk_widget_insert_after(
922 self.as_ref().to_glib_none().0,
923 parent.as_ref().to_glib_none().0,
924 previous_sibling.map(|p| p.as_ref()).to_glib_none().0,
925 );
926 }
927 }
928
929 #[doc(alias = "gtk_widget_insert_before")]
930 fn insert_before(&self, parent: &impl IsA<Widget>, next_sibling: Option<&impl IsA<Widget>>) {
931 unsafe {
932 ffi::gtk_widget_insert_before(
933 self.as_ref().to_glib_none().0,
934 parent.as_ref().to_glib_none().0,
935 next_sibling.map(|p| p.as_ref()).to_glib_none().0,
936 );
937 }
938 }
939
940 #[doc(alias = "gtk_widget_is_ancestor")]
941 fn is_ancestor(&self, ancestor: &impl IsA<Widget>) -> bool {
942 unsafe {
943 from_glib(ffi::gtk_widget_is_ancestor(
944 self.as_ref().to_glib_none().0,
945 ancestor.as_ref().to_glib_none().0,
946 ))
947 }
948 }
949
950 #[doc(alias = "gtk_widget_is_drawable")]
951 fn is_drawable(&self) -> bool {
952 unsafe { from_glib(ffi::gtk_widget_is_drawable(self.as_ref().to_glib_none().0)) }
953 }
954
955 #[doc(alias = "gtk_widget_is_focus")]
956 fn is_focus(&self) -> bool {
957 unsafe { from_glib(ffi::gtk_widget_is_focus(self.as_ref().to_glib_none().0)) }
958 }
959
960 #[doc(alias = "gtk_widget_is_sensitive")]
961 fn is_sensitive(&self) -> bool {
962 unsafe { from_glib(ffi::gtk_widget_is_sensitive(self.as_ref().to_glib_none().0)) }
963 }
964
965 #[doc(alias = "gtk_widget_is_visible")]
966 fn is_visible(&self) -> bool {
967 unsafe { from_glib(ffi::gtk_widget_is_visible(self.as_ref().to_glib_none().0)) }
968 }
969
970 #[doc(alias = "gtk_widget_keynav_failed")]
971 fn keynav_failed(&self, direction: DirectionType) -> bool {
972 unsafe {
973 from_glib(ffi::gtk_widget_keynav_failed(
974 self.as_ref().to_glib_none().0,
975 direction.into_glib(),
976 ))
977 }
978 }
979
980 #[doc(alias = "gtk_widget_list_mnemonic_labels")]
981 fn list_mnemonic_labels(&self) -> Vec<Widget> {
982 unsafe {
983 FromGlibPtrContainer::from_glib_container(ffi::gtk_widget_list_mnemonic_labels(
984 self.as_ref().to_glib_none().0,
985 ))
986 }
987 }
988
989 #[doc(alias = "gtk_widget_map")]
990 fn map(&self) {
991 unsafe {
992 ffi::gtk_widget_map(self.as_ref().to_glib_none().0);
993 }
994 }
995
996 #[doc(alias = "gtk_widget_measure")]
997 fn measure(&self, orientation: Orientation, for_size: i32) -> (i32, i32, i32, i32) {
998 unsafe {
999 let mut minimum = std::mem::MaybeUninit::uninit();
1000 let mut natural = std::mem::MaybeUninit::uninit();
1001 let mut minimum_baseline = std::mem::MaybeUninit::uninit();
1002 let mut natural_baseline = std::mem::MaybeUninit::uninit();
1003 ffi::gtk_widget_measure(
1004 self.as_ref().to_glib_none().0,
1005 orientation.into_glib(),
1006 for_size,
1007 minimum.as_mut_ptr(),
1008 natural.as_mut_ptr(),
1009 minimum_baseline.as_mut_ptr(),
1010 natural_baseline.as_mut_ptr(),
1011 );
1012 (
1013 minimum.assume_init(),
1014 natural.assume_init(),
1015 minimum_baseline.assume_init(),
1016 natural_baseline.assume_init(),
1017 )
1018 }
1019 }
1020
1021 #[doc(alias = "gtk_widget_mnemonic_activate")]
1022 fn mnemonic_activate(&self, group_cycling: bool) -> bool {
1023 unsafe {
1024 from_glib(ffi::gtk_widget_mnemonic_activate(
1025 self.as_ref().to_glib_none().0,
1026 group_cycling.into_glib(),
1027 ))
1028 }
1029 }
1030
1031 #[doc(alias = "gtk_widget_observe_children")]
1032 fn observe_children(&self) -> gio::ListModel {
1033 unsafe {
1034 from_glib_full(ffi::gtk_widget_observe_children(
1035 self.as_ref().to_glib_none().0,
1036 ))
1037 }
1038 }
1039
1040 #[doc(alias = "gtk_widget_observe_controllers")]
1041 fn observe_controllers(&self) -> gio::ListModel {
1042 unsafe {
1043 from_glib_full(ffi::gtk_widget_observe_controllers(
1044 self.as_ref().to_glib_none().0,
1045 ))
1046 }
1047 }
1048
1049 #[doc(alias = "gtk_widget_pick")]
1050 #[must_use]
1051 fn pick(&self, x: f64, y: f64, flags: PickFlags) -> Option<Widget> {
1052 unsafe {
1053 from_glib_none(ffi::gtk_widget_pick(
1054 self.as_ref().to_glib_none().0,
1055 x,
1056 y,
1057 flags.into_glib(),
1058 ))
1059 }
1060 }
1061
1062 #[doc(alias = "gtk_widget_queue_allocate")]
1063 fn queue_allocate(&self) {
1064 unsafe {
1065 ffi::gtk_widget_queue_allocate(self.as_ref().to_glib_none().0);
1066 }
1067 }
1068
1069 #[doc(alias = "gtk_widget_queue_draw")]
1070 fn queue_draw(&self) {
1071 unsafe {
1072 ffi::gtk_widget_queue_draw(self.as_ref().to_glib_none().0);
1073 }
1074 }
1075
1076 #[doc(alias = "gtk_widget_queue_resize")]
1077 fn queue_resize(&self) {
1078 unsafe {
1079 ffi::gtk_widget_queue_resize(self.as_ref().to_glib_none().0);
1080 }
1081 }
1082
1083 #[doc(alias = "gtk_widget_realize")]
1084 fn realize(&self) {
1085 unsafe {
1086 ffi::gtk_widget_realize(self.as_ref().to_glib_none().0);
1087 }
1088 }
1089
1090 #[doc(alias = "gtk_widget_remove_controller")]
1091 fn remove_controller(&self, controller: &impl IsA<EventController>) {
1092 unsafe {
1093 ffi::gtk_widget_remove_controller(
1094 self.as_ref().to_glib_none().0,
1095 controller.as_ref().to_glib_none().0,
1096 );
1097 }
1098 }
1099
1100 #[doc(alias = "gtk_widget_remove_css_class")]
1101 fn remove_css_class(&self, css_class: &str) {
1102 unsafe {
1103 ffi::gtk_widget_remove_css_class(
1104 self.as_ref().to_glib_none().0,
1105 css_class.to_glib_none().0,
1106 );
1107 }
1108 }
1109
1110 #[doc(alias = "gtk_widget_remove_mnemonic_label")]
1111 fn remove_mnemonic_label(&self, label: &impl IsA<Widget>) {
1112 unsafe {
1113 ffi::gtk_widget_remove_mnemonic_label(
1114 self.as_ref().to_glib_none().0,
1115 label.as_ref().to_glib_none().0,
1116 );
1117 }
1118 }
1119
1120 #[doc(alias = "gtk_widget_set_can_focus")]
1121 #[doc(alias = "can-focus")]
1122 fn set_can_focus(&self, can_focus: bool) {
1123 unsafe {
1124 ffi::gtk_widget_set_can_focus(self.as_ref().to_glib_none().0, can_focus.into_glib());
1125 }
1126 }
1127
1128 #[doc(alias = "gtk_widget_set_can_target")]
1129 #[doc(alias = "can-target")]
1130 fn set_can_target(&self, can_target: bool) {
1131 unsafe {
1132 ffi::gtk_widget_set_can_target(self.as_ref().to_glib_none().0, can_target.into_glib());
1133 }
1134 }
1135
1136 #[doc(alias = "gtk_widget_set_child_visible")]
1137 fn set_child_visible(&self, child_visible: bool) {
1138 unsafe {
1139 ffi::gtk_widget_set_child_visible(
1140 self.as_ref().to_glib_none().0,
1141 child_visible.into_glib(),
1142 );
1143 }
1144 }
1145
1146 #[doc(alias = "gtk_widget_set_css_classes")]
1147 #[doc(alias = "css-classes")]
1148 fn set_css_classes(&self, classes: &[&str]) {
1149 unsafe {
1150 ffi::gtk_widget_set_css_classes(
1151 self.as_ref().to_glib_none().0,
1152 classes.to_glib_none().0,
1153 );
1154 }
1155 }
1156
1157 #[doc(alias = "gtk_widget_set_cursor")]
1158 #[doc(alias = "cursor")]
1159 fn set_cursor(&self, cursor: Option<&gdk::Cursor>) {
1160 unsafe {
1161 ffi::gtk_widget_set_cursor(self.as_ref().to_glib_none().0, cursor.to_glib_none().0);
1162 }
1163 }
1164
1165 #[doc(alias = "gtk_widget_set_cursor_from_name")]
1166 fn set_cursor_from_name(&self, name: Option<&str>) {
1167 unsafe {
1168 ffi::gtk_widget_set_cursor_from_name(
1169 self.as_ref().to_glib_none().0,
1170 name.to_glib_none().0,
1171 );
1172 }
1173 }
1174
1175 #[doc(alias = "gtk_widget_set_direction")]
1176 fn set_direction(&self, dir: TextDirection) {
1177 unsafe {
1178 ffi::gtk_widget_set_direction(self.as_ref().to_glib_none().0, dir.into_glib());
1179 }
1180 }
1181
1182 #[doc(alias = "gtk_widget_set_focus_child")]
1183 fn set_focus_child(&self, child: Option<&impl IsA<Widget>>) {
1184 unsafe {
1185 ffi::gtk_widget_set_focus_child(
1186 self.as_ref().to_glib_none().0,
1187 child.map(|p| p.as_ref()).to_glib_none().0,
1188 );
1189 }
1190 }
1191
1192 #[doc(alias = "gtk_widget_set_focus_on_click")]
1193 #[doc(alias = "focus-on-click")]
1194 fn set_focus_on_click(&self, focus_on_click: bool) {
1195 unsafe {
1196 ffi::gtk_widget_set_focus_on_click(
1197 self.as_ref().to_glib_none().0,
1198 focus_on_click.into_glib(),
1199 );
1200 }
1201 }
1202
1203 #[doc(alias = "gtk_widget_set_focusable")]
1204 #[doc(alias = "focusable")]
1205 fn set_focusable(&self, focusable: bool) {
1206 unsafe {
1207 ffi::gtk_widget_set_focusable(self.as_ref().to_glib_none().0, focusable.into_glib());
1208 }
1209 }
1210
1211 #[doc(alias = "gtk_widget_set_font_map")]
1212 fn set_font_map(&self, font_map: Option<&impl IsA<pango::FontMap>>) {
1213 unsafe {
1214 ffi::gtk_widget_set_font_map(
1215 self.as_ref().to_glib_none().0,
1216 font_map.map(|p| p.as_ref()).to_glib_none().0,
1217 );
1218 }
1219 }
1220
1221 #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")]
1222 #[allow(deprecated)]
1223 #[doc(alias = "gtk_widget_set_font_options")]
1224 fn set_font_options(&self, options: Option<&cairo::FontOptions>) {
1225 unsafe {
1226 ffi::gtk_widget_set_font_options(
1227 self.as_ref().to_glib_none().0,
1228 options.to_glib_none().0,
1229 );
1230 }
1231 }
1232
1233 #[doc(alias = "gtk_widget_set_halign")]
1234 #[doc(alias = "halign")]
1235 fn set_halign(&self, align: Align) {
1236 unsafe {
1237 ffi::gtk_widget_set_halign(self.as_ref().to_glib_none().0, align.into_glib());
1238 }
1239 }
1240
1241 #[doc(alias = "gtk_widget_set_has_tooltip")]
1242 #[doc(alias = "has-tooltip")]
1243 fn set_has_tooltip(&self, has_tooltip: bool) {
1244 unsafe {
1245 ffi::gtk_widget_set_has_tooltip(
1246 self.as_ref().to_glib_none().0,
1247 has_tooltip.into_glib(),
1248 );
1249 }
1250 }
1251
1252 #[doc(alias = "gtk_widget_set_hexpand")]
1253 #[doc(alias = "hexpand")]
1254 fn set_hexpand(&self, expand: bool) {
1255 unsafe {
1256 ffi::gtk_widget_set_hexpand(self.as_ref().to_glib_none().0, expand.into_glib());
1257 }
1258 }
1259
1260 #[doc(alias = "gtk_widget_set_hexpand_set")]
1261 #[doc(alias = "hexpand-set")]
1262 fn set_hexpand_set(&self, set: bool) {
1263 unsafe {
1264 ffi::gtk_widget_set_hexpand_set(self.as_ref().to_glib_none().0, set.into_glib());
1265 }
1266 }
1267
1268 #[doc(alias = "gtk_widget_set_layout_manager")]
1269 #[doc(alias = "layout-manager")]
1270 fn set_layout_manager(&self, layout_manager: Option<impl IsA<LayoutManager>>) {
1271 unsafe {
1272 ffi::gtk_widget_set_layout_manager(
1273 self.as_ref().to_glib_none().0,
1274 layout_manager.map(|p| p.upcast()).into_glib_ptr(),
1275 );
1276 }
1277 }
1278
1279 #[cfg(feature = "v4_18")]
1280 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1281 #[doc(alias = "gtk_widget_set_limit_events")]
1282 #[doc(alias = "limit-events")]
1283 fn set_limit_events(&self, limit_events: bool) {
1284 unsafe {
1285 ffi::gtk_widget_set_limit_events(
1286 self.as_ref().to_glib_none().0,
1287 limit_events.into_glib(),
1288 );
1289 }
1290 }
1291
1292 #[doc(alias = "gtk_widget_set_margin_bottom")]
1293 #[doc(alias = "margin-bottom")]
1294 fn set_margin_bottom(&self, margin: i32) {
1295 unsafe {
1296 ffi::gtk_widget_set_margin_bottom(self.as_ref().to_glib_none().0, margin);
1297 }
1298 }
1299
1300 #[doc(alias = "gtk_widget_set_margin_end")]
1301 #[doc(alias = "margin-end")]
1302 fn set_margin_end(&self, margin: i32) {
1303 unsafe {
1304 ffi::gtk_widget_set_margin_end(self.as_ref().to_glib_none().0, margin);
1305 }
1306 }
1307
1308 #[doc(alias = "gtk_widget_set_margin_start")]
1309 #[doc(alias = "margin-start")]
1310 fn set_margin_start(&self, margin: i32) {
1311 unsafe {
1312 ffi::gtk_widget_set_margin_start(self.as_ref().to_glib_none().0, margin);
1313 }
1314 }
1315
1316 #[doc(alias = "gtk_widget_set_margin_top")]
1317 #[doc(alias = "margin-top")]
1318 fn set_margin_top(&self, margin: i32) {
1319 unsafe {
1320 ffi::gtk_widget_set_margin_top(self.as_ref().to_glib_none().0, margin);
1321 }
1322 }
1323
1324 #[doc(alias = "gtk_widget_set_name")]
1325 #[doc(alias = "set_name")]
1326 #[doc(alias = "name")]
1327 fn set_widget_name(&self, name: &str) {
1328 unsafe {
1329 ffi::gtk_widget_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0);
1330 }
1331 }
1332
1333 #[doc(alias = "gtk_widget_set_opacity")]
1334 #[doc(alias = "opacity")]
1335 fn set_opacity(&self, opacity: f64) {
1336 unsafe {
1337 ffi::gtk_widget_set_opacity(self.as_ref().to_glib_none().0, opacity);
1338 }
1339 }
1340
1341 #[doc(alias = "gtk_widget_set_overflow")]
1342 #[doc(alias = "overflow")]
1343 fn set_overflow(&self, overflow: Overflow) {
1344 unsafe {
1345 ffi::gtk_widget_set_overflow(self.as_ref().to_glib_none().0, overflow.into_glib());
1346 }
1347 }
1348
1349 #[doc(alias = "gtk_widget_set_parent")]
1350 fn set_parent(&self, parent: &impl IsA<Widget>) {
1351 unsafe {
1352 ffi::gtk_widget_set_parent(
1353 self.as_ref().to_glib_none().0,
1354 parent.as_ref().to_glib_none().0,
1355 );
1356 }
1357 }
1358
1359 #[doc(alias = "gtk_widget_set_receives_default")]
1360 #[doc(alias = "receives-default")]
1361 fn set_receives_default(&self, receives_default: bool) {
1362 unsafe {
1363 ffi::gtk_widget_set_receives_default(
1364 self.as_ref().to_glib_none().0,
1365 receives_default.into_glib(),
1366 );
1367 }
1368 }
1369
1370 #[doc(alias = "gtk_widget_set_sensitive")]
1371 #[doc(alias = "sensitive")]
1372 fn set_sensitive(&self, sensitive: bool) {
1373 unsafe {
1374 ffi::gtk_widget_set_sensitive(self.as_ref().to_glib_none().0, sensitive.into_glib());
1375 }
1376 }
1377
1378 #[doc(alias = "gtk_widget_set_size_request")]
1379 fn set_size_request(&self, width: i32, height: i32) {
1380 unsafe {
1381 ffi::gtk_widget_set_size_request(self.as_ref().to_glib_none().0, width, height);
1382 }
1383 }
1384
1385 #[doc(alias = "gtk_widget_set_state_flags")]
1386 fn set_state_flags(&self, flags: StateFlags, clear: bool) {
1387 unsafe {
1388 ffi::gtk_widget_set_state_flags(
1389 self.as_ref().to_glib_none().0,
1390 flags.into_glib(),
1391 clear.into_glib(),
1392 );
1393 }
1394 }
1395
1396 #[doc(alias = "gtk_widget_set_tooltip_markup")]
1397 #[doc(alias = "tooltip-markup")]
1398 fn set_tooltip_markup(&self, markup: Option<&str>) {
1399 unsafe {
1400 ffi::gtk_widget_set_tooltip_markup(
1401 self.as_ref().to_glib_none().0,
1402 markup.to_glib_none().0,
1403 );
1404 }
1405 }
1406
1407 #[doc(alias = "gtk_widget_set_tooltip_text")]
1408 #[doc(alias = "tooltip-text")]
1409 fn set_tooltip_text(&self, text: Option<&str>) {
1410 unsafe {
1411 ffi::gtk_widget_set_tooltip_text(self.as_ref().to_glib_none().0, text.to_glib_none().0);
1412 }
1413 }
1414
1415 #[doc(alias = "gtk_widget_set_valign")]
1416 #[doc(alias = "valign")]
1417 fn set_valign(&self, align: Align) {
1418 unsafe {
1419 ffi::gtk_widget_set_valign(self.as_ref().to_glib_none().0, align.into_glib());
1420 }
1421 }
1422
1423 #[doc(alias = "gtk_widget_set_vexpand")]
1424 #[doc(alias = "vexpand")]
1425 fn set_vexpand(&self, expand: bool) {
1426 unsafe {
1427 ffi::gtk_widget_set_vexpand(self.as_ref().to_glib_none().0, expand.into_glib());
1428 }
1429 }
1430
1431 #[doc(alias = "gtk_widget_set_vexpand_set")]
1432 #[doc(alias = "vexpand-set")]
1433 fn set_vexpand_set(&self, set: bool) {
1434 unsafe {
1435 ffi::gtk_widget_set_vexpand_set(self.as_ref().to_glib_none().0, set.into_glib());
1436 }
1437 }
1438
1439 #[doc(alias = "gtk_widget_set_visible")]
1440 #[doc(alias = "visible")]
1441 fn set_visible(&self, visible: bool) {
1442 unsafe {
1443 ffi::gtk_widget_set_visible(self.as_ref().to_glib_none().0, visible.into_glib());
1444 }
1445 }
1446
1447 #[doc(alias = "gtk_widget_should_layout")]
1448 fn should_layout(&self) -> bool {
1449 unsafe {
1450 from_glib(ffi::gtk_widget_should_layout(
1451 self.as_ref().to_glib_none().0,
1452 ))
1453 }
1454 }
1455
1456 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1457 #[allow(deprecated)]
1458 #[doc(alias = "gtk_widget_show")]
1459 fn show(&self) {
1460 unsafe {
1461 ffi::gtk_widget_show(self.as_ref().to_glib_none().0);
1462 }
1463 }
1464
1465 #[doc(alias = "gtk_widget_size_allocate")]
1466 fn size_allocate(&self, allocation: &Allocation, baseline: i32) {
1467 unsafe {
1468 ffi::gtk_widget_size_allocate(
1469 self.as_ref().to_glib_none().0,
1470 allocation.to_glib_none().0,
1471 baseline,
1472 );
1473 }
1474 }
1475
1476 #[doc(alias = "gtk_widget_snapshot_child")]
1477 fn snapshot_child(&self, child: &impl IsA<Widget>, snapshot: &impl IsA<Snapshot>) {
1478 unsafe {
1479 ffi::gtk_widget_snapshot_child(
1480 self.as_ref().to_glib_none().0,
1481 child.as_ref().to_glib_none().0,
1482 snapshot.as_ref().to_glib_none().0,
1483 );
1484 }
1485 }
1486
1487 #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
1488 #[allow(deprecated)]
1489 #[doc(alias = "gtk_widget_translate_coordinates")]
1490 fn translate_coordinates(
1491 &self,
1492 dest_widget: &impl IsA<Widget>,
1493 src_x: f64,
1494 src_y: f64,
1495 ) -> Option<(f64, f64)> {
1496 unsafe {
1497 let mut dest_x = std::mem::MaybeUninit::uninit();
1498 let mut dest_y = std::mem::MaybeUninit::uninit();
1499 let ret = from_glib(ffi::gtk_widget_translate_coordinates(
1500 self.as_ref().to_glib_none().0,
1501 dest_widget.as_ref().to_glib_none().0,
1502 src_x,
1503 src_y,
1504 dest_x.as_mut_ptr(),
1505 dest_y.as_mut_ptr(),
1506 ));
1507 if ret {
1508 Some((dest_x.assume_init(), dest_y.assume_init()))
1509 } else {
1510 None
1511 }
1512 }
1513 }
1514
1515 #[doc(alias = "gtk_widget_trigger_tooltip_query")]
1516 fn trigger_tooltip_query(&self) {
1517 unsafe {
1518 ffi::gtk_widget_trigger_tooltip_query(self.as_ref().to_glib_none().0);
1519 }
1520 }
1521
1522 #[doc(alias = "gtk_widget_unmap")]
1523 fn unmap(&self) {
1524 unsafe {
1525 ffi::gtk_widget_unmap(self.as_ref().to_glib_none().0);
1526 }
1527 }
1528
1529 #[doc(alias = "gtk_widget_unparent")]
1530 fn unparent(&self) {
1531 unsafe {
1532 ffi::gtk_widget_unparent(self.as_ref().to_glib_none().0);
1533 }
1534 }
1535
1536 #[doc(alias = "gtk_widget_unrealize")]
1537 fn unrealize(&self) {
1538 unsafe {
1539 ffi::gtk_widget_unrealize(self.as_ref().to_glib_none().0);
1540 }
1541 }
1542
1543 #[doc(alias = "gtk_widget_unset_state_flags")]
1544 fn unset_state_flags(&self, flags: StateFlags) {
1545 unsafe {
1546 ffi::gtk_widget_unset_state_flags(self.as_ref().to_glib_none().0, flags.into_glib());
1547 }
1548 }
1549
1550 #[doc(alias = "height-request")]
1551 fn height_request(&self) -> i32 {
1552 ObjectExt::property(self.as_ref(), "height-request")
1553 }
1554
1555 #[doc(alias = "height-request")]
1556 fn set_height_request(&self, height_request: i32) {
1557 ObjectExt::set_property(self.as_ref(), "height-request", height_request)
1558 }
1559
1560 #[doc(alias = "width-request")]
1561 fn width_request(&self) -> i32 {
1562 ObjectExt::property(self.as_ref(), "width-request")
1563 }
1564
1565 #[doc(alias = "width-request")]
1566 fn set_width_request(&self, width_request: i32) {
1567 ObjectExt::set_property(self.as_ref(), "width-request", width_request)
1568 }
1569
1570 #[doc(alias = "destroy")]
1571 fn connect_destroy<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1572 unsafe extern "C" fn destroy_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
1573 this: *mut ffi::GtkWidget,
1574 f: glib::ffi::gpointer,
1575 ) {
1576 let f: &F = &*(f as *const F);
1577 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
1578 }
1579 unsafe {
1580 let f: Box_<F> = Box_::new(f);
1581 connect_raw(
1582 self.as_ptr() as *mut _,
1583 c"destroy".as_ptr() as *const _,
1584 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1585 destroy_trampoline::<Self, F> as *const (),
1586 )),
1587 Box_::into_raw(f),
1588 )
1589 }
1590 }
1591
1592 #[doc(alias = "direction-changed")]
1593 fn connect_direction_changed<F: Fn(&Self, TextDirection) + 'static>(
1594 &self,
1595 f: F,
1596 ) -> SignalHandlerId {
1597 unsafe extern "C" fn direction_changed_trampoline<
1598 P: IsA<Widget>,
1599 F: Fn(&P, TextDirection) + 'static,
1600 >(
1601 this: *mut ffi::GtkWidget,
1602 previous_direction: ffi::GtkTextDirection,
1603 f: glib::ffi::gpointer,
1604 ) {
1605 let f: &F = &*(f as *const F);
1606 f(
1607 Widget::from_glib_borrow(this).unsafe_cast_ref(),
1608 from_glib(previous_direction),
1609 )
1610 }
1611 unsafe {
1612 let f: Box_<F> = Box_::new(f);
1613 connect_raw(
1614 self.as_ptr() as *mut _,
1615 c"direction-changed".as_ptr() as *const _,
1616 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1617 direction_changed_trampoline::<Self, F> as *const (),
1618 )),
1619 Box_::into_raw(f),
1620 )
1621 }
1622 }
1623
1624 #[doc(alias = "hide")]
1625 fn connect_hide<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1626 unsafe extern "C" fn hide_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
1627 this: *mut ffi::GtkWidget,
1628 f: glib::ffi::gpointer,
1629 ) {
1630 let f: &F = &*(f as *const F);
1631 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
1632 }
1633 unsafe {
1634 let f: Box_<F> = Box_::new(f);
1635 connect_raw(
1636 self.as_ptr() as *mut _,
1637 c"hide".as_ptr() as *const _,
1638 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1639 hide_trampoline::<Self, F> as *const (),
1640 )),
1641 Box_::into_raw(f),
1642 )
1643 }
1644 }
1645
1646 #[doc(alias = "keynav-failed")]
1647 fn connect_keynav_failed<F: Fn(&Self, DirectionType) -> glib::Propagation + 'static>(
1648 &self,
1649 f: F,
1650 ) -> SignalHandlerId {
1651 unsafe extern "C" fn keynav_failed_trampoline<
1652 P: IsA<Widget>,
1653 F: Fn(&P, DirectionType) -> glib::Propagation + 'static,
1654 >(
1655 this: *mut ffi::GtkWidget,
1656 direction: ffi::GtkDirectionType,
1657 f: glib::ffi::gpointer,
1658 ) -> glib::ffi::gboolean {
1659 let f: &F = &*(f as *const F);
1660 f(
1661 Widget::from_glib_borrow(this).unsafe_cast_ref(),
1662 from_glib(direction),
1663 )
1664 .into_glib()
1665 }
1666 unsafe {
1667 let f: Box_<F> = Box_::new(f);
1668 connect_raw(
1669 self.as_ptr() as *mut _,
1670 c"keynav-failed".as_ptr() as *const _,
1671 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1672 keynav_failed_trampoline::<Self, F> as *const (),
1673 )),
1674 Box_::into_raw(f),
1675 )
1676 }
1677 }
1678
1679 #[doc(alias = "map")]
1680 fn connect_map<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1681 unsafe extern "C" fn map_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
1682 this: *mut ffi::GtkWidget,
1683 f: glib::ffi::gpointer,
1684 ) {
1685 let f: &F = &*(f as *const F);
1686 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
1687 }
1688 unsafe {
1689 let f: Box_<F> = Box_::new(f);
1690 connect_raw(
1691 self.as_ptr() as *mut _,
1692 c"map".as_ptr() as *const _,
1693 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1694 map_trampoline::<Self, F> as *const (),
1695 )),
1696 Box_::into_raw(f),
1697 )
1698 }
1699 }
1700
1701 #[doc(alias = "mnemonic-activate")]
1702 fn connect_mnemonic_activate<F: Fn(&Self, bool) -> glib::Propagation + 'static>(
1703 &self,
1704 f: F,
1705 ) -> SignalHandlerId {
1706 unsafe extern "C" fn mnemonic_activate_trampoline<
1707 P: IsA<Widget>,
1708 F: Fn(&P, bool) -> glib::Propagation + 'static,
1709 >(
1710 this: *mut ffi::GtkWidget,
1711 group_cycling: glib::ffi::gboolean,
1712 f: glib::ffi::gpointer,
1713 ) -> glib::ffi::gboolean {
1714 let f: &F = &*(f as *const F);
1715 f(
1716 Widget::from_glib_borrow(this).unsafe_cast_ref(),
1717 from_glib(group_cycling),
1718 )
1719 .into_glib()
1720 }
1721 unsafe {
1722 let f: Box_<F> = Box_::new(f);
1723 connect_raw(
1724 self.as_ptr() as *mut _,
1725 c"mnemonic-activate".as_ptr() as *const _,
1726 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1727 mnemonic_activate_trampoline::<Self, F> as *const (),
1728 )),
1729 Box_::into_raw(f),
1730 )
1731 }
1732 }
1733
1734 #[doc(alias = "move-focus")]
1735 fn connect_move_focus<F: Fn(&Self, DirectionType) + 'static>(&self, f: F) -> SignalHandlerId {
1736 unsafe extern "C" fn move_focus_trampoline<
1737 P: IsA<Widget>,
1738 F: Fn(&P, DirectionType) + 'static,
1739 >(
1740 this: *mut ffi::GtkWidget,
1741 direction: ffi::GtkDirectionType,
1742 f: glib::ffi::gpointer,
1743 ) {
1744 let f: &F = &*(f as *const F);
1745 f(
1746 Widget::from_glib_borrow(this).unsafe_cast_ref(),
1747 from_glib(direction),
1748 )
1749 }
1750 unsafe {
1751 let f: Box_<F> = Box_::new(f);
1752 connect_raw(
1753 self.as_ptr() as *mut _,
1754 c"move-focus".as_ptr() as *const _,
1755 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1756 move_focus_trampoline::<Self, F> as *const (),
1757 )),
1758 Box_::into_raw(f),
1759 )
1760 }
1761 }
1762
1763 fn emit_move_focus(&self, direction: DirectionType) {
1764 self.emit_by_name::<()>("move-focus", &[&direction]);
1765 }
1766
1767 #[doc(alias = "query-tooltip")]
1768 fn connect_query_tooltip<F: Fn(&Self, i32, i32, bool, &Tooltip) -> bool + 'static>(
1769 &self,
1770 f: F,
1771 ) -> SignalHandlerId {
1772 unsafe extern "C" fn query_tooltip_trampoline<
1773 P: IsA<Widget>,
1774 F: Fn(&P, i32, i32, bool, &Tooltip) -> bool + 'static,
1775 >(
1776 this: *mut ffi::GtkWidget,
1777 x: std::ffi::c_int,
1778 y: std::ffi::c_int,
1779 keyboard_mode: glib::ffi::gboolean,
1780 tooltip: *mut ffi::GtkTooltip,
1781 f: glib::ffi::gpointer,
1782 ) -> glib::ffi::gboolean {
1783 let f: &F = &*(f as *const F);
1784 f(
1785 Widget::from_glib_borrow(this).unsafe_cast_ref(),
1786 x,
1787 y,
1788 from_glib(keyboard_mode),
1789 &from_glib_borrow(tooltip),
1790 )
1791 .into_glib()
1792 }
1793 unsafe {
1794 let f: Box_<F> = Box_::new(f);
1795 connect_raw(
1796 self.as_ptr() as *mut _,
1797 c"query-tooltip".as_ptr() as *const _,
1798 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1799 query_tooltip_trampoline::<Self, F> as *const (),
1800 )),
1801 Box_::into_raw(f),
1802 )
1803 }
1804 }
1805
1806 #[doc(alias = "realize")]
1807 fn connect_realize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1808 unsafe extern "C" fn realize_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
1809 this: *mut ffi::GtkWidget,
1810 f: glib::ffi::gpointer,
1811 ) {
1812 let f: &F = &*(f as *const F);
1813 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
1814 }
1815 unsafe {
1816 let f: Box_<F> = Box_::new(f);
1817 connect_raw(
1818 self.as_ptr() as *mut _,
1819 c"realize".as_ptr() as *const _,
1820 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1821 realize_trampoline::<Self, F> as *const (),
1822 )),
1823 Box_::into_raw(f),
1824 )
1825 }
1826 }
1827
1828 #[doc(alias = "show")]
1829 fn connect_show<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1830 unsafe extern "C" fn show_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
1831 this: *mut ffi::GtkWidget,
1832 f: glib::ffi::gpointer,
1833 ) {
1834 let f: &F = &*(f as *const F);
1835 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
1836 }
1837 unsafe {
1838 let f: Box_<F> = Box_::new(f);
1839 connect_raw(
1840 self.as_ptr() as *mut _,
1841 c"show".as_ptr() as *const _,
1842 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1843 show_trampoline::<Self, F> as *const (),
1844 )),
1845 Box_::into_raw(f),
1846 )
1847 }
1848 }
1849
1850 #[doc(alias = "state-flags-changed")]
1851 fn connect_state_flags_changed<F: Fn(&Self, StateFlags) + 'static>(
1852 &self,
1853 f: F,
1854 ) -> SignalHandlerId {
1855 unsafe extern "C" fn state_flags_changed_trampoline<
1856 P: IsA<Widget>,
1857 F: Fn(&P, StateFlags) + 'static,
1858 >(
1859 this: *mut ffi::GtkWidget,
1860 flags: ffi::GtkStateFlags,
1861 f: glib::ffi::gpointer,
1862 ) {
1863 let f: &F = &*(f as *const F);
1864 f(
1865 Widget::from_glib_borrow(this).unsafe_cast_ref(),
1866 from_glib(flags),
1867 )
1868 }
1869 unsafe {
1870 let f: Box_<F> = Box_::new(f);
1871 connect_raw(
1872 self.as_ptr() as *mut _,
1873 c"state-flags-changed".as_ptr() as *const _,
1874 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1875 state_flags_changed_trampoline::<Self, F> as *const (),
1876 )),
1877 Box_::into_raw(f),
1878 )
1879 }
1880 }
1881
1882 #[doc(alias = "unmap")]
1883 fn connect_unmap<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1884 unsafe extern "C" fn unmap_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
1885 this: *mut ffi::GtkWidget,
1886 f: glib::ffi::gpointer,
1887 ) {
1888 let f: &F = &*(f as *const F);
1889 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
1890 }
1891 unsafe {
1892 let f: Box_<F> = Box_::new(f);
1893 connect_raw(
1894 self.as_ptr() as *mut _,
1895 c"unmap".as_ptr() as *const _,
1896 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1897 unmap_trampoline::<Self, F> as *const (),
1898 )),
1899 Box_::into_raw(f),
1900 )
1901 }
1902 }
1903
1904 #[doc(alias = "unrealize")]
1905 fn connect_unrealize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1906 unsafe extern "C" fn unrealize_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
1907 this: *mut ffi::GtkWidget,
1908 f: glib::ffi::gpointer,
1909 ) {
1910 let f: &F = &*(f as *const F);
1911 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
1912 }
1913 unsafe {
1914 let f: Box_<F> = Box_::new(f);
1915 connect_raw(
1916 self.as_ptr() as *mut _,
1917 c"unrealize".as_ptr() as *const _,
1918 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1919 unrealize_trampoline::<Self, F> as *const (),
1920 )),
1921 Box_::into_raw(f),
1922 )
1923 }
1924 }
1925
1926 #[doc(alias = "can-focus")]
1927 fn connect_can_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1928 unsafe extern "C" fn notify_can_focus_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
1929 this: *mut ffi::GtkWidget,
1930 _param_spec: glib::ffi::gpointer,
1931 f: glib::ffi::gpointer,
1932 ) {
1933 let f: &F = &*(f as *const F);
1934 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
1935 }
1936 unsafe {
1937 let f: Box_<F> = Box_::new(f);
1938 connect_raw(
1939 self.as_ptr() as *mut _,
1940 c"notify::can-focus".as_ptr() as *const _,
1941 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1942 notify_can_focus_trampoline::<Self, F> as *const (),
1943 )),
1944 Box_::into_raw(f),
1945 )
1946 }
1947 }
1948
1949 #[doc(alias = "can-target")]
1950 fn connect_can_target_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1951 unsafe extern "C" fn notify_can_target_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
1952 this: *mut ffi::GtkWidget,
1953 _param_spec: glib::ffi::gpointer,
1954 f: glib::ffi::gpointer,
1955 ) {
1956 let f: &F = &*(f as *const F);
1957 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
1958 }
1959 unsafe {
1960 let f: Box_<F> = Box_::new(f);
1961 connect_raw(
1962 self.as_ptr() as *mut _,
1963 c"notify::can-target".as_ptr() as *const _,
1964 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1965 notify_can_target_trampoline::<Self, F> as *const (),
1966 )),
1967 Box_::into_raw(f),
1968 )
1969 }
1970 }
1971
1972 #[doc(alias = "css-classes")]
1973 fn connect_css_classes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1974 unsafe extern "C" fn notify_css_classes_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
1975 this: *mut ffi::GtkWidget,
1976 _param_spec: glib::ffi::gpointer,
1977 f: glib::ffi::gpointer,
1978 ) {
1979 let f: &F = &*(f as *const F);
1980 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
1981 }
1982 unsafe {
1983 let f: Box_<F> = Box_::new(f);
1984 connect_raw(
1985 self.as_ptr() as *mut _,
1986 c"notify::css-classes".as_ptr() as *const _,
1987 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1988 notify_css_classes_trampoline::<Self, F> as *const (),
1989 )),
1990 Box_::into_raw(f),
1991 )
1992 }
1993 }
1994
1995 #[doc(alias = "cursor")]
1996 fn connect_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1997 unsafe extern "C" fn notify_cursor_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
1998 this: *mut ffi::GtkWidget,
1999 _param_spec: glib::ffi::gpointer,
2000 f: glib::ffi::gpointer,
2001 ) {
2002 let f: &F = &*(f as *const F);
2003 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2004 }
2005 unsafe {
2006 let f: Box_<F> = Box_::new(f);
2007 connect_raw(
2008 self.as_ptr() as *mut _,
2009 c"notify::cursor".as_ptr() as *const _,
2010 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2011 notify_cursor_trampoline::<Self, F> as *const (),
2012 )),
2013 Box_::into_raw(f),
2014 )
2015 }
2016 }
2017
2018 #[doc(alias = "focus-on-click")]
2019 fn connect_focus_on_click_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2020 unsafe extern "C" fn notify_focus_on_click_trampoline<
2021 P: IsA<Widget>,
2022 F: Fn(&P) + 'static,
2023 >(
2024 this: *mut ffi::GtkWidget,
2025 _param_spec: glib::ffi::gpointer,
2026 f: glib::ffi::gpointer,
2027 ) {
2028 let f: &F = &*(f as *const F);
2029 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2030 }
2031 unsafe {
2032 let f: Box_<F> = Box_::new(f);
2033 connect_raw(
2034 self.as_ptr() as *mut _,
2035 c"notify::focus-on-click".as_ptr() as *const _,
2036 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2037 notify_focus_on_click_trampoline::<Self, F> as *const (),
2038 )),
2039 Box_::into_raw(f),
2040 )
2041 }
2042 }
2043
2044 #[doc(alias = "focusable")]
2045 fn connect_focusable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2046 unsafe extern "C" fn notify_focusable_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2047 this: *mut ffi::GtkWidget,
2048 _param_spec: glib::ffi::gpointer,
2049 f: glib::ffi::gpointer,
2050 ) {
2051 let f: &F = &*(f as *const F);
2052 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2053 }
2054 unsafe {
2055 let f: Box_<F> = Box_::new(f);
2056 connect_raw(
2057 self.as_ptr() as *mut _,
2058 c"notify::focusable".as_ptr() as *const _,
2059 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2060 notify_focusable_trampoline::<Self, F> as *const (),
2061 )),
2062 Box_::into_raw(f),
2063 )
2064 }
2065 }
2066
2067 #[doc(alias = "halign")]
2068 fn connect_halign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2069 unsafe extern "C" fn notify_halign_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2070 this: *mut ffi::GtkWidget,
2071 _param_spec: glib::ffi::gpointer,
2072 f: glib::ffi::gpointer,
2073 ) {
2074 let f: &F = &*(f as *const F);
2075 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2076 }
2077 unsafe {
2078 let f: Box_<F> = Box_::new(f);
2079 connect_raw(
2080 self.as_ptr() as *mut _,
2081 c"notify::halign".as_ptr() as *const _,
2082 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2083 notify_halign_trampoline::<Self, F> as *const (),
2084 )),
2085 Box_::into_raw(f),
2086 )
2087 }
2088 }
2089
2090 #[doc(alias = "has-default")]
2091 fn connect_has_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2092 unsafe extern "C" fn notify_has_default_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2093 this: *mut ffi::GtkWidget,
2094 _param_spec: glib::ffi::gpointer,
2095 f: glib::ffi::gpointer,
2096 ) {
2097 let f: &F = &*(f as *const F);
2098 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2099 }
2100 unsafe {
2101 let f: Box_<F> = Box_::new(f);
2102 connect_raw(
2103 self.as_ptr() as *mut _,
2104 c"notify::has-default".as_ptr() as *const _,
2105 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2106 notify_has_default_trampoline::<Self, F> as *const (),
2107 )),
2108 Box_::into_raw(f),
2109 )
2110 }
2111 }
2112
2113 #[doc(alias = "has-focus")]
2114 fn connect_has_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2115 unsafe extern "C" fn notify_has_focus_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2116 this: *mut ffi::GtkWidget,
2117 _param_spec: glib::ffi::gpointer,
2118 f: glib::ffi::gpointer,
2119 ) {
2120 let f: &F = &*(f as *const F);
2121 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2122 }
2123 unsafe {
2124 let f: Box_<F> = Box_::new(f);
2125 connect_raw(
2126 self.as_ptr() as *mut _,
2127 c"notify::has-focus".as_ptr() as *const _,
2128 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2129 notify_has_focus_trampoline::<Self, F> as *const (),
2130 )),
2131 Box_::into_raw(f),
2132 )
2133 }
2134 }
2135
2136 #[doc(alias = "has-tooltip")]
2137 fn connect_has_tooltip_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2138 unsafe extern "C" fn notify_has_tooltip_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2139 this: *mut ffi::GtkWidget,
2140 _param_spec: glib::ffi::gpointer,
2141 f: glib::ffi::gpointer,
2142 ) {
2143 let f: &F = &*(f as *const F);
2144 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2145 }
2146 unsafe {
2147 let f: Box_<F> = Box_::new(f);
2148 connect_raw(
2149 self.as_ptr() as *mut _,
2150 c"notify::has-tooltip".as_ptr() as *const _,
2151 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2152 notify_has_tooltip_trampoline::<Self, F> as *const (),
2153 )),
2154 Box_::into_raw(f),
2155 )
2156 }
2157 }
2158
2159 #[doc(alias = "height-request")]
2160 fn connect_height_request_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2161 unsafe extern "C" fn notify_height_request_trampoline<
2162 P: IsA<Widget>,
2163 F: Fn(&P) + 'static,
2164 >(
2165 this: *mut ffi::GtkWidget,
2166 _param_spec: glib::ffi::gpointer,
2167 f: glib::ffi::gpointer,
2168 ) {
2169 let f: &F = &*(f as *const F);
2170 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2171 }
2172 unsafe {
2173 let f: Box_<F> = Box_::new(f);
2174 connect_raw(
2175 self.as_ptr() as *mut _,
2176 c"notify::height-request".as_ptr() as *const _,
2177 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2178 notify_height_request_trampoline::<Self, F> as *const (),
2179 )),
2180 Box_::into_raw(f),
2181 )
2182 }
2183 }
2184
2185 #[doc(alias = "hexpand")]
2186 fn connect_hexpand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2187 unsafe extern "C" fn notify_hexpand_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2188 this: *mut ffi::GtkWidget,
2189 _param_spec: glib::ffi::gpointer,
2190 f: glib::ffi::gpointer,
2191 ) {
2192 let f: &F = &*(f as *const F);
2193 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2194 }
2195 unsafe {
2196 let f: Box_<F> = Box_::new(f);
2197 connect_raw(
2198 self.as_ptr() as *mut _,
2199 c"notify::hexpand".as_ptr() as *const _,
2200 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2201 notify_hexpand_trampoline::<Self, F> as *const (),
2202 )),
2203 Box_::into_raw(f),
2204 )
2205 }
2206 }
2207
2208 #[doc(alias = "hexpand-set")]
2209 fn connect_hexpand_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2210 unsafe extern "C" fn notify_hexpand_set_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2211 this: *mut ffi::GtkWidget,
2212 _param_spec: glib::ffi::gpointer,
2213 f: glib::ffi::gpointer,
2214 ) {
2215 let f: &F = &*(f as *const F);
2216 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2217 }
2218 unsafe {
2219 let f: Box_<F> = Box_::new(f);
2220 connect_raw(
2221 self.as_ptr() as *mut _,
2222 c"notify::hexpand-set".as_ptr() as *const _,
2223 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2224 notify_hexpand_set_trampoline::<Self, F> as *const (),
2225 )),
2226 Box_::into_raw(f),
2227 )
2228 }
2229 }
2230
2231 #[doc(alias = "layout-manager")]
2232 fn connect_layout_manager_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2233 unsafe extern "C" fn notify_layout_manager_trampoline<
2234 P: IsA<Widget>,
2235 F: Fn(&P) + 'static,
2236 >(
2237 this: *mut ffi::GtkWidget,
2238 _param_spec: glib::ffi::gpointer,
2239 f: glib::ffi::gpointer,
2240 ) {
2241 let f: &F = &*(f as *const F);
2242 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2243 }
2244 unsafe {
2245 let f: Box_<F> = Box_::new(f);
2246 connect_raw(
2247 self.as_ptr() as *mut _,
2248 c"notify::layout-manager".as_ptr() as *const _,
2249 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2250 notify_layout_manager_trampoline::<Self, F> as *const (),
2251 )),
2252 Box_::into_raw(f),
2253 )
2254 }
2255 }
2256
2257 #[cfg(feature = "v4_18")]
2258 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
2259 #[doc(alias = "limit-events")]
2260 fn connect_limit_events_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2261 unsafe extern "C" fn notify_limit_events_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2262 this: *mut ffi::GtkWidget,
2263 _param_spec: glib::ffi::gpointer,
2264 f: glib::ffi::gpointer,
2265 ) {
2266 let f: &F = &*(f as *const F);
2267 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2268 }
2269 unsafe {
2270 let f: Box_<F> = Box_::new(f);
2271 connect_raw(
2272 self.as_ptr() as *mut _,
2273 c"notify::limit-events".as_ptr() as *const _,
2274 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2275 notify_limit_events_trampoline::<Self, F> as *const (),
2276 )),
2277 Box_::into_raw(f),
2278 )
2279 }
2280 }
2281
2282 #[doc(alias = "margin-bottom")]
2283 fn connect_margin_bottom_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2284 unsafe extern "C" fn notify_margin_bottom_trampoline<
2285 P: IsA<Widget>,
2286 F: Fn(&P) + 'static,
2287 >(
2288 this: *mut ffi::GtkWidget,
2289 _param_spec: glib::ffi::gpointer,
2290 f: glib::ffi::gpointer,
2291 ) {
2292 let f: &F = &*(f as *const F);
2293 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2294 }
2295 unsafe {
2296 let f: Box_<F> = Box_::new(f);
2297 connect_raw(
2298 self.as_ptr() as *mut _,
2299 c"notify::margin-bottom".as_ptr() as *const _,
2300 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2301 notify_margin_bottom_trampoline::<Self, F> as *const (),
2302 )),
2303 Box_::into_raw(f),
2304 )
2305 }
2306 }
2307
2308 #[doc(alias = "margin-end")]
2309 fn connect_margin_end_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2310 unsafe extern "C" fn notify_margin_end_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2311 this: *mut ffi::GtkWidget,
2312 _param_spec: glib::ffi::gpointer,
2313 f: glib::ffi::gpointer,
2314 ) {
2315 let f: &F = &*(f as *const F);
2316 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2317 }
2318 unsafe {
2319 let f: Box_<F> = Box_::new(f);
2320 connect_raw(
2321 self.as_ptr() as *mut _,
2322 c"notify::margin-end".as_ptr() as *const _,
2323 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2324 notify_margin_end_trampoline::<Self, F> as *const (),
2325 )),
2326 Box_::into_raw(f),
2327 )
2328 }
2329 }
2330
2331 #[doc(alias = "margin-start")]
2332 fn connect_margin_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2333 unsafe extern "C" fn notify_margin_start_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2334 this: *mut ffi::GtkWidget,
2335 _param_spec: glib::ffi::gpointer,
2336 f: glib::ffi::gpointer,
2337 ) {
2338 let f: &F = &*(f as *const F);
2339 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2340 }
2341 unsafe {
2342 let f: Box_<F> = Box_::new(f);
2343 connect_raw(
2344 self.as_ptr() as *mut _,
2345 c"notify::margin-start".as_ptr() as *const _,
2346 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2347 notify_margin_start_trampoline::<Self, F> as *const (),
2348 )),
2349 Box_::into_raw(f),
2350 )
2351 }
2352 }
2353
2354 #[doc(alias = "margin-top")]
2355 fn connect_margin_top_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2356 unsafe extern "C" fn notify_margin_top_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2357 this: *mut ffi::GtkWidget,
2358 _param_spec: glib::ffi::gpointer,
2359 f: glib::ffi::gpointer,
2360 ) {
2361 let f: &F = &*(f as *const F);
2362 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2363 }
2364 unsafe {
2365 let f: Box_<F> = Box_::new(f);
2366 connect_raw(
2367 self.as_ptr() as *mut _,
2368 c"notify::margin-top".as_ptr() as *const _,
2369 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2370 notify_margin_top_trampoline::<Self, F> as *const (),
2371 )),
2372 Box_::into_raw(f),
2373 )
2374 }
2375 }
2376
2377 #[doc(alias = "name")]
2378 fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2379 unsafe extern "C" fn notify_name_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2380 this: *mut ffi::GtkWidget,
2381 _param_spec: glib::ffi::gpointer,
2382 f: glib::ffi::gpointer,
2383 ) {
2384 let f: &F = &*(f as *const F);
2385 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2386 }
2387 unsafe {
2388 let f: Box_<F> = Box_::new(f);
2389 connect_raw(
2390 self.as_ptr() as *mut _,
2391 c"notify::name".as_ptr() as *const _,
2392 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2393 notify_name_trampoline::<Self, F> as *const (),
2394 )),
2395 Box_::into_raw(f),
2396 )
2397 }
2398 }
2399
2400 #[doc(alias = "opacity")]
2401 fn connect_opacity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2402 unsafe extern "C" fn notify_opacity_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2403 this: *mut ffi::GtkWidget,
2404 _param_spec: glib::ffi::gpointer,
2405 f: glib::ffi::gpointer,
2406 ) {
2407 let f: &F = &*(f as *const F);
2408 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2409 }
2410 unsafe {
2411 let f: Box_<F> = Box_::new(f);
2412 connect_raw(
2413 self.as_ptr() as *mut _,
2414 c"notify::opacity".as_ptr() as *const _,
2415 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2416 notify_opacity_trampoline::<Self, F> as *const (),
2417 )),
2418 Box_::into_raw(f),
2419 )
2420 }
2421 }
2422
2423 #[doc(alias = "overflow")]
2424 fn connect_overflow_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2425 unsafe extern "C" fn notify_overflow_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2426 this: *mut ffi::GtkWidget,
2427 _param_spec: glib::ffi::gpointer,
2428 f: glib::ffi::gpointer,
2429 ) {
2430 let f: &F = &*(f as *const F);
2431 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2432 }
2433 unsafe {
2434 let f: Box_<F> = Box_::new(f);
2435 connect_raw(
2436 self.as_ptr() as *mut _,
2437 c"notify::overflow".as_ptr() as *const _,
2438 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2439 notify_overflow_trampoline::<Self, F> as *const (),
2440 )),
2441 Box_::into_raw(f),
2442 )
2443 }
2444 }
2445
2446 #[doc(alias = "parent")]
2447 fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2448 unsafe extern "C" fn notify_parent_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2449 this: *mut ffi::GtkWidget,
2450 _param_spec: glib::ffi::gpointer,
2451 f: glib::ffi::gpointer,
2452 ) {
2453 let f: &F = &*(f as *const F);
2454 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2455 }
2456 unsafe {
2457 let f: Box_<F> = Box_::new(f);
2458 connect_raw(
2459 self.as_ptr() as *mut _,
2460 c"notify::parent".as_ptr() as *const _,
2461 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2462 notify_parent_trampoline::<Self, F> as *const (),
2463 )),
2464 Box_::into_raw(f),
2465 )
2466 }
2467 }
2468
2469 #[doc(alias = "receives-default")]
2470 fn connect_receives_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2471 unsafe extern "C" fn notify_receives_default_trampoline<
2472 P: IsA<Widget>,
2473 F: Fn(&P) + 'static,
2474 >(
2475 this: *mut ffi::GtkWidget,
2476 _param_spec: glib::ffi::gpointer,
2477 f: glib::ffi::gpointer,
2478 ) {
2479 let f: &F = &*(f as *const F);
2480 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2481 }
2482 unsafe {
2483 let f: Box_<F> = Box_::new(f);
2484 connect_raw(
2485 self.as_ptr() as *mut _,
2486 c"notify::receives-default".as_ptr() as *const _,
2487 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2488 notify_receives_default_trampoline::<Self, F> as *const (),
2489 )),
2490 Box_::into_raw(f),
2491 )
2492 }
2493 }
2494
2495 #[doc(alias = "root")]
2496 fn connect_root_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2497 unsafe extern "C" fn notify_root_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2498 this: *mut ffi::GtkWidget,
2499 _param_spec: glib::ffi::gpointer,
2500 f: glib::ffi::gpointer,
2501 ) {
2502 let f: &F = &*(f as *const F);
2503 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2504 }
2505 unsafe {
2506 let f: Box_<F> = Box_::new(f);
2507 connect_raw(
2508 self.as_ptr() as *mut _,
2509 c"notify::root".as_ptr() as *const _,
2510 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2511 notify_root_trampoline::<Self, F> as *const (),
2512 )),
2513 Box_::into_raw(f),
2514 )
2515 }
2516 }
2517
2518 #[doc(alias = "scale-factor")]
2519 fn connect_scale_factor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2520 unsafe extern "C" fn notify_scale_factor_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2521 this: *mut ffi::GtkWidget,
2522 _param_spec: glib::ffi::gpointer,
2523 f: glib::ffi::gpointer,
2524 ) {
2525 let f: &F = &*(f as *const F);
2526 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2527 }
2528 unsafe {
2529 let f: Box_<F> = Box_::new(f);
2530 connect_raw(
2531 self.as_ptr() as *mut _,
2532 c"notify::scale-factor".as_ptr() as *const _,
2533 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2534 notify_scale_factor_trampoline::<Self, F> as *const (),
2535 )),
2536 Box_::into_raw(f),
2537 )
2538 }
2539 }
2540
2541 #[doc(alias = "sensitive")]
2542 fn connect_sensitive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2543 unsafe extern "C" fn notify_sensitive_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2544 this: *mut ffi::GtkWidget,
2545 _param_spec: glib::ffi::gpointer,
2546 f: glib::ffi::gpointer,
2547 ) {
2548 let f: &F = &*(f as *const F);
2549 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2550 }
2551 unsafe {
2552 let f: Box_<F> = Box_::new(f);
2553 connect_raw(
2554 self.as_ptr() as *mut _,
2555 c"notify::sensitive".as_ptr() as *const _,
2556 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2557 notify_sensitive_trampoline::<Self, F> as *const (),
2558 )),
2559 Box_::into_raw(f),
2560 )
2561 }
2562 }
2563
2564 #[doc(alias = "tooltip-markup")]
2565 fn connect_tooltip_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2566 unsafe extern "C" fn notify_tooltip_markup_trampoline<
2567 P: IsA<Widget>,
2568 F: Fn(&P) + 'static,
2569 >(
2570 this: *mut ffi::GtkWidget,
2571 _param_spec: glib::ffi::gpointer,
2572 f: glib::ffi::gpointer,
2573 ) {
2574 let f: &F = &*(f as *const F);
2575 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2576 }
2577 unsafe {
2578 let f: Box_<F> = Box_::new(f);
2579 connect_raw(
2580 self.as_ptr() as *mut _,
2581 c"notify::tooltip-markup".as_ptr() as *const _,
2582 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2583 notify_tooltip_markup_trampoline::<Self, F> as *const (),
2584 )),
2585 Box_::into_raw(f),
2586 )
2587 }
2588 }
2589
2590 #[doc(alias = "tooltip-text")]
2591 fn connect_tooltip_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2592 unsafe extern "C" fn notify_tooltip_text_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2593 this: *mut ffi::GtkWidget,
2594 _param_spec: glib::ffi::gpointer,
2595 f: glib::ffi::gpointer,
2596 ) {
2597 let f: &F = &*(f as *const F);
2598 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2599 }
2600 unsafe {
2601 let f: Box_<F> = Box_::new(f);
2602 connect_raw(
2603 self.as_ptr() as *mut _,
2604 c"notify::tooltip-text".as_ptr() as *const _,
2605 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2606 notify_tooltip_text_trampoline::<Self, F> as *const (),
2607 )),
2608 Box_::into_raw(f),
2609 )
2610 }
2611 }
2612
2613 #[doc(alias = "valign")]
2614 fn connect_valign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2615 unsafe extern "C" fn notify_valign_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2616 this: *mut ffi::GtkWidget,
2617 _param_spec: glib::ffi::gpointer,
2618 f: glib::ffi::gpointer,
2619 ) {
2620 let f: &F = &*(f as *const F);
2621 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2622 }
2623 unsafe {
2624 let f: Box_<F> = Box_::new(f);
2625 connect_raw(
2626 self.as_ptr() as *mut _,
2627 c"notify::valign".as_ptr() as *const _,
2628 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2629 notify_valign_trampoline::<Self, F> as *const (),
2630 )),
2631 Box_::into_raw(f),
2632 )
2633 }
2634 }
2635
2636 #[doc(alias = "vexpand")]
2637 fn connect_vexpand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2638 unsafe extern "C" fn notify_vexpand_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2639 this: *mut ffi::GtkWidget,
2640 _param_spec: glib::ffi::gpointer,
2641 f: glib::ffi::gpointer,
2642 ) {
2643 let f: &F = &*(f as *const F);
2644 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2645 }
2646 unsafe {
2647 let f: Box_<F> = Box_::new(f);
2648 connect_raw(
2649 self.as_ptr() as *mut _,
2650 c"notify::vexpand".as_ptr() as *const _,
2651 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2652 notify_vexpand_trampoline::<Self, F> as *const (),
2653 )),
2654 Box_::into_raw(f),
2655 )
2656 }
2657 }
2658
2659 #[doc(alias = "vexpand-set")]
2660 fn connect_vexpand_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2661 unsafe extern "C" fn notify_vexpand_set_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2662 this: *mut ffi::GtkWidget,
2663 _param_spec: glib::ffi::gpointer,
2664 f: glib::ffi::gpointer,
2665 ) {
2666 let f: &F = &*(f as *const F);
2667 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2668 }
2669 unsafe {
2670 let f: Box_<F> = Box_::new(f);
2671 connect_raw(
2672 self.as_ptr() as *mut _,
2673 c"notify::vexpand-set".as_ptr() as *const _,
2674 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2675 notify_vexpand_set_trampoline::<Self, F> as *const (),
2676 )),
2677 Box_::into_raw(f),
2678 )
2679 }
2680 }
2681
2682 #[doc(alias = "visible")]
2683 fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2684 unsafe extern "C" fn notify_visible_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
2685 this: *mut ffi::GtkWidget,
2686 _param_spec: glib::ffi::gpointer,
2687 f: glib::ffi::gpointer,
2688 ) {
2689 let f: &F = &*(f as *const F);
2690 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2691 }
2692 unsafe {
2693 let f: Box_<F> = Box_::new(f);
2694 connect_raw(
2695 self.as_ptr() as *mut _,
2696 c"notify::visible".as_ptr() as *const _,
2697 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2698 notify_visible_trampoline::<Self, F> as *const (),
2699 )),
2700 Box_::into_raw(f),
2701 )
2702 }
2703 }
2704
2705 #[doc(alias = "width-request")]
2706 fn connect_width_request_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2707 unsafe extern "C" fn notify_width_request_trampoline<
2708 P: IsA<Widget>,
2709 F: Fn(&P) + 'static,
2710 >(
2711 this: *mut ffi::GtkWidget,
2712 _param_spec: glib::ffi::gpointer,
2713 f: glib::ffi::gpointer,
2714 ) {
2715 let f: &F = &*(f as *const F);
2716 f(Widget::from_glib_borrow(this).unsafe_cast_ref())
2717 }
2718 unsafe {
2719 let f: Box_<F> = Box_::new(f);
2720 connect_raw(
2721 self.as_ptr() as *mut _,
2722 c"notify::width-request".as_ptr() as *const _,
2723 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2724 notify_width_request_trampoline::<Self, F> as *const (),
2725 )),
2726 Box_::into_raw(f),
2727 )
2728 }
2729 }
2730}
2731
2732impl<O: IsA<Widget>> WidgetExt for O {}