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