[go: up one dir, main page]

gtk4/auto/
label.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5#[cfg(feature = "v4_14")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
7use crate::AccessibleText;
8#[cfg(feature = "v4_6")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
10use crate::NaturalWrapMode;
11use crate::{
12    ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, Justification,
13    LayoutManager, MovementStep, Overflow, Widget,
14};
15use glib::{
16    object::ObjectType as _,
17    prelude::*,
18    signal::{connect_raw, SignalHandlerId},
19    translate::*,
20};
21use std::boxed::Box as Box_;
22
23#[cfg(feature = "v4_14")]
24#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
25glib::wrapper! {
26    #[doc(alias = "GtkLabel")]
27    pub struct Label(Object<ffi::GtkLabel>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleText;
28
29    match fn {
30        type_ => || ffi::gtk_label_get_type(),
31    }
32}
33
34#[cfg(not(any(feature = "v4_14")))]
35glib::wrapper! {
36    #[doc(alias = "GtkLabel")]
37    pub struct Label(Object<ffi::GtkLabel>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
38
39    match fn {
40        type_ => || ffi::gtk_label_get_type(),
41    }
42}
43
44impl Label {
45    #[doc(alias = "gtk_label_new")]
46    pub fn new(str: Option<&str>) -> Label {
47        assert_initialized_main_thread!();
48        unsafe { Widget::from_glib_none(ffi::gtk_label_new(str.to_glib_none().0)).unsafe_cast() }
49    }
50
51    #[doc(alias = "gtk_label_new_with_mnemonic")]
52    #[doc(alias = "new_with_mnemonic")]
53    pub fn with_mnemonic(str: &str) -> Label {
54        assert_initialized_main_thread!();
55        unsafe {
56            Widget::from_glib_none(ffi::gtk_label_new_with_mnemonic(str.to_glib_none().0))
57                .unsafe_cast()
58        }
59    }
60
61    // rustdoc-stripper-ignore-next
62    /// Creates a new builder-pattern struct instance to construct [`Label`] objects.
63    ///
64    /// This method returns an instance of [`LabelBuilder`](crate::builders::LabelBuilder) which can be used to create [`Label`] objects.
65    pub fn builder() -> LabelBuilder {
66        LabelBuilder::new()
67    }
68
69    #[doc(alias = "gtk_label_get_attributes")]
70    #[doc(alias = "get_attributes")]
71    pub fn attributes(&self) -> Option<pango::AttrList> {
72        unsafe { from_glib_none(ffi::gtk_label_get_attributes(self.to_glib_none().0)) }
73    }
74
75    #[doc(alias = "gtk_label_get_current_uri")]
76    #[doc(alias = "get_current_uri")]
77    pub fn current_uri(&self) -> Option<glib::GString> {
78        unsafe { from_glib_none(ffi::gtk_label_get_current_uri(self.to_glib_none().0)) }
79    }
80
81    #[doc(alias = "gtk_label_get_ellipsize")]
82    #[doc(alias = "get_ellipsize")]
83    pub fn ellipsize(&self) -> pango::EllipsizeMode {
84        unsafe { from_glib(ffi::gtk_label_get_ellipsize(self.to_glib_none().0)) }
85    }
86
87    #[doc(alias = "gtk_label_get_extra_menu")]
88    #[doc(alias = "get_extra_menu")]
89    #[doc(alias = "extra-menu")]
90    pub fn extra_menu(&self) -> Option<gio::MenuModel> {
91        unsafe { from_glib_none(ffi::gtk_label_get_extra_menu(self.to_glib_none().0)) }
92    }
93
94    #[doc(alias = "gtk_label_get_justify")]
95    #[doc(alias = "get_justify")]
96    pub fn justify(&self) -> Justification {
97        unsafe { from_glib(ffi::gtk_label_get_justify(self.to_glib_none().0)) }
98    }
99
100    #[doc(alias = "gtk_label_get_label")]
101    #[doc(alias = "get_label")]
102    pub fn label(&self) -> glib::GString {
103        unsafe { from_glib_none(ffi::gtk_label_get_label(self.to_glib_none().0)) }
104    }
105
106    #[doc(alias = "gtk_label_get_layout")]
107    #[doc(alias = "get_layout")]
108    pub fn layout(&self) -> pango::Layout {
109        unsafe { from_glib_none(ffi::gtk_label_get_layout(self.to_glib_none().0)) }
110    }
111
112    #[doc(alias = "gtk_label_get_layout_offsets")]
113    #[doc(alias = "get_layout_offsets")]
114    pub fn layout_offsets(&self) -> (i32, i32) {
115        unsafe {
116            let mut x = std::mem::MaybeUninit::uninit();
117            let mut y = std::mem::MaybeUninit::uninit();
118            ffi::gtk_label_get_layout_offsets(
119                self.to_glib_none().0,
120                x.as_mut_ptr(),
121                y.as_mut_ptr(),
122            );
123            (x.assume_init(), y.assume_init())
124        }
125    }
126
127    #[doc(alias = "gtk_label_get_lines")]
128    #[doc(alias = "get_lines")]
129    pub fn lines(&self) -> i32 {
130        unsafe { ffi::gtk_label_get_lines(self.to_glib_none().0) }
131    }
132
133    #[doc(alias = "gtk_label_get_max_width_chars")]
134    #[doc(alias = "get_max_width_chars")]
135    #[doc(alias = "max-width-chars")]
136    pub fn max_width_chars(&self) -> i32 {
137        unsafe { ffi::gtk_label_get_max_width_chars(self.to_glib_none().0) }
138    }
139
140    #[doc(alias = "gtk_label_get_mnemonic_widget")]
141    #[doc(alias = "get_mnemonic_widget")]
142    #[doc(alias = "mnemonic-widget")]
143    pub fn mnemonic_widget(&self) -> Option<Widget> {
144        unsafe { from_glib_none(ffi::gtk_label_get_mnemonic_widget(self.to_glib_none().0)) }
145    }
146
147    #[cfg(feature = "v4_6")]
148    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
149    #[doc(alias = "gtk_label_get_natural_wrap_mode")]
150    #[doc(alias = "get_natural_wrap_mode")]
151    #[doc(alias = "natural-wrap-mode")]
152    pub fn natural_wrap_mode(&self) -> NaturalWrapMode {
153        unsafe { from_glib(ffi::gtk_label_get_natural_wrap_mode(self.to_glib_none().0)) }
154    }
155
156    #[doc(alias = "gtk_label_get_selectable")]
157    #[doc(alias = "get_selectable")]
158    #[doc(alias = "selectable")]
159    pub fn is_selectable(&self) -> bool {
160        unsafe { from_glib(ffi::gtk_label_get_selectable(self.to_glib_none().0)) }
161    }
162
163    #[doc(alias = "gtk_label_get_selection_bounds")]
164    #[doc(alias = "get_selection_bounds")]
165    pub fn selection_bounds(&self) -> Option<(i32, i32)> {
166        unsafe {
167            let mut start = std::mem::MaybeUninit::uninit();
168            let mut end = std::mem::MaybeUninit::uninit();
169            let ret = from_glib(ffi::gtk_label_get_selection_bounds(
170                self.to_glib_none().0,
171                start.as_mut_ptr(),
172                end.as_mut_ptr(),
173            ));
174            if ret {
175                Some((start.assume_init(), end.assume_init()))
176            } else {
177                None
178            }
179        }
180    }
181
182    #[doc(alias = "gtk_label_get_single_line_mode")]
183    #[doc(alias = "get_single_line_mode")]
184    #[doc(alias = "single-line-mode")]
185    pub fn is_single_line_mode(&self) -> bool {
186        unsafe { from_glib(ffi::gtk_label_get_single_line_mode(self.to_glib_none().0)) }
187    }
188
189    #[cfg(feature = "v4_8")]
190    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
191    #[doc(alias = "gtk_label_get_tabs")]
192    #[doc(alias = "get_tabs")]
193    pub fn tabs(&self) -> Option<pango::TabArray> {
194        unsafe { from_glib_full(ffi::gtk_label_get_tabs(self.to_glib_none().0)) }
195    }
196
197    #[doc(alias = "gtk_label_get_text")]
198    #[doc(alias = "get_text")]
199    pub fn text(&self) -> glib::GString {
200        unsafe { from_glib_none(ffi::gtk_label_get_text(self.to_glib_none().0)) }
201    }
202
203    #[doc(alias = "gtk_label_get_use_markup")]
204    #[doc(alias = "get_use_markup")]
205    #[doc(alias = "use-markup")]
206    pub fn uses_markup(&self) -> bool {
207        unsafe { from_glib(ffi::gtk_label_get_use_markup(self.to_glib_none().0)) }
208    }
209
210    #[doc(alias = "gtk_label_get_use_underline")]
211    #[doc(alias = "get_use_underline")]
212    #[doc(alias = "use-underline")]
213    pub fn uses_underline(&self) -> bool {
214        unsafe { from_glib(ffi::gtk_label_get_use_underline(self.to_glib_none().0)) }
215    }
216
217    #[doc(alias = "gtk_label_get_width_chars")]
218    #[doc(alias = "get_width_chars")]
219    #[doc(alias = "width-chars")]
220    pub fn width_chars(&self) -> i32 {
221        unsafe { ffi::gtk_label_get_width_chars(self.to_glib_none().0) }
222    }
223
224    #[doc(alias = "gtk_label_get_wrap")]
225    #[doc(alias = "get_wrap")]
226    #[doc(alias = "wrap")]
227    pub fn wraps(&self) -> bool {
228        unsafe { from_glib(ffi::gtk_label_get_wrap(self.to_glib_none().0)) }
229    }
230
231    #[doc(alias = "gtk_label_get_wrap_mode")]
232    #[doc(alias = "get_wrap_mode")]
233    #[doc(alias = "wrap-mode")]
234    pub fn wrap_mode(&self) -> pango::WrapMode {
235        unsafe { from_glib(ffi::gtk_label_get_wrap_mode(self.to_glib_none().0)) }
236    }
237
238    #[doc(alias = "gtk_label_get_xalign")]
239    #[doc(alias = "get_xalign")]
240    pub fn xalign(&self) -> f32 {
241        unsafe { ffi::gtk_label_get_xalign(self.to_glib_none().0) }
242    }
243
244    #[doc(alias = "gtk_label_get_yalign")]
245    #[doc(alias = "get_yalign")]
246    pub fn yalign(&self) -> f32 {
247        unsafe { ffi::gtk_label_get_yalign(self.to_glib_none().0) }
248    }
249
250    #[doc(alias = "gtk_label_select_region")]
251    pub fn select_region(&self, start_offset: i32, end_offset: i32) {
252        unsafe {
253            ffi::gtk_label_select_region(self.to_glib_none().0, start_offset, end_offset);
254        }
255    }
256
257    #[doc(alias = "gtk_label_set_attributes")]
258    #[doc(alias = "attributes")]
259    pub fn set_attributes(&self, attrs: Option<&pango::AttrList>) {
260        unsafe {
261            ffi::gtk_label_set_attributes(self.to_glib_none().0, attrs.to_glib_none().0);
262        }
263    }
264
265    #[doc(alias = "gtk_label_set_ellipsize")]
266    #[doc(alias = "ellipsize")]
267    pub fn set_ellipsize(&self, mode: pango::EllipsizeMode) {
268        unsafe {
269            ffi::gtk_label_set_ellipsize(self.to_glib_none().0, mode.into_glib());
270        }
271    }
272
273    #[doc(alias = "gtk_label_set_extra_menu")]
274    #[doc(alias = "extra-menu")]
275    pub fn set_extra_menu(&self, model: Option<&impl IsA<gio::MenuModel>>) {
276        unsafe {
277            ffi::gtk_label_set_extra_menu(
278                self.to_glib_none().0,
279                model.map(|p| p.as_ref()).to_glib_none().0,
280            );
281        }
282    }
283
284    #[doc(alias = "gtk_label_set_justify")]
285    #[doc(alias = "justify")]
286    pub fn set_justify(&self, jtype: Justification) {
287        unsafe {
288            ffi::gtk_label_set_justify(self.to_glib_none().0, jtype.into_glib());
289        }
290    }
291
292    #[doc(alias = "gtk_label_set_label")]
293    #[doc(alias = "label")]
294    pub fn set_label(&self, str: &str) {
295        unsafe {
296            ffi::gtk_label_set_label(self.to_glib_none().0, str.to_glib_none().0);
297        }
298    }
299
300    #[doc(alias = "gtk_label_set_lines")]
301    #[doc(alias = "lines")]
302    pub fn set_lines(&self, lines: i32) {
303        unsafe {
304            ffi::gtk_label_set_lines(self.to_glib_none().0, lines);
305        }
306    }
307
308    #[doc(alias = "gtk_label_set_markup")]
309    pub fn set_markup(&self, str: &str) {
310        unsafe {
311            ffi::gtk_label_set_markup(self.to_glib_none().0, str.to_glib_none().0);
312        }
313    }
314
315    #[doc(alias = "gtk_label_set_markup_with_mnemonic")]
316    pub fn set_markup_with_mnemonic(&self, str: &str) {
317        unsafe {
318            ffi::gtk_label_set_markup_with_mnemonic(self.to_glib_none().0, str.to_glib_none().0);
319        }
320    }
321
322    #[doc(alias = "gtk_label_set_max_width_chars")]
323    #[doc(alias = "max-width-chars")]
324    pub fn set_max_width_chars(&self, n_chars: i32) {
325        unsafe {
326            ffi::gtk_label_set_max_width_chars(self.to_glib_none().0, n_chars);
327        }
328    }
329
330    #[doc(alias = "gtk_label_set_mnemonic_widget")]
331    #[doc(alias = "mnemonic-widget")]
332    pub fn set_mnemonic_widget(&self, widget: Option<&impl IsA<Widget>>) {
333        unsafe {
334            ffi::gtk_label_set_mnemonic_widget(
335                self.to_glib_none().0,
336                widget.map(|p| p.as_ref()).to_glib_none().0,
337            );
338        }
339    }
340
341    #[cfg(feature = "v4_6")]
342    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
343    #[doc(alias = "gtk_label_set_natural_wrap_mode")]
344    #[doc(alias = "natural-wrap-mode")]
345    pub fn set_natural_wrap_mode(&self, wrap_mode: NaturalWrapMode) {
346        unsafe {
347            ffi::gtk_label_set_natural_wrap_mode(self.to_glib_none().0, wrap_mode.into_glib());
348        }
349    }
350
351    #[doc(alias = "gtk_label_set_selectable")]
352    #[doc(alias = "selectable")]
353    pub fn set_selectable(&self, setting: bool) {
354        unsafe {
355            ffi::gtk_label_set_selectable(self.to_glib_none().0, setting.into_glib());
356        }
357    }
358
359    #[doc(alias = "gtk_label_set_single_line_mode")]
360    #[doc(alias = "single-line-mode")]
361    pub fn set_single_line_mode(&self, single_line_mode: bool) {
362        unsafe {
363            ffi::gtk_label_set_single_line_mode(
364                self.to_glib_none().0,
365                single_line_mode.into_glib(),
366            );
367        }
368    }
369
370    #[cfg(feature = "v4_8")]
371    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
372    #[doc(alias = "gtk_label_set_tabs")]
373    #[doc(alias = "tabs")]
374    pub fn set_tabs(&self, tabs: Option<&pango::TabArray>) {
375        unsafe {
376            ffi::gtk_label_set_tabs(self.to_glib_none().0, mut_override(tabs.to_glib_none().0));
377        }
378    }
379
380    #[doc(alias = "gtk_label_set_text")]
381    pub fn set_text(&self, str: &str) {
382        unsafe {
383            ffi::gtk_label_set_text(self.to_glib_none().0, str.to_glib_none().0);
384        }
385    }
386
387    #[doc(alias = "gtk_label_set_text_with_mnemonic")]
388    pub fn set_text_with_mnemonic(&self, str: &str) {
389        unsafe {
390            ffi::gtk_label_set_text_with_mnemonic(self.to_glib_none().0, str.to_glib_none().0);
391        }
392    }
393
394    #[doc(alias = "gtk_label_set_use_markup")]
395    #[doc(alias = "use-markup")]
396    pub fn set_use_markup(&self, setting: bool) {
397        unsafe {
398            ffi::gtk_label_set_use_markup(self.to_glib_none().0, setting.into_glib());
399        }
400    }
401
402    #[doc(alias = "gtk_label_set_use_underline")]
403    #[doc(alias = "use-underline")]
404    pub fn set_use_underline(&self, setting: bool) {
405        unsafe {
406            ffi::gtk_label_set_use_underline(self.to_glib_none().0, setting.into_glib());
407        }
408    }
409
410    #[doc(alias = "gtk_label_set_width_chars")]
411    #[doc(alias = "width-chars")]
412    pub fn set_width_chars(&self, n_chars: i32) {
413        unsafe {
414            ffi::gtk_label_set_width_chars(self.to_glib_none().0, n_chars);
415        }
416    }
417
418    #[doc(alias = "gtk_label_set_wrap")]
419    #[doc(alias = "wrap")]
420    pub fn set_wrap(&self, wrap: bool) {
421        unsafe {
422            ffi::gtk_label_set_wrap(self.to_glib_none().0, wrap.into_glib());
423        }
424    }
425
426    #[doc(alias = "gtk_label_set_wrap_mode")]
427    #[doc(alias = "wrap-mode")]
428    pub fn set_wrap_mode(&self, wrap_mode: pango::WrapMode) {
429        unsafe {
430            ffi::gtk_label_set_wrap_mode(self.to_glib_none().0, wrap_mode.into_glib());
431        }
432    }
433
434    #[doc(alias = "gtk_label_set_xalign")]
435    #[doc(alias = "xalign")]
436    pub fn set_xalign(&self, xalign: f32) {
437        unsafe {
438            ffi::gtk_label_set_xalign(self.to_glib_none().0, xalign);
439        }
440    }
441
442    #[doc(alias = "gtk_label_set_yalign")]
443    #[doc(alias = "yalign")]
444    pub fn set_yalign(&self, yalign: f32) {
445        unsafe {
446            ffi::gtk_label_set_yalign(self.to_glib_none().0, yalign);
447        }
448    }
449
450    #[doc(alias = "activate-current-link")]
451    pub fn connect_activate_current_link<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
452        unsafe extern "C" fn activate_current_link_trampoline<F: Fn(&Label) + 'static>(
453            this: *mut ffi::GtkLabel,
454            f: glib::ffi::gpointer,
455        ) {
456            let f: &F = &*(f as *const F);
457            f(&from_glib_borrow(this))
458        }
459        unsafe {
460            let f: Box_<F> = Box_::new(f);
461            connect_raw(
462                self.as_ptr() as *mut _,
463                c"activate-current-link".as_ptr() as *const _,
464                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
465                    activate_current_link_trampoline::<F> as *const (),
466                )),
467                Box_::into_raw(f),
468            )
469        }
470    }
471
472    pub fn emit_activate_current_link(&self) {
473        self.emit_by_name::<()>("activate-current-link", &[]);
474    }
475
476    #[doc(alias = "activate-link")]
477    pub fn connect_activate_link<F: Fn(&Self, &str) -> glib::Propagation + 'static>(
478        &self,
479        f: F,
480    ) -> SignalHandlerId {
481        unsafe extern "C" fn activate_link_trampoline<
482            F: Fn(&Label, &str) -> glib::Propagation + 'static,
483        >(
484            this: *mut ffi::GtkLabel,
485            uri: *mut std::ffi::c_char,
486            f: glib::ffi::gpointer,
487        ) -> glib::ffi::gboolean {
488            let f: &F = &*(f as *const F);
489            f(
490                &from_glib_borrow(this),
491                &glib::GString::from_glib_borrow(uri),
492            )
493            .into_glib()
494        }
495        unsafe {
496            let f: Box_<F> = Box_::new(f);
497            connect_raw(
498                self.as_ptr() as *mut _,
499                c"activate-link".as_ptr() as *const _,
500                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
501                    activate_link_trampoline::<F> as *const (),
502                )),
503                Box_::into_raw(f),
504            )
505        }
506    }
507
508    #[doc(alias = "copy-clipboard")]
509    pub fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
510        unsafe extern "C" fn copy_clipboard_trampoline<F: Fn(&Label) + 'static>(
511            this: *mut ffi::GtkLabel,
512            f: glib::ffi::gpointer,
513        ) {
514            let f: &F = &*(f as *const F);
515            f(&from_glib_borrow(this))
516        }
517        unsafe {
518            let f: Box_<F> = Box_::new(f);
519            connect_raw(
520                self.as_ptr() as *mut _,
521                c"copy-clipboard".as_ptr() as *const _,
522                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
523                    copy_clipboard_trampoline::<F> as *const (),
524                )),
525                Box_::into_raw(f),
526            )
527        }
528    }
529
530    pub fn emit_copy_clipboard(&self) {
531        self.emit_by_name::<()>("copy-clipboard", &[]);
532    }
533
534    #[doc(alias = "move-cursor")]
535    pub fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
536        &self,
537        f: F,
538    ) -> SignalHandlerId {
539        unsafe extern "C" fn move_cursor_trampoline<
540            F: Fn(&Label, MovementStep, i32, bool) + 'static,
541        >(
542            this: *mut ffi::GtkLabel,
543            step: ffi::GtkMovementStep,
544            count: std::ffi::c_int,
545            extend_selection: glib::ffi::gboolean,
546            f: glib::ffi::gpointer,
547        ) {
548            let f: &F = &*(f as *const F);
549            f(
550                &from_glib_borrow(this),
551                from_glib(step),
552                count,
553                from_glib(extend_selection),
554            )
555        }
556        unsafe {
557            let f: Box_<F> = Box_::new(f);
558            connect_raw(
559                self.as_ptr() as *mut _,
560                c"move-cursor".as_ptr() as *const _,
561                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
562                    move_cursor_trampoline::<F> as *const (),
563                )),
564                Box_::into_raw(f),
565            )
566        }
567    }
568
569    pub fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) {
570        self.emit_by_name::<()>("move-cursor", &[&step, &count, &extend_selection]);
571    }
572
573    #[doc(alias = "attributes")]
574    pub fn connect_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
575        unsafe extern "C" fn notify_attributes_trampoline<F: Fn(&Label) + 'static>(
576            this: *mut ffi::GtkLabel,
577            _param_spec: glib::ffi::gpointer,
578            f: glib::ffi::gpointer,
579        ) {
580            let f: &F = &*(f as *const F);
581            f(&from_glib_borrow(this))
582        }
583        unsafe {
584            let f: Box_<F> = Box_::new(f);
585            connect_raw(
586                self.as_ptr() as *mut _,
587                c"notify::attributes".as_ptr() as *const _,
588                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
589                    notify_attributes_trampoline::<F> as *const (),
590                )),
591                Box_::into_raw(f),
592            )
593        }
594    }
595
596    #[doc(alias = "ellipsize")]
597    pub fn connect_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
598        unsafe extern "C" fn notify_ellipsize_trampoline<F: Fn(&Label) + 'static>(
599            this: *mut ffi::GtkLabel,
600            _param_spec: glib::ffi::gpointer,
601            f: glib::ffi::gpointer,
602        ) {
603            let f: &F = &*(f as *const F);
604            f(&from_glib_borrow(this))
605        }
606        unsafe {
607            let f: Box_<F> = Box_::new(f);
608            connect_raw(
609                self.as_ptr() as *mut _,
610                c"notify::ellipsize".as_ptr() as *const _,
611                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
612                    notify_ellipsize_trampoline::<F> as *const (),
613                )),
614                Box_::into_raw(f),
615            )
616        }
617    }
618
619    #[doc(alias = "extra-menu")]
620    pub fn connect_extra_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
621        unsafe extern "C" fn notify_extra_menu_trampoline<F: Fn(&Label) + 'static>(
622            this: *mut ffi::GtkLabel,
623            _param_spec: glib::ffi::gpointer,
624            f: glib::ffi::gpointer,
625        ) {
626            let f: &F = &*(f as *const F);
627            f(&from_glib_borrow(this))
628        }
629        unsafe {
630            let f: Box_<F> = Box_::new(f);
631            connect_raw(
632                self.as_ptr() as *mut _,
633                c"notify::extra-menu".as_ptr() as *const _,
634                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
635                    notify_extra_menu_trampoline::<F> as *const (),
636                )),
637                Box_::into_raw(f),
638            )
639        }
640    }
641
642    #[doc(alias = "justify")]
643    pub fn connect_justify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
644        unsafe extern "C" fn notify_justify_trampoline<F: Fn(&Label) + 'static>(
645            this: *mut ffi::GtkLabel,
646            _param_spec: glib::ffi::gpointer,
647            f: glib::ffi::gpointer,
648        ) {
649            let f: &F = &*(f as *const F);
650            f(&from_glib_borrow(this))
651        }
652        unsafe {
653            let f: Box_<F> = Box_::new(f);
654            connect_raw(
655                self.as_ptr() as *mut _,
656                c"notify::justify".as_ptr() as *const _,
657                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
658                    notify_justify_trampoline::<F> as *const (),
659                )),
660                Box_::into_raw(f),
661            )
662        }
663    }
664
665    #[doc(alias = "label")]
666    pub fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
667        unsafe extern "C" fn notify_label_trampoline<F: Fn(&Label) + 'static>(
668            this: *mut ffi::GtkLabel,
669            _param_spec: glib::ffi::gpointer,
670            f: glib::ffi::gpointer,
671        ) {
672            let f: &F = &*(f as *const F);
673            f(&from_glib_borrow(this))
674        }
675        unsafe {
676            let f: Box_<F> = Box_::new(f);
677            connect_raw(
678                self.as_ptr() as *mut _,
679                c"notify::label".as_ptr() as *const _,
680                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
681                    notify_label_trampoline::<F> as *const (),
682                )),
683                Box_::into_raw(f),
684            )
685        }
686    }
687
688    #[doc(alias = "lines")]
689    pub fn connect_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
690        unsafe extern "C" fn notify_lines_trampoline<F: Fn(&Label) + 'static>(
691            this: *mut ffi::GtkLabel,
692            _param_spec: glib::ffi::gpointer,
693            f: glib::ffi::gpointer,
694        ) {
695            let f: &F = &*(f as *const F);
696            f(&from_glib_borrow(this))
697        }
698        unsafe {
699            let f: Box_<F> = Box_::new(f);
700            connect_raw(
701                self.as_ptr() as *mut _,
702                c"notify::lines".as_ptr() as *const _,
703                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
704                    notify_lines_trampoline::<F> as *const (),
705                )),
706                Box_::into_raw(f),
707            )
708        }
709    }
710
711    #[doc(alias = "max-width-chars")]
712    pub fn connect_max_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
713        unsafe extern "C" fn notify_max_width_chars_trampoline<F: Fn(&Label) + 'static>(
714            this: *mut ffi::GtkLabel,
715            _param_spec: glib::ffi::gpointer,
716            f: glib::ffi::gpointer,
717        ) {
718            let f: &F = &*(f as *const F);
719            f(&from_glib_borrow(this))
720        }
721        unsafe {
722            let f: Box_<F> = Box_::new(f);
723            connect_raw(
724                self.as_ptr() as *mut _,
725                c"notify::max-width-chars".as_ptr() as *const _,
726                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
727                    notify_max_width_chars_trampoline::<F> as *const (),
728                )),
729                Box_::into_raw(f),
730            )
731        }
732    }
733
734    #[doc(alias = "mnemonic-keyval")]
735    pub fn connect_mnemonic_keyval_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
736        unsafe extern "C" fn notify_mnemonic_keyval_trampoline<F: Fn(&Label) + 'static>(
737            this: *mut ffi::GtkLabel,
738            _param_spec: glib::ffi::gpointer,
739            f: glib::ffi::gpointer,
740        ) {
741            let f: &F = &*(f as *const F);
742            f(&from_glib_borrow(this))
743        }
744        unsafe {
745            let f: Box_<F> = Box_::new(f);
746            connect_raw(
747                self.as_ptr() as *mut _,
748                c"notify::mnemonic-keyval".as_ptr() as *const _,
749                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
750                    notify_mnemonic_keyval_trampoline::<F> as *const (),
751                )),
752                Box_::into_raw(f),
753            )
754        }
755    }
756
757    #[doc(alias = "mnemonic-widget")]
758    pub fn connect_mnemonic_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
759        unsafe extern "C" fn notify_mnemonic_widget_trampoline<F: Fn(&Label) + 'static>(
760            this: *mut ffi::GtkLabel,
761            _param_spec: glib::ffi::gpointer,
762            f: glib::ffi::gpointer,
763        ) {
764            let f: &F = &*(f as *const F);
765            f(&from_glib_borrow(this))
766        }
767        unsafe {
768            let f: Box_<F> = Box_::new(f);
769            connect_raw(
770                self.as_ptr() as *mut _,
771                c"notify::mnemonic-widget".as_ptr() as *const _,
772                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
773                    notify_mnemonic_widget_trampoline::<F> as *const (),
774                )),
775                Box_::into_raw(f),
776            )
777        }
778    }
779
780    #[cfg(feature = "v4_6")]
781    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
782    #[doc(alias = "natural-wrap-mode")]
783    pub fn connect_natural_wrap_mode_notify<F: Fn(&Self) + 'static>(
784        &self,
785        f: F,
786    ) -> SignalHandlerId {
787        unsafe extern "C" fn notify_natural_wrap_mode_trampoline<F: Fn(&Label) + 'static>(
788            this: *mut ffi::GtkLabel,
789            _param_spec: glib::ffi::gpointer,
790            f: glib::ffi::gpointer,
791        ) {
792            let f: &F = &*(f as *const F);
793            f(&from_glib_borrow(this))
794        }
795        unsafe {
796            let f: Box_<F> = Box_::new(f);
797            connect_raw(
798                self.as_ptr() as *mut _,
799                c"notify::natural-wrap-mode".as_ptr() as *const _,
800                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
801                    notify_natural_wrap_mode_trampoline::<F> as *const (),
802                )),
803                Box_::into_raw(f),
804            )
805        }
806    }
807
808    #[doc(alias = "selectable")]
809    pub fn connect_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
810        unsafe extern "C" fn notify_selectable_trampoline<F: Fn(&Label) + 'static>(
811            this: *mut ffi::GtkLabel,
812            _param_spec: glib::ffi::gpointer,
813            f: glib::ffi::gpointer,
814        ) {
815            let f: &F = &*(f as *const F);
816            f(&from_glib_borrow(this))
817        }
818        unsafe {
819            let f: Box_<F> = Box_::new(f);
820            connect_raw(
821                self.as_ptr() as *mut _,
822                c"notify::selectable".as_ptr() as *const _,
823                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
824                    notify_selectable_trampoline::<F> as *const (),
825                )),
826                Box_::into_raw(f),
827            )
828        }
829    }
830
831    #[doc(alias = "single-line-mode")]
832    pub fn connect_single_line_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
833        unsafe extern "C" fn notify_single_line_mode_trampoline<F: Fn(&Label) + 'static>(
834            this: *mut ffi::GtkLabel,
835            _param_spec: glib::ffi::gpointer,
836            f: glib::ffi::gpointer,
837        ) {
838            let f: &F = &*(f as *const F);
839            f(&from_glib_borrow(this))
840        }
841        unsafe {
842            let f: Box_<F> = Box_::new(f);
843            connect_raw(
844                self.as_ptr() as *mut _,
845                c"notify::single-line-mode".as_ptr() as *const _,
846                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
847                    notify_single_line_mode_trampoline::<F> as *const (),
848                )),
849                Box_::into_raw(f),
850            )
851        }
852    }
853
854    #[cfg(feature = "v4_8")]
855    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
856    #[doc(alias = "tabs")]
857    pub fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
858        unsafe extern "C" fn notify_tabs_trampoline<F: Fn(&Label) + 'static>(
859            this: *mut ffi::GtkLabel,
860            _param_spec: glib::ffi::gpointer,
861            f: glib::ffi::gpointer,
862        ) {
863            let f: &F = &*(f as *const F);
864            f(&from_glib_borrow(this))
865        }
866        unsafe {
867            let f: Box_<F> = Box_::new(f);
868            connect_raw(
869                self.as_ptr() as *mut _,
870                c"notify::tabs".as_ptr() as *const _,
871                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
872                    notify_tabs_trampoline::<F> as *const (),
873                )),
874                Box_::into_raw(f),
875            )
876        }
877    }
878
879    #[doc(alias = "use-markup")]
880    pub fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
881        unsafe extern "C" fn notify_use_markup_trampoline<F: Fn(&Label) + 'static>(
882            this: *mut ffi::GtkLabel,
883            _param_spec: glib::ffi::gpointer,
884            f: glib::ffi::gpointer,
885        ) {
886            let f: &F = &*(f as *const F);
887            f(&from_glib_borrow(this))
888        }
889        unsafe {
890            let f: Box_<F> = Box_::new(f);
891            connect_raw(
892                self.as_ptr() as *mut _,
893                c"notify::use-markup".as_ptr() as *const _,
894                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
895                    notify_use_markup_trampoline::<F> as *const (),
896                )),
897                Box_::into_raw(f),
898            )
899        }
900    }
901
902    #[doc(alias = "use-underline")]
903    pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
904        unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&Label) + 'static>(
905            this: *mut ffi::GtkLabel,
906            _param_spec: glib::ffi::gpointer,
907            f: glib::ffi::gpointer,
908        ) {
909            let f: &F = &*(f as *const F);
910            f(&from_glib_borrow(this))
911        }
912        unsafe {
913            let f: Box_<F> = Box_::new(f);
914            connect_raw(
915                self.as_ptr() as *mut _,
916                c"notify::use-underline".as_ptr() as *const _,
917                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
918                    notify_use_underline_trampoline::<F> as *const (),
919                )),
920                Box_::into_raw(f),
921            )
922        }
923    }
924
925    #[doc(alias = "width-chars")]
926    pub fn connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
927        unsafe extern "C" fn notify_width_chars_trampoline<F: Fn(&Label) + 'static>(
928            this: *mut ffi::GtkLabel,
929            _param_spec: glib::ffi::gpointer,
930            f: glib::ffi::gpointer,
931        ) {
932            let f: &F = &*(f as *const F);
933            f(&from_glib_borrow(this))
934        }
935        unsafe {
936            let f: Box_<F> = Box_::new(f);
937            connect_raw(
938                self.as_ptr() as *mut _,
939                c"notify::width-chars".as_ptr() as *const _,
940                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
941                    notify_width_chars_trampoline::<F> as *const (),
942                )),
943                Box_::into_raw(f),
944            )
945        }
946    }
947
948    #[doc(alias = "wrap")]
949    pub fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
950        unsafe extern "C" fn notify_wrap_trampoline<F: Fn(&Label) + 'static>(
951            this: *mut ffi::GtkLabel,
952            _param_spec: glib::ffi::gpointer,
953            f: glib::ffi::gpointer,
954        ) {
955            let f: &F = &*(f as *const F);
956            f(&from_glib_borrow(this))
957        }
958        unsafe {
959            let f: Box_<F> = Box_::new(f);
960            connect_raw(
961                self.as_ptr() as *mut _,
962                c"notify::wrap".as_ptr() as *const _,
963                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
964                    notify_wrap_trampoline::<F> as *const (),
965                )),
966                Box_::into_raw(f),
967            )
968        }
969    }
970
971    #[doc(alias = "wrap-mode")]
972    pub fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
973        unsafe extern "C" fn notify_wrap_mode_trampoline<F: Fn(&Label) + 'static>(
974            this: *mut ffi::GtkLabel,
975            _param_spec: glib::ffi::gpointer,
976            f: glib::ffi::gpointer,
977        ) {
978            let f: &F = &*(f as *const F);
979            f(&from_glib_borrow(this))
980        }
981        unsafe {
982            let f: Box_<F> = Box_::new(f);
983            connect_raw(
984                self.as_ptr() as *mut _,
985                c"notify::wrap-mode".as_ptr() as *const _,
986                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
987                    notify_wrap_mode_trampoline::<F> as *const (),
988                )),
989                Box_::into_raw(f),
990            )
991        }
992    }
993
994    #[doc(alias = "xalign")]
995    pub fn connect_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
996        unsafe extern "C" fn notify_xalign_trampoline<F: Fn(&Label) + 'static>(
997            this: *mut ffi::GtkLabel,
998            _param_spec: glib::ffi::gpointer,
999            f: glib::ffi::gpointer,
1000        ) {
1001            let f: &F = &*(f as *const F);
1002            f(&from_glib_borrow(this))
1003        }
1004        unsafe {
1005            let f: Box_<F> = Box_::new(f);
1006            connect_raw(
1007                self.as_ptr() as *mut _,
1008                c"notify::xalign".as_ptr() as *const _,
1009                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1010                    notify_xalign_trampoline::<F> as *const (),
1011                )),
1012                Box_::into_raw(f),
1013            )
1014        }
1015    }
1016
1017    #[doc(alias = "yalign")]
1018    pub fn connect_yalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1019        unsafe extern "C" fn notify_yalign_trampoline<F: Fn(&Label) + 'static>(
1020            this: *mut ffi::GtkLabel,
1021            _param_spec: glib::ffi::gpointer,
1022            f: glib::ffi::gpointer,
1023        ) {
1024            let f: &F = &*(f as *const F);
1025            f(&from_glib_borrow(this))
1026        }
1027        unsafe {
1028            let f: Box_<F> = Box_::new(f);
1029            connect_raw(
1030                self.as_ptr() as *mut _,
1031                c"notify::yalign".as_ptr() as *const _,
1032                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1033                    notify_yalign_trampoline::<F> as *const (),
1034                )),
1035                Box_::into_raw(f),
1036            )
1037        }
1038    }
1039}
1040
1041impl Default for Label {
1042    fn default() -> Self {
1043        glib::object::Object::new::<Self>()
1044    }
1045}
1046
1047// rustdoc-stripper-ignore-next
1048/// A [builder-pattern] type to construct [`Label`] objects.
1049///
1050/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1051#[must_use = "The builder must be built to be used"]
1052pub struct LabelBuilder {
1053    builder: glib::object::ObjectBuilder<'static, Label>,
1054}
1055
1056impl LabelBuilder {
1057    fn new() -> Self {
1058        Self {
1059            builder: glib::object::Object::builder(),
1060        }
1061    }
1062
1063    pub fn attributes(self, attributes: &pango::AttrList) -> Self {
1064        Self {
1065            builder: self.builder.property("attributes", attributes.clone()),
1066        }
1067    }
1068
1069    pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
1070        Self {
1071            builder: self.builder.property("ellipsize", ellipsize),
1072        }
1073    }
1074
1075    pub fn extra_menu(self, extra_menu: &impl IsA<gio::MenuModel>) -> Self {
1076        Self {
1077            builder: self
1078                .builder
1079                .property("extra-menu", extra_menu.clone().upcast()),
1080        }
1081    }
1082
1083    pub fn justify(self, justify: Justification) -> Self {
1084        Self {
1085            builder: self.builder.property("justify", justify),
1086        }
1087    }
1088
1089    pub fn label(self, label: impl Into<glib::GString>) -> Self {
1090        Self {
1091            builder: self.builder.property("label", label.into()),
1092        }
1093    }
1094
1095    pub fn lines(self, lines: i32) -> Self {
1096        Self {
1097            builder: self.builder.property("lines", lines),
1098        }
1099    }
1100
1101    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
1102        Self {
1103            builder: self.builder.property("max-width-chars", max_width_chars),
1104        }
1105    }
1106
1107    pub fn mnemonic_widget(self, mnemonic_widget: &impl IsA<Widget>) -> Self {
1108        Self {
1109            builder: self
1110                .builder
1111                .property("mnemonic-widget", mnemonic_widget.clone().upcast()),
1112        }
1113    }
1114
1115    #[cfg(feature = "v4_6")]
1116    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1117    pub fn natural_wrap_mode(self, natural_wrap_mode: NaturalWrapMode) -> Self {
1118        Self {
1119            builder: self
1120                .builder
1121                .property("natural-wrap-mode", natural_wrap_mode),
1122        }
1123    }
1124
1125    pub fn selectable(self, selectable: bool) -> Self {
1126        Self {
1127            builder: self.builder.property("selectable", selectable),
1128        }
1129    }
1130
1131    pub fn single_line_mode(self, single_line_mode: bool) -> Self {
1132        Self {
1133            builder: self.builder.property("single-line-mode", single_line_mode),
1134        }
1135    }
1136
1137    #[cfg(feature = "v4_8")]
1138    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1139    pub fn tabs(self, tabs: &pango::TabArray) -> Self {
1140        Self {
1141            builder: self.builder.property("tabs", tabs),
1142        }
1143    }
1144
1145    pub fn use_markup(self, use_markup: bool) -> Self {
1146        Self {
1147            builder: self.builder.property("use-markup", use_markup),
1148        }
1149    }
1150
1151    pub fn use_underline(self, use_underline: bool) -> Self {
1152        Self {
1153            builder: self.builder.property("use-underline", use_underline),
1154        }
1155    }
1156
1157    pub fn width_chars(self, width_chars: i32) -> Self {
1158        Self {
1159            builder: self.builder.property("width-chars", width_chars),
1160        }
1161    }
1162
1163    pub fn wrap(self, wrap: bool) -> Self {
1164        Self {
1165            builder: self.builder.property("wrap", wrap),
1166        }
1167    }
1168
1169    pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
1170        Self {
1171            builder: self.builder.property("wrap-mode", wrap_mode),
1172        }
1173    }
1174
1175    pub fn xalign(self, xalign: f32) -> Self {
1176        Self {
1177            builder: self.builder.property("xalign", xalign),
1178        }
1179    }
1180
1181    pub fn yalign(self, yalign: f32) -> Self {
1182        Self {
1183            builder: self.builder.property("yalign", yalign),
1184        }
1185    }
1186
1187    pub fn can_focus(self, can_focus: bool) -> Self {
1188        Self {
1189            builder: self.builder.property("can-focus", can_focus),
1190        }
1191    }
1192
1193    pub fn can_target(self, can_target: bool) -> Self {
1194        Self {
1195            builder: self.builder.property("can-target", can_target),
1196        }
1197    }
1198
1199    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1200        Self {
1201            builder: self.builder.property("css-classes", css_classes.into()),
1202        }
1203    }
1204
1205    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1206        Self {
1207            builder: self.builder.property("css-name", css_name.into()),
1208        }
1209    }
1210
1211    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1212        Self {
1213            builder: self.builder.property("cursor", cursor.clone()),
1214        }
1215    }
1216
1217    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1218        Self {
1219            builder: self.builder.property("focus-on-click", focus_on_click),
1220        }
1221    }
1222
1223    pub fn focusable(self, focusable: bool) -> Self {
1224        Self {
1225            builder: self.builder.property("focusable", focusable),
1226        }
1227    }
1228
1229    pub fn halign(self, halign: Align) -> Self {
1230        Self {
1231            builder: self.builder.property("halign", halign),
1232        }
1233    }
1234
1235    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1236        Self {
1237            builder: self.builder.property("has-tooltip", has_tooltip),
1238        }
1239    }
1240
1241    pub fn height_request(self, height_request: i32) -> Self {
1242        Self {
1243            builder: self.builder.property("height-request", height_request),
1244        }
1245    }
1246
1247    pub fn hexpand(self, hexpand: bool) -> Self {
1248        Self {
1249            builder: self.builder.property("hexpand", hexpand),
1250        }
1251    }
1252
1253    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1254        Self {
1255            builder: self.builder.property("hexpand-set", hexpand_set),
1256        }
1257    }
1258
1259    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1260        Self {
1261            builder: self
1262                .builder
1263                .property("layout-manager", layout_manager.clone().upcast()),
1264        }
1265    }
1266
1267    #[cfg(feature = "v4_18")]
1268    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1269    pub fn limit_events(self, limit_events: bool) -> Self {
1270        Self {
1271            builder: self.builder.property("limit-events", limit_events),
1272        }
1273    }
1274
1275    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1276        Self {
1277            builder: self.builder.property("margin-bottom", margin_bottom),
1278        }
1279    }
1280
1281    pub fn margin_end(self, margin_end: i32) -> Self {
1282        Self {
1283            builder: self.builder.property("margin-end", margin_end),
1284        }
1285    }
1286
1287    pub fn margin_start(self, margin_start: i32) -> Self {
1288        Self {
1289            builder: self.builder.property("margin-start", margin_start),
1290        }
1291    }
1292
1293    pub fn margin_top(self, margin_top: i32) -> Self {
1294        Self {
1295            builder: self.builder.property("margin-top", margin_top),
1296        }
1297    }
1298
1299    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1300        Self {
1301            builder: self.builder.property("name", name.into()),
1302        }
1303    }
1304
1305    pub fn opacity(self, opacity: f64) -> Self {
1306        Self {
1307            builder: self.builder.property("opacity", opacity),
1308        }
1309    }
1310
1311    pub fn overflow(self, overflow: Overflow) -> Self {
1312        Self {
1313            builder: self.builder.property("overflow", overflow),
1314        }
1315    }
1316
1317    pub fn receives_default(self, receives_default: bool) -> Self {
1318        Self {
1319            builder: self.builder.property("receives-default", receives_default),
1320        }
1321    }
1322
1323    pub fn sensitive(self, sensitive: bool) -> Self {
1324        Self {
1325            builder: self.builder.property("sensitive", sensitive),
1326        }
1327    }
1328
1329    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1330        Self {
1331            builder: self
1332                .builder
1333                .property("tooltip-markup", tooltip_markup.into()),
1334        }
1335    }
1336
1337    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1338        Self {
1339            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1340        }
1341    }
1342
1343    pub fn valign(self, valign: Align) -> Self {
1344        Self {
1345            builder: self.builder.property("valign", valign),
1346        }
1347    }
1348
1349    pub fn vexpand(self, vexpand: bool) -> Self {
1350        Self {
1351            builder: self.builder.property("vexpand", vexpand),
1352        }
1353    }
1354
1355    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1356        Self {
1357            builder: self.builder.property("vexpand-set", vexpand_set),
1358        }
1359    }
1360
1361    pub fn visible(self, visible: bool) -> Self {
1362        Self {
1363            builder: self.builder.property("visible", visible),
1364        }
1365    }
1366
1367    pub fn width_request(self, width_request: i32) -> Self {
1368        Self {
1369            builder: self.builder.property("width-request", width_request),
1370        }
1371    }
1372
1373    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1374        Self {
1375            builder: self.builder.property("accessible-role", accessible_role),
1376        }
1377    }
1378
1379    // rustdoc-stripper-ignore-next
1380    /// Build the [`Label`].
1381    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1382    pub fn build(self) -> Label {
1383        assert_initialized_main_thread!();
1384        self.builder.build()
1385    }
1386}