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