Skip to main content

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_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::Accessible;
8#[cfg(feature = "v4_22")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
10use crate::AccessibleHypertext;
11#[cfg(feature = "v4_14")]
12#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
13use crate::AccessibleText;
14#[cfg(feature = "v4_6")]
15#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
16use crate::NaturalWrapMode;
17use crate::{
18    AccessibleRole, Align, Buildable, ConstraintTarget, Justification, LayoutManager, MovementStep,
19    Overflow, Widget, ffi,
20};
21use glib::{
22    object::ObjectType as _,
23    prelude::*,
24    signal::{SignalHandlerId, connect_raw},
25    translate::*,
26};
27use std::boxed::Box as Box_;
28
29#[cfg(all(feature = "v4_10", feature = "v4_14", feature = "v4_22"))]
30#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
31glib::wrapper! {
32    ///  for more...";
33    /// GtkWidget *label = gtk_label_new (NULL);
34    /// gtk_label_set_markup (GTK_LABEL (label), text);
35    /// ```text
36    ///
37    /// It is possible to implement custom handling for links and their tooltips
38    /// with the [`activate-link`][struct@crate::Label#activate-link] signal and the
39    /// [`current_uri()`][Self::current_uri()] function.
40    ///
41    /// ## Properties
42    ///
43    ///
44    /// #### `attributes`
45    ///  A list of style attributes to apply to the text of the label.
46    ///
47    /// Readable | Writable
48    ///
49    ///
50    /// #### `ellipsize`
51    ///  The preferred place to ellipsize the string, if the label does
52    /// not have enough room to display the entire string.
53    ///
54    /// Note that setting this property to a value other than
55    /// [enum.Pango.EllipsizeMode.none] has the side-effect that the label requests
56    /// only enough space to display the ellipsis "...". In particular, this
57    /// means that ellipsizing labels do not work well in notebook tabs, unless
58    /// the [`tab-expand`][struct@crate::NotebookPage#tab-expand] child property is set to true.
59    ///
60    /// Other ways to set a label's width are [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()]
61    /// and [`Label::set_width_chars()`][crate::Label::set_width_chars()].
62    ///
63    /// Readable | Writable
64    ///
65    ///
66    /// #### `extra-menu`
67    ///  A menu model whose contents will be appended to the context menu.
68    ///
69    /// Readable | Writable
70    ///
71    ///
72    /// #### `justify`
73    ///  The alignment of the lines in the text of the label, relative to each other.
74    ///
75    /// This does *not* affect the alignment of the label within its allocation.
76    /// See [`xalign`][struct@crate::Label#xalign] for that.
77    ///
78    /// Readable | Writable
79    ///
80    ///
81    /// #### `label`
82    ///  The contents of the label.
83    ///
84    /// If the string contains Pango markup (see `parse_markup()`),
85    /// you will have to set the [`use-markup`][struct@crate::Label#use-markup] property to
86    /// true in order for the label to display the markup attributes. See also
87    /// [`Label::set_markup()`][crate::Label::set_markup()] for a convenience function that sets both
88    /// this property and the [`use-markup`][struct@crate::Label#use-markup] property at the
89    /// same time.
90    ///
91    /// If the string contains underlines acting as mnemonics, you will have to
92    /// set the [`use-underline`][struct@crate::Label#use-underline] property to true in order
93    /// for the label to display them.
94    ///
95    /// Readable | Writable
96    ///
97    ///
98    /// #### `lines`
99    ///  The number of lines to which an ellipsized, wrapping label
100    /// should display before it gets ellipsized. This both prevents the label
101    /// from ellipsizing before this many lines are displayed, and limits the
102    /// height request of the label to this many lines.
103    ///
104    /// ::: warning
105    ///     Setting this property has unintuitive and unfortunate consequences
106    ///     for the minimum _width_ of the label. Specifically, if the height
107    ///     of the label is such that it fits a smaller number of lines than
108    ///     the value of this property, the label can not be ellipsized at all,
109    ///     which means it must be wide enough to fit all the text fully.
110    ///
111    /// This property has no effect if the label is not wrapping or ellipsized.
112    ///
113    /// Set this property to -1 if you don't want to limit the number of lines.
114    ///
115    /// Readable | Writable
116    ///
117    ///
118    /// #### `max-width-chars`
119    ///  The desired maximum width of the label, in characters.
120    ///
121    /// If this property is set to -1, the width will be calculated automatically.
122    ///
123    /// See the section on [text layout](class.Label.html#text-layout) for details
124    /// of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
125    /// determine the width of ellipsized and wrapped labels.
126    ///
127    /// Readable | Writable
128    ///
129    ///
130    /// #### `mnemonic-keyval`
131    ///  The mnemonic accelerator key for the label.
132    ///
133    /// Readable
134    ///
135    ///
136    /// #### `mnemonic-widget`
137    ///  The widget to be activated when the labels mnemonic key is pressed.
138    ///
139    /// Readable | Writable
140    ///
141    ///
142    /// #### `natural-wrap-mode`
143    ///  Select the line wrapping for the natural size request.
144    ///
145    /// This only affects the natural size requested. For the actual wrapping
146    /// used, see the [`wrap-mode`][struct@crate::Label#wrap-mode] property.
147    ///
148    /// The default is [enum@Gtk.NaturalWrapMode.inherit], which inherits
149    /// the behavior of the [`wrap-mode`][struct@crate::Label#wrap-mode] property.
150    ///
151    /// Readable | Writable
152    ///
153    ///
154    /// #### `selectable`
155    ///  Whether the label text can be selected with the mouse.
156    ///
157    /// Readable | Writable
158    ///
159    ///
160    /// #### `single-line-mode`
161    ///  Whether the label is in single line mode.
162    ///
163    /// In single line mode, the height of the label does not depend on the
164    /// actual text, it is always set to ascent + descent of the font. This
165    /// can be an advantage in situations where resizing the label because
166    /// of text changes would be distracting, e.g. in a statusbar.
167    ///
168    /// Readable | Writable
169    ///
170    ///
171    /// #### `tabs`
172    ///  Custom tabs for this label.
173    ///
174    /// Readable | Writable
175    ///
176    ///
177    /// #### `use-markup`
178    ///  True if the text of the label includes Pango markup.
179    ///
180    /// See `parse_markup()`.
181    ///
182    /// Readable | Writable
183    ///
184    ///
185    /// #### `use-underline`
186    ///  True if the text of the label indicates a mnemonic with an `_`
187    /// before the mnemonic character.
188    ///
189    /// Readable | Writable
190    ///
191    ///
192    /// #### `width-chars`
193    ///  The desired width of the label, in characters.
194    ///
195    /// If this property is set to -1, the width will be calculated automatically.
196    ///
197    /// See the section on [text layout](class.Label.html#text-layout) for details
198    /// of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
199    /// determine the width of ellipsized and wrapped labels.
200    ///
201    /// Readable | Writable
202    ///
203    ///
204    /// #### `wrap`
205    ///  True if the label text will wrap if it gets too wide.
206    ///
207    /// Readable | Writable
208    ///
209    ///
210    /// #### `wrap-mode`
211    ///  Controls how the line wrapping is done.
212    ///
213    /// This only affects the formatting if line wrapping is on (see the
214    /// [`wrap`][struct@crate::Label#wrap] property). The default is [enum@Pango.WrapMode.word],
215    /// which means wrap on word boundaries.
216    ///
217    /// For sizing behavior, also consider the [`natural-wrap-mode`][struct@crate::Label#natural-wrap-mode]
218    /// property.
219    ///
220    /// Readable | Writable
221    ///
222    ///
223    /// #### `xalign`
224    ///  The horizontal alignment of the label text inside its size allocation.
225    ///
226    /// Compare this to [`halign`][struct@crate::Widget#halign], which determines how the
227    /// labels size allocation is positioned in the space available for the label.
228    ///
229    /// Readable | Writable
230    ///
231    ///
232    /// #### `yalign`
233    ///  The vertical alignment of the label text inside its size allocation.
234    ///
235    /// Compare this to [`valign`][struct@crate::Widget#valign], which determines how the
236    /// labels size allocation is positioned in the space available for the label.
237    ///
238    /// Readable | Writable
239    /// <details><summary><h4>Widget</h4></summary>
240    ///
241    ///
242    /// #### `can-focus`
243    ///  Whether the widget or any of its descendents can accept
244    /// the input focus.
245    ///
246    /// This property is meant to be set by widget implementations,
247    /// typically in their instance init function.
248    ///
249    /// Readable | Writable
250    ///
251    ///
252    /// #### `can-target`
253    ///  Whether the widget can receive pointer events.
254    ///
255    /// Readable | Writable
256    ///
257    ///
258    /// #### `css-classes`
259    ///  A list of css classes applied to this widget.
260    ///
261    /// Readable | Writable
262    ///
263    ///
264    /// #### `css-name`
265    ///  The name of this widget in the CSS tree.
266    ///
267    /// This property is meant to be set by widget implementations,
268    /// typically in their instance init function.
269    ///
270    /// Readable | Writable | Construct Only
271    ///
272    ///
273    /// #### `cursor`
274    ///  The cursor used by @widget.
275    ///
276    /// Readable | Writable
277    ///
278    ///
279    /// #### `focus-on-click`
280    ///  Whether the widget should grab focus when it is clicked with the mouse.
281    ///
282    /// This property is only relevant for widgets that can take focus.
283    ///
284    /// Readable | Writable
285    ///
286    ///
287    /// #### `focusable`
288    ///  Whether this widget itself will accept the input focus.
289    ///
290    /// Readable | Writable
291    ///
292    ///
293    /// #### `halign`
294    ///  How to distribute horizontal space if widget gets extra space.
295    ///
296    /// Readable | Writable
297    ///
298    ///
299    /// #### `has-default`
300    ///  Whether the widget is the default widget.
301    ///
302    /// Readable
303    ///
304    ///
305    /// #### `has-focus`
306    ///  Whether the widget has the input focus.
307    ///
308    /// Readable
309    ///
310    ///
311    /// #### `has-tooltip`
312    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
313    /// signal on @widget.
314    ///
315    /// A true value indicates that @widget can have a tooltip, in this case
316    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
317    /// determine whether it will provide a tooltip or not.
318    ///
319    /// Readable | Writable
320    ///
321    ///
322    /// #### `height-request`
323    ///  Overrides for height request of the widget.
324    ///
325    /// If this is -1, the natural request will be used.
326    ///
327    /// Readable | Writable
328    ///
329    ///
330    /// #### `hexpand`
331    ///  Whether to expand horizontally.
332    ///
333    /// Readable | Writable
334    ///
335    ///
336    /// #### `hexpand-set`
337    ///  Whether to use the `hexpand` property.
338    ///
339    /// Readable | Writable
340    ///
341    ///
342    /// #### `layout-manager`
343    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
344    /// the preferred size of the widget, and allocate its children.
345    ///
346    /// This property is meant to be set by widget implementations,
347    /// typically in their instance init function.
348    ///
349    /// Readable | Writable
350    ///
351    ///
352    /// #### `limit-events`
353    ///  Makes this widget act like a modal dialog, with respect to
354    /// event delivery.
355    ///
356    /// Global event controllers will not handle events with targets
357    /// inside the widget, unless they are set up to ignore propagation
358    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
359    ///
360    /// Readable | Writable
361    ///
362    ///
363    /// #### `margin-bottom`
364    ///  Margin on bottom side of widget.
365    ///
366    /// This property adds margin outside of the widget's normal size
367    /// request, the margin will be added in addition to the size from
368    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
369    ///
370    /// Readable | Writable
371    ///
372    ///
373    /// #### `margin-end`
374    ///  Margin on end of widget, horizontally.
375    ///
376    /// This property supports left-to-right and right-to-left text
377    /// directions.
378    ///
379    /// This property adds margin outside of the widget's normal size
380    /// request, the margin will be added in addition to the size from
381    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
382    ///
383    /// Readable | Writable
384    ///
385    ///
386    /// #### `margin-start`
387    ///  Margin on start of widget, horizontally.
388    ///
389    /// This property supports left-to-right and right-to-left text
390    /// directions.
391    ///
392    /// This property adds margin outside of the widget's normal size
393    /// request, the margin will be added in addition to the size from
394    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
395    ///
396    /// Readable | Writable
397    ///
398    ///
399    /// #### `margin-top`
400    ///  Margin on top side of widget.
401    ///
402    /// This property adds margin outside of the widget's normal size
403    /// request, the margin will be added in addition to the size from
404    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
405    ///
406    /// Readable | Writable
407    ///
408    ///
409    /// #### `name`
410    ///  The name of the widget.
411    ///
412    /// Readable | Writable
413    ///
414    ///
415    /// #### `opacity`
416    ///  The requested opacity of the widget.
417    ///
418    /// Readable | Writable
419    ///
420    ///
421    /// #### `overflow`
422    ///  How content outside the widget's content area is treated.
423    ///
424    /// This property is meant to be set by widget implementations,
425    /// typically in their instance init function.
426    ///
427    /// Readable | Writable
428    ///
429    ///
430    /// #### `parent`
431    ///  The parent widget of this widget.
432    ///
433    /// Readable
434    ///
435    ///
436    /// #### `receives-default`
437    ///  Whether the widget will receive the default action when it is focused.
438    ///
439    /// Readable | Writable
440    ///
441    ///
442    /// #### `root`
443    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
444    ///
445    /// This will be `NULL` if the widget is not contained in a root widget.
446    ///
447    /// Readable
448    ///
449    ///
450    /// #### `scale-factor`
451    ///  The scale factor of the widget.
452    ///
453    /// Readable
454    ///
455    ///
456    /// #### `sensitive`
457    ///  Whether the widget responds to input.
458    ///
459    /// Readable | Writable
460    ///
461    ///
462    /// #### `tooltip-markup`
463    ///  Sets the text of tooltip to be the given string, which is marked up
464    /// with Pango markup.
465    ///
466    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
467    ///
468    /// This is a convenience property which will take care of getting the
469    /// tooltip shown if the given string is not `NULL`:
470    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
471    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
472    /// the default signal handler.
473    ///
474    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
475    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
476    ///
477    /// Readable | Writable
478    ///
479    ///
480    /// #### `tooltip-text`
481    ///  Sets the text of tooltip to be the given string.
482    ///
483    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
484    ///
485    /// This is a convenience property which will take care of getting the
486    /// tooltip shown if the given string is not `NULL`:
487    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
488    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
489    /// the default signal handler.
490    ///
491    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
492    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
493    ///
494    /// Readable | Writable
495    ///
496    ///
497    /// #### `valign`
498    ///  How to distribute vertical space if widget gets extra space.
499    ///
500    /// Readable | Writable
501    ///
502    ///
503    /// #### `vexpand`
504    ///  Whether to expand vertically.
505    ///
506    /// Readable | Writable
507    ///
508    ///
509    /// #### `vexpand-set`
510    ///  Whether to use the `vexpand` property.
511    ///
512    /// Readable | Writable
513    ///
514    ///
515    /// #### `visible`
516    ///  Whether the widget is visible.
517    ///
518    /// Readable | Writable
519    ///
520    ///
521    /// #### `width-request`
522    ///  Overrides for width request of the widget.
523    ///
524    /// If this is -1, the natural request will be used.
525    ///
526    /// Readable | Writable
527    /// </details>
528    /// <details><summary><h4>Accessible</h4></summary>
529    ///
530    ///
531    /// #### `accessible-role`
532    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
533    ///
534    /// The accessible role cannot be changed once set.
535    ///
536    /// Readable | Writable
537    /// </details>
538    ///
539    /// ## Signals
540    ///
541    ///
542    /// #### `activate-current-link`
543    ///   key.
544    ///
545    /// Action
546    ///
547    ///
548    /// #### `activate-link`
549    ///  Gets emitted to activate a URI.
550    ///
551    /// Applications may connect to it to override the default behaviour,
552    /// which is to call [`FileLauncher::launch()`][crate::FileLauncher::launch()].
553    ///
554    ///
555    ///
556    ///
557    /// #### `copy-clipboard`
558    ///  .
559    ///
560    /// Action
561    ///
562    ///
563    /// #### `move-cursor`
564    ///   move to the ends of the buffer
565    ///
566    /// Action
567    /// <details><summary><h4>Widget</h4></summary>
568    ///
569    ///
570    /// #### `destroy`
571    ///  Signals that all holders of a reference to the widget should release
572    /// the reference that they hold.
573    ///
574    /// May result in finalization of the widget if all references are released.
575    ///
576    /// This signal is not suitable for saving widget state.
577    ///
578    ///
579    ///
580    ///
581    /// #### `direction-changed`
582    ///  Emitted when the text direction of a widget changes.
583    ///
584    ///
585    ///
586    ///
587    /// #### `hide`
588    ///  Emitted when @widget is hidden.
589    ///
590    ///
591    ///
592    ///
593    /// #### `keynav-failed`
594    ///  Emitted if keyboard navigation fails.
595    ///
596    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
597    ///
598    ///
599    ///
600    ///
601    /// #### `map`
602    ///  Emitted when @widget is going to be mapped.
603    ///
604    /// A widget is mapped when the widget is visible (which is controlled with
605    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
606    /// are also visible.
607    ///
608    /// The `::map` signal can be used to determine whether a widget will be drawn,
609    /// for instance it can resume an animation that was stopped during the
610    /// emission of [`unmap`][struct@crate::Widget#unmap].
611    ///
612    ///
613    ///
614    ///
615    /// #### `mnemonic-activate`
616    ///  Emitted when a widget is activated via a mnemonic.
617    ///
618    /// The default handler for this signal activates @widget if @group_cycling
619    /// is false, or just makes @widget grab focus if @group_cycling is true.
620    ///
621    ///
622    ///
623    ///
624    /// #### `move-focus`
625    ///   to move backward.
626    ///
627    /// Action
628    ///
629    ///
630    /// #### `query-tooltip`
631    ///  s tooltip is about to be shown.
632    ///
633    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
634    /// is true and the hover timeout has expired with the cursor hovering
635    /// above @widget; or emitted when @widget got focus in keyboard mode.
636    ///
637    /// Using the given coordinates, the signal handler should determine
638    /// whether a tooltip should be shown for @widget. If this is the case
639    /// true should be returned, false otherwise. Note that if @keyboard_mode
640    /// is true, the values of @x and @y are undefined and should not be used.
641    ///
642    /// The signal handler is free to manipulate @tooltip with the therefore
643    /// destined function calls.
644    ///
645    ///
646    ///
647    ///
648    /// #### `realize`
649    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
650    ///
651    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
652    /// or the widget has been mapped (that is, it is going to be drawn).
653    ///
654    ///
655    ///
656    ///
657    /// #### `show`
658    ///  Emitted when @widget is shown.
659    ///
660    ///
661    ///
662    ///
663    /// #### `state-flags-changed`
664    ///  Emitted when the widget state changes.
665    ///
666    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
667    ///
668    ///
669    ///
670    ///
671    /// #### `unmap`
672    ///  Emitted when @widget is going to be unmapped.
673    ///
674    /// A widget is unmapped when either it or any of its parents up to the
675    /// toplevel widget have been set as hidden.
676    ///
677    /// As `::unmap` indicates that a widget will not be shown any longer,
678    /// it can be used to, for example, stop an animation on the widget.
679    ///
680    ///
681    ///
682    ///
683    /// #### `unrealize`
684    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
685    ///
686    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
687    /// or the widget has been unmapped (that is, it is going to be hidden).
688    ///
689    ///
690    /// </details>
691    ///
692    /// # Implements
693    ///
694    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`AccessibleHypertextExt`][trait@crate::prelude::AccessibleHypertextExt], [`AccessibleTextExt`][trait@crate::prelude::AccessibleTextExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
695    #[doc(alias = "GtkLabel")]
696    pub struct Label(Object<ffi::GtkLabel>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleHypertext, AccessibleText;
697
698    match fn {
699        type_ => || ffi::gtk_label_get_type(),
700    }
701}
702
703#[cfg(all(feature = "v4_10", feature = "v4_14", not(feature = "v4_22")))]
704glib::wrapper! {
705    #[doc(alias = "GtkLabel")]
706    pub struct Label(Object<ffi::GtkLabel>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AccessibleText;
707
708    match fn {
709        type_ => || ffi::gtk_label_get_type(),
710    }
711}
712
713#[cfg(all(feature = "v4_10", not(feature = "v4_14")))]
714glib::wrapper! {
715    #[doc(alias = "GtkLabel")]
716    pub struct Label(Object<ffi::GtkLabel>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
717
718    match fn {
719        type_ => || ffi::gtk_label_get_type(),
720    }
721}
722
723#[cfg(not(any(feature = "v4_10", feature = "v4_14", feature = "v4_22")))]
724glib::wrapper! {
725    #[doc(alias = "GtkLabel")]
726    pub struct Label(Object<ffi::GtkLabel>) @extends Widget, @implements Buildable, ConstraintTarget;
727
728    match fn {
729        type_ => || ffi::gtk_label_get_type(),
730    }
731}
732
733impl Label {
734    /// Creates a new label with the given text inside it.
735    ///
736    /// You can pass `NULL` to get an empty label widget.
737    /// ## `str`
738    /// the text of the label
739    ///
740    /// # Returns
741    ///
742    /// the new label
743    #[doc(alias = "gtk_label_new")]
744    pub fn new(str: Option<&str>) -> Label {
745        assert_initialized_main_thread!();
746        unsafe { Widget::from_glib_none(ffi::gtk_label_new(str.to_glib_none().0)).unsafe_cast() }
747    }
748
749    /// Creates a new label with the given text inside it, and a mnemonic.
750    ///
751    /// If characters in @str are preceded by an underscore, they are
752    /// underlined. If you need a literal underscore character in a label, use
753    /// '__' (two underscores). The first underlined character represents a
754    /// keyboard accelerator called a mnemonic. The mnemonic key can be used
755    /// to activate another widget, chosen automatically, or explicitly using
756    /// [`set_mnemonic_widget()`][Self::set_mnemonic_widget()].
757    ///
758    /// If [`set_mnemonic_widget()`][Self::set_mnemonic_widget()] is not called, then the first
759    /// activatable ancestor of the label will be chosen as the mnemonic
760    /// widget. For instance, if the label is inside a button or menu item,
761    /// the button or menu item will automatically become the mnemonic widget
762    /// and be activated by the mnemonic.
763    /// ## `str`
764    /// the text of the label, with an underscore in front of the
765    ///   mnemonic character
766    ///
767    /// # Returns
768    ///
769    /// the new label
770    #[doc(alias = "gtk_label_new_with_mnemonic")]
771    #[doc(alias = "new_with_mnemonic")]
772    pub fn with_mnemonic(str: &str) -> Label {
773        assert_initialized_main_thread!();
774        unsafe {
775            Widget::from_glib_none(ffi::gtk_label_new_with_mnemonic(str.to_glib_none().0))
776                .unsafe_cast()
777        }
778    }
779
780    // rustdoc-stripper-ignore-next
781    /// Creates a new builder-pattern struct instance to construct [`Label`] objects.
782    ///
783    /// This method returns an instance of [`LabelBuilder`](crate::builders::LabelBuilder) which can be used to create [`Label`] objects.
784    pub fn builder() -> LabelBuilder {
785        LabelBuilder::new()
786    }
787
788    /// Gets the label's attribute list.
789    ///
790    /// This is the [`pango::AttrList`][crate::pango::AttrList] that was set on the label using
791    /// [`set_attributes()`][Self::set_attributes()], if any. This function does not
792    /// reflect attributes that come from the label's markup (see
793    /// [`set_markup()`][Self::set_markup()]). If you want to get the effective
794    /// attributes for the label, use
795    /// `pango_layout_get_attributes (gtk_label_get_layout (self))`.
796    ///
797    /// # Returns
798    ///
799    /// the attribute list
800    #[doc(alias = "gtk_label_get_attributes")]
801    #[doc(alias = "get_attributes")]
802    pub fn attributes(&self) -> Option<pango::AttrList> {
803        unsafe { from_glib_none(ffi::gtk_label_get_attributes(self.to_glib_none().0)) }
804    }
805
806    /// Returns the URI for the active link in the label.
807    ///
808    /// The active link is the one under the mouse pointer or, in a
809    /// selectable label, the link in which the text cursor is currently
810    /// positioned.
811    ///
812    /// This function is intended for use in a [`activate-link`][struct@crate::Label#activate-link]
813    /// handler or for use in a [`query-tooltip`][struct@crate::Widget#query-tooltip] handler.
814    ///
815    /// # Returns
816    ///
817    /// the active URI
818    #[doc(alias = "gtk_label_get_current_uri")]
819    #[doc(alias = "get_current_uri")]
820    pub fn current_uri(&self) -> Option<glib::GString> {
821        unsafe { from_glib_none(ffi::gtk_label_get_current_uri(self.to_glib_none().0)) }
822    }
823
824    /// Returns the ellipsization mode of the label.
825    ///
826    /// See [`set_ellipsize()`][Self::set_ellipsize()].
827    ///
828    /// # Returns
829    ///
830    /// the ellipsization mode
831    #[doc(alias = "gtk_label_get_ellipsize")]
832    #[doc(alias = "get_ellipsize")]
833    pub fn ellipsize(&self) -> pango::EllipsizeMode {
834        unsafe { from_glib(ffi::gtk_label_get_ellipsize(self.to_glib_none().0)) }
835    }
836
837    /// Gets the extra menu model of the label.
838    ///
839    /// See [`set_extra_menu()`][Self::set_extra_menu()].
840    ///
841    /// # Returns
842    ///
843    /// the menu model
844    #[doc(alias = "gtk_label_get_extra_menu")]
845    #[doc(alias = "get_extra_menu")]
846    #[doc(alias = "extra-menu")]
847    pub fn extra_menu(&self) -> Option<gio::MenuModel> {
848        unsafe { from_glib_none(ffi::gtk_label_get_extra_menu(self.to_glib_none().0)) }
849    }
850
851    /// Returns the justification of the label.
852    ///
853    /// See [`set_justify()`][Self::set_justify()].
854    ///
855    /// # Returns
856    ///
857    /// the justification value
858    #[doc(alias = "gtk_label_get_justify")]
859    #[doc(alias = "get_justify")]
860    pub fn justify(&self) -> Justification {
861        unsafe { from_glib(ffi::gtk_label_get_justify(self.to_glib_none().0)) }
862    }
863
864    /// Fetches the text from a label.
865    ///
866    /// The returned text includes any embedded underlines indicating
867    /// mnemonics and Pango markup. (See [`text()`][Self::text()]).
868    ///
869    /// # Returns
870    ///
871    /// the text of the label widget
872    #[doc(alias = "gtk_label_get_label")]
873    #[doc(alias = "get_label")]
874    pub fn label(&self) -> glib::GString {
875        unsafe { from_glib_none(ffi::gtk_label_get_label(self.to_glib_none().0)) }
876    }
877
878    /// Gets the Pango layout used to display the label.
879    ///
880    /// The layout is useful to e.g. convert text positions to pixel
881    /// positions, in combination with [`layout_offsets()`][Self::layout_offsets()].
882    /// The returned layout is owned by the @label so need not be
883    /// freed by the caller. The @label is free to recreate its layout
884    /// at any time, so it should be considered read-only.
885    ///
886    /// # Returns
887    ///
888    /// the [`pango::Layout`][crate::pango::Layout] for this label
889    #[doc(alias = "gtk_label_get_layout")]
890    #[doc(alias = "get_layout")]
891    pub fn layout(&self) -> pango::Layout {
892        unsafe { from_glib_none(ffi::gtk_label_get_layout(self.to_glib_none().0)) }
893    }
894
895    /// Obtains the coordinates where the label will draw its Pango layout.
896    ///
897    /// The coordinates are useful to convert mouse events into coordinates
898    /// inside the [`pango::Layout`][crate::pango::Layout], e.g. to take some action if some part
899    /// of the label is clicked. Remember when using the [`pango::Layout`][crate::pango::Layout]
900    /// functions you need to convert to and from pixels using `PANGO_PIXELS()`
901    /// or `Pango::SCALE`.
902    ///
903    /// # Returns
904    ///
905    ///
906    /// ## `x`
907    /// location to store X offset of layout
908    ///
909    /// ## `y`
910    /// location to store Y offset of layout
911    #[doc(alias = "gtk_label_get_layout_offsets")]
912    #[doc(alias = "get_layout_offsets")]
913    pub fn layout_offsets(&self) -> (i32, i32) {
914        unsafe {
915            let mut x = std::mem::MaybeUninit::uninit();
916            let mut y = std::mem::MaybeUninit::uninit();
917            ffi::gtk_label_get_layout_offsets(
918                self.to_glib_none().0,
919                x.as_mut_ptr(),
920                y.as_mut_ptr(),
921            );
922            (x.assume_init(), y.assume_init())
923        }
924    }
925
926    /// Gets the number of lines to which an ellipsized, wrapping
927    /// label should be limited.
928    ///
929    /// See [`set_lines()`][Self::set_lines()].
930    ///
931    /// # Returns
932    ///
933    /// the number of lines
934    #[doc(alias = "gtk_label_get_lines")]
935    #[doc(alias = "get_lines")]
936    pub fn lines(&self) -> i32 {
937        unsafe { ffi::gtk_label_get_lines(self.to_glib_none().0) }
938    }
939
940    /// Retrieves the maximum width of the label in characters.
941    ///
942    /// See [`set_width_chars()`][Self::set_width_chars()].
943    ///
944    /// # Returns
945    ///
946    /// the maximum width of the label, in characters
947    #[doc(alias = "gtk_label_get_max_width_chars")]
948    #[doc(alias = "get_max_width_chars")]
949    #[doc(alias = "max-width-chars")]
950    pub fn max_width_chars(&self) -> i32 {
951        unsafe { ffi::gtk_label_get_max_width_chars(self.to_glib_none().0) }
952    }
953
954    /// Retrieves the mnemonic target of this label.
955    ///
956    /// See [`set_mnemonic_widget()`][Self::set_mnemonic_widget()].
957    ///
958    /// # Returns
959    ///
960    /// s mnemonic,
961    ///   or `NULL` if none has been set and the default algorithm will be used.
962    #[doc(alias = "gtk_label_get_mnemonic_widget")]
963    #[doc(alias = "get_mnemonic_widget")]
964    #[doc(alias = "mnemonic-widget")]
965    pub fn mnemonic_widget(&self) -> Option<Widget> {
966        unsafe { from_glib_none(ffi::gtk_label_get_mnemonic_widget(self.to_glib_none().0)) }
967    }
968
969    /// Returns natural line wrap mode used by the label.
970    ///
971    /// See [`set_natural_wrap_mode()`][Self::set_natural_wrap_mode()].
972    ///
973    /// # Returns
974    ///
975    /// the natural line wrap mode
976    #[cfg(feature = "v4_6")]
977    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
978    #[doc(alias = "gtk_label_get_natural_wrap_mode")]
979    #[doc(alias = "get_natural_wrap_mode")]
980    #[doc(alias = "natural-wrap-mode")]
981    pub fn natural_wrap_mode(&self) -> NaturalWrapMode {
982        unsafe { from_glib(ffi::gtk_label_get_natural_wrap_mode(self.to_glib_none().0)) }
983    }
984
985    /// Returns whether the label is selectable.
986    ///
987    /// # Returns
988    ///
989    /// true if the user can copy text from the label
990    #[doc(alias = "gtk_label_get_selectable")]
991    #[doc(alias = "get_selectable")]
992    #[doc(alias = "selectable")]
993    pub fn is_selectable(&self) -> bool {
994        unsafe { from_glib(ffi::gtk_label_get_selectable(self.to_glib_none().0)) }
995    }
996
997    /// Gets the selected range of characters in the label.
998    ///
999    /// The returned @start and @end positions are in characters.
1000    ///
1001    /// # Returns
1002    ///
1003    /// true if selection is non-empty
1004    ///
1005    /// ## `start`
1006    /// return location for start of selection
1007    ///
1008    /// ## `end`
1009    /// return location for end of selection
1010    #[doc(alias = "gtk_label_get_selection_bounds")]
1011    #[doc(alias = "get_selection_bounds")]
1012    pub fn selection_bounds(&self) -> Option<(i32, i32)> {
1013        unsafe {
1014            let mut start = std::mem::MaybeUninit::uninit();
1015            let mut end = std::mem::MaybeUninit::uninit();
1016            let ret = from_glib(ffi::gtk_label_get_selection_bounds(
1017                self.to_glib_none().0,
1018                start.as_mut_ptr(),
1019                end.as_mut_ptr(),
1020            ));
1021            if ret {
1022                Some((start.assume_init(), end.assume_init()))
1023            } else {
1024                None
1025            }
1026        }
1027    }
1028
1029    /// Returns whether the label is in single line mode.
1030    ///
1031    /// # Returns
1032    ///
1033    /// true if the label is in single line mode
1034    #[doc(alias = "gtk_label_get_single_line_mode")]
1035    #[doc(alias = "get_single_line_mode")]
1036    #[doc(alias = "single-line-mode")]
1037    pub fn is_single_line_mode(&self) -> bool {
1038        unsafe { from_glib(ffi::gtk_label_get_single_line_mode(self.to_glib_none().0)) }
1039    }
1040
1041    ///  (8-space) tabs are used.
1042    ///
1043    /// # Returns
1044    ///
1045    /// copy of default tab array,
1046    ///   or `NULL` if standard tabs are used
1047    #[cfg(feature = "v4_8")]
1048    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1049    #[doc(alias = "gtk_label_get_tabs")]
1050    #[doc(alias = "get_tabs")]
1051    pub fn tabs(&self) -> Option<pango::TabArray> {
1052        unsafe { from_glib_full(ffi::gtk_label_get_tabs(self.to_glib_none().0)) }
1053    }
1054
1055    /// Gets the text of the label.
1056    ///
1057    /// The returned text is as it appears on screen. This does not include
1058    /// any embedded underlines indicating mnemonics or Pango markup. (See
1059    /// [`label()`][Self::label()])
1060    ///
1061    /// # Returns
1062    ///
1063    /// the text in the label widget
1064    #[doc(alias = "gtk_label_get_text")]
1065    #[doc(alias = "get_text")]
1066    pub fn text(&self) -> glib::GString {
1067        unsafe { from_glib_none(ffi::gtk_label_get_text(self.to_glib_none().0)) }
1068    }
1069
1070    /// s text is interpreted as Pango markup.
1071    ///
1072    /// See [`set_use_markup()`][Self::set_use_markup()].
1073    ///
1074    /// # Returns
1075    ///
1076    /// s text will be parsed for markup
1077    #[doc(alias = "gtk_label_get_use_markup")]
1078    #[doc(alias = "get_use_markup")]
1079    #[doc(alias = "use-markup")]
1080    pub fn uses_markup(&self) -> bool {
1081        unsafe { from_glib(ffi::gtk_label_get_use_markup(self.to_glib_none().0)) }
1082    }
1083
1084    /// Returns whether underlines in the label indicate mnemonics.
1085    ///
1086    /// See [`set_use_underline()`][Self::set_use_underline()].
1087    ///
1088    /// # Returns
1089    ///
1090    /// true if underlines in the label indicate mnemonics
1091    #[doc(alias = "gtk_label_get_use_underline")]
1092    #[doc(alias = "get_use_underline")]
1093    #[doc(alias = "use-underline")]
1094    pub fn uses_underline(&self) -> bool {
1095        unsafe { from_glib(ffi::gtk_label_get_use_underline(self.to_glib_none().0)) }
1096    }
1097
1098    /// Retrieves the desired width of the label in characters.
1099    ///
1100    /// See [`set_width_chars()`][Self::set_width_chars()].
1101    ///
1102    /// # Returns
1103    ///
1104    /// the desired width of the label, in characters
1105    #[doc(alias = "gtk_label_get_width_chars")]
1106    #[doc(alias = "get_width_chars")]
1107    #[doc(alias = "width-chars")]
1108    pub fn width_chars(&self) -> i32 {
1109        unsafe { ffi::gtk_label_get_width_chars(self.to_glib_none().0) }
1110    }
1111
1112    /// Returns whether lines in the label are automatically wrapped.
1113    ///
1114    /// See [`set_wrap()`][Self::set_wrap()].
1115    ///
1116    /// # Returns
1117    ///
1118    /// true if the lines of the label are automatically wrapped
1119    #[doc(alias = "gtk_label_get_wrap")]
1120    #[doc(alias = "get_wrap")]
1121    #[doc(alias = "wrap")]
1122    pub fn wraps(&self) -> bool {
1123        unsafe { from_glib(ffi::gtk_label_get_wrap(self.to_glib_none().0)) }
1124    }
1125
1126    /// Returns line wrap mode used by the label.
1127    ///
1128    /// See [`set_wrap_mode()`][Self::set_wrap_mode()].
1129    ///
1130    /// # Returns
1131    ///
1132    /// the line wrap mode
1133    #[doc(alias = "gtk_label_get_wrap_mode")]
1134    #[doc(alias = "get_wrap_mode")]
1135    #[doc(alias = "wrap-mode")]
1136    pub fn wrap_mode(&self) -> pango::WrapMode {
1137        unsafe { from_glib(ffi::gtk_label_get_wrap_mode(self.to_glib_none().0)) }
1138    }
1139
1140    /// Gets the `xalign` of the label.
1141    ///
1142    /// See the [`xalign`][struct@crate::Label#xalign] property.
1143    ///
1144    /// # Returns
1145    ///
1146    /// the xalign value
1147    #[doc(alias = "gtk_label_get_xalign")]
1148    #[doc(alias = "get_xalign")]
1149    pub fn xalign(&self) -> f32 {
1150        unsafe { ffi::gtk_label_get_xalign(self.to_glib_none().0) }
1151    }
1152
1153    /// Gets the `yalign` of the label.
1154    ///
1155    /// See the [`yalign`][struct@crate::Label#yalign] property.
1156    ///
1157    /// # Returns
1158    ///
1159    /// the yalign value
1160    #[doc(alias = "gtk_label_get_yalign")]
1161    #[doc(alias = "get_yalign")]
1162    pub fn yalign(&self) -> f32 {
1163        unsafe { ffi::gtk_label_get_yalign(self.to_glib_none().0) }
1164    }
1165
1166    /// Selects a range of characters in the label, if the label is selectable.
1167    ///
1168    /// See [`set_selectable()`][Self::set_selectable()]. If the label is not selectable,
1169    /// this function has no effect. If @start_offset or
1170    /// @end_offset are -1, then the end of the label will be substituted.
1171    /// ## `start_offset`
1172    /// start offset, in characters
1173    /// ## `end_offset`
1174    /// end offset, in characters
1175    #[doc(alias = "gtk_label_select_region")]
1176    pub fn select_region(&self, start_offset: i32, end_offset: i32) {
1177        unsafe {
1178            ffi::gtk_label_select_region(self.to_glib_none().0, start_offset, end_offset);
1179        }
1180    }
1181
1182    /// Apply attributes to the label text.
1183    ///
1184    /// The attributes set with this function will be applied and merged with
1185    /// any other attributes previously effected by way of the
1186    /// [`use-underline`][struct@crate::Label#use-underline] or [`use-markup`][struct@crate::Label#use-markup]
1187    /// properties
1188    ///
1189    /// While it is not recommended to mix markup strings with manually set
1190    /// attributes, if you must; know that the attributes will be applied
1191    /// to the label after the markup string is parsed.
1192    /// ## `attrs`
1193    /// a list of style attributes
1194    #[doc(alias = "gtk_label_set_attributes")]
1195    #[doc(alias = "attributes")]
1196    pub fn set_attributes(&self, attrs: Option<&pango::AttrList>) {
1197        unsafe {
1198            ffi::gtk_label_set_attributes(self.to_glib_none().0, attrs.to_glib_none().0);
1199        }
1200    }
1201
1202    /// Sets the mode used to ellipsize the text.
1203    ///
1204    /// The text will be ellipsized if there is not
1205    /// enough space to render the entire string.
1206    /// ## `mode`
1207    /// the ellipsization mode
1208    #[doc(alias = "gtk_label_set_ellipsize")]
1209    #[doc(alias = "ellipsize")]
1210    pub fn set_ellipsize(&self, mode: pango::EllipsizeMode) {
1211        unsafe {
1212            ffi::gtk_label_set_ellipsize(self.to_glib_none().0, mode.into_glib());
1213        }
1214    }
1215
1216    /// Sets a menu model to add to the context menu of the label.
1217    /// ## `model`
1218    /// a menu model
1219    #[doc(alias = "gtk_label_set_extra_menu")]
1220    #[doc(alias = "extra-menu")]
1221    pub fn set_extra_menu(&self, model: Option<&impl IsA<gio::MenuModel>>) {
1222        unsafe {
1223            ffi::gtk_label_set_extra_menu(
1224                self.to_glib_none().0,
1225                model.map(|p| p.as_ref()).to_glib_none().0,
1226            );
1227        }
1228    }
1229
1230    /// Sets the alignment of lines in the label relative to each other.
1231    ///
1232    /// This function has no effect on labels containing only a single line.
1233    ///
1234    /// [enum@Gtk.Justification.left] is the default value when the widget
1235    /// is first created with [`new()`][Self::new()].
1236    ///
1237    /// If you instead want to set the alignment of the label as a whole,
1238    /// use [`WidgetExt::set_halign()`][crate::prelude::WidgetExt::set_halign()] instead.
1239    /// ## `jtype`
1240    /// the new justification
1241    #[doc(alias = "gtk_label_set_justify")]
1242    #[doc(alias = "justify")]
1243    pub fn set_justify(&self, jtype: Justification) {
1244        unsafe {
1245            ffi::gtk_label_set_justify(self.to_glib_none().0, jtype.into_glib());
1246        }
1247    }
1248
1249    /// Sets the text of the label.
1250    ///
1251    /// The label is interpreted as including embedded underlines and/or Pango
1252    /// markup depending on the values of the [`use-underline`][struct@crate::Label#use-underline]
1253    /// and [`use-markup`][struct@crate::Label#use-markup] properties.
1254    /// ## `str`
1255    /// the new text to set for the label
1256    #[doc(alias = "gtk_label_set_label")]
1257    #[doc(alias = "label")]
1258    pub fn set_label(&self, str: &str) {
1259        unsafe {
1260            ffi::gtk_label_set_label(self.to_glib_none().0, str.to_glib_none().0);
1261        }
1262    }
1263
1264    /// t want to limit the number of lines.
1265    /// ## `lines`
1266    /// the desired number of lines, or -1
1267    #[doc(alias = "gtk_label_set_lines")]
1268    #[doc(alias = "lines")]
1269    pub fn set_lines(&self, lines: i32) {
1270        unsafe {
1271            ffi::gtk_label_set_lines(self.to_glib_none().0, lines);
1272        }
1273    }
1274
1275    /// ";
1276    /// char *markup;
1277    ///
1278    /// markup = g_markup_printf_escaped (format, str);
1279    /// gtk_label_set_markup (GTK_LABEL (self), markup);
1280    /// g_free (markup);
1281    /// ```text
1282    ///
1283    /// This function sets the [`use-markup`][struct@crate::Label#use-markup] property
1284    /// to true.
1285    ///
1286    /// Also see [`set_text()`][Self::set_text()].
1287    /// ## `str`
1288    /// the markup string
1289    #[doc(alias = "gtk_label_set_markup")]
1290    pub fn set_markup(&self, str: &str) {
1291        unsafe {
1292            ffi::gtk_label_set_markup(self.to_glib_none().0, str.to_glib_none().0);
1293        }
1294    }
1295
1296    /// s text and attribute list based on the parse results.
1297    /// If characters in @str are preceded by an underscore, they are underlined
1298    /// indicating that they represent a keyboard accelerator called a mnemonic.
1299    ///
1300    /// The mnemonic key can be used to activate another widget, chosen
1301    /// automatically, or explicitly using [`set_mnemonic_widget()`][Self::set_mnemonic_widget()].
1302    /// ## `str`
1303    /// the markup string
1304    #[doc(alias = "gtk_label_set_markup_with_mnemonic")]
1305    pub fn set_markup_with_mnemonic(&self, str: &str) {
1306        unsafe {
1307            ffi::gtk_label_set_markup_with_mnemonic(self.to_glib_none().0, str.to_glib_none().0);
1308        }
1309    }
1310
1311    /// Sets the maximum width of the label in characters.
1312    /// ## `n_chars`
1313    /// the new maximum width, in characters.
1314    #[doc(alias = "gtk_label_set_max_width_chars")]
1315    #[doc(alias = "max-width-chars")]
1316    pub fn set_max_width_chars(&self, n_chars: i32) {
1317        unsafe {
1318            ffi::gtk_label_set_max_width_chars(self.to_glib_none().0, n_chars);
1319        }
1320    }
1321
1322    /// Associate the label with its mnemonic target.
1323    ///
1324    /// If the label has been set so that it has a mnemonic key (using
1325    /// i.e. [`set_markup_with_mnemonic()`][Self::set_markup_with_mnemonic()],
1326    /// [`set_text_with_mnemonic()`][Self::set_text_with_mnemonic()],
1327    /// [`with_mnemonic()`][Self::with_mnemonic()]
1328    /// or the [`use_underline`][struct@crate::Label#use_underline] property) the label can
1329    /// be associated with a widget that is the target of the mnemonic.
1330    /// When the label is inside a widget (like a [`Button`][crate::Button] or a
1331    /// [`Notebook`][crate::Notebook] tab) it is automatically associated with the
1332    /// correct widget, but sometimes (i.e. when the target is a [`Entry`][crate::Entry]
1333    /// next to the label) you need to set it explicitly using this function.
1334    ///
1335    /// The target widget will be accelerated by emitting the
1336    /// [`mnemonic-activate`][struct@crate::Widget#mnemonic-activate] signal on it. The default handler
1337    /// for this signal will activate the widget if there are no mnemonic
1338    /// collisions and toggle focus between the colliding widgets otherwise.
1339    /// ## `widget`
1340    /// the target widget
1341    #[doc(alias = "gtk_label_set_mnemonic_widget")]
1342    #[doc(alias = "mnemonic-widget")]
1343    pub fn set_mnemonic_widget(&self, widget: Option<&impl IsA<Widget>>) {
1344        unsafe {
1345            ffi::gtk_label_set_mnemonic_widget(
1346                self.to_glib_none().0,
1347                widget.map(|p| p.as_ref()).to_glib_none().0,
1348            );
1349        }
1350    }
1351
1352    /// Selects the line wrapping for the natural size request.
1353    ///
1354    /// This only affects the natural size requested, for the actual wrapping used,
1355    /// see the [`wrap-mode`][struct@crate::Label#wrap-mode] property.
1356    /// ## `wrap_mode`
1357    /// the line wrapping mode
1358    #[cfg(feature = "v4_6")]
1359    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1360    #[doc(alias = "gtk_label_set_natural_wrap_mode")]
1361    #[doc(alias = "natural-wrap-mode")]
1362    pub fn set_natural_wrap_mode(&self, wrap_mode: NaturalWrapMode) {
1363        unsafe {
1364            ffi::gtk_label_set_natural_wrap_mode(self.to_glib_none().0, wrap_mode.into_glib());
1365        }
1366    }
1367
1368    /// Makes text in the label selectable.
1369    ///
1370    /// Selectable labels allow the user to select text from the label,
1371    /// for copy-and-paste.
1372    /// ## `setting`
1373    /// true to allow selecting text in the label
1374    #[doc(alias = "gtk_label_set_selectable")]
1375    #[doc(alias = "selectable")]
1376    pub fn set_selectable(&self, setting: bool) {
1377        unsafe {
1378            ffi::gtk_label_set_selectable(self.to_glib_none().0, setting.into_glib());
1379        }
1380    }
1381
1382    /// Sets whether the label is in single line mode.
1383    /// ## `single_line_mode`
1384    /// true to enable single line mode
1385    #[doc(alias = "gtk_label_set_single_line_mode")]
1386    #[doc(alias = "single-line-mode")]
1387    pub fn set_single_line_mode(&self, single_line_mode: bool) {
1388        unsafe {
1389            ffi::gtk_label_set_single_line_mode(
1390                self.to_glib_none().0,
1391                single_line_mode.into_glib(),
1392            );
1393        }
1394    }
1395
1396    /// Sets tab stops for the label.
1397    /// ## `tabs`
1398    /// tab stops
1399    #[cfg(feature = "v4_8")]
1400    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1401    #[doc(alias = "gtk_label_set_tabs")]
1402    #[doc(alias = "tabs")]
1403    pub fn set_tabs(&self, tabs: Option<&pango::TabArray>) {
1404        unsafe {
1405            ffi::gtk_label_set_tabs(self.to_glib_none().0, mut_override(tabs.to_glib_none().0));
1406        }
1407    }
1408
1409    /// Sets the text for the label.
1410    ///
1411    /// It overwrites any text that was there before and clears any
1412    /// previously set mnemonic accelerators, and sets the
1413    /// [`use-underline`][struct@crate::Label#use-underline] and
1414    /// [`use-markup`][struct@crate::Label#use-markup] properties to false.
1415    ///
1416    /// Also see [`set_markup()`][Self::set_markup()].
1417    /// ## `str`
1418    /// the text to show in @self
1419    #[doc(alias = "gtk_label_set_text")]
1420    pub fn set_text(&self, str: &str) {
1421        unsafe {
1422            ffi::gtk_label_set_text(self.to_glib_none().0, str.to_glib_none().0);
1423        }
1424    }
1425
1426    /// Sets the text for the label, with mnemonics.
1427    ///
1428    /// If characters in @str are preceded by an underscore, they are underlined
1429    /// indicating that they represent a keyboard accelerator called a mnemonic.
1430    /// The mnemonic key can be used to activate another widget, chosen
1431    /// automatically, or explicitly using [`set_mnemonic_widget()`][Self::set_mnemonic_widget()].
1432    /// ## `str`
1433    /// the text
1434    #[doc(alias = "gtk_label_set_text_with_mnemonic")]
1435    pub fn set_text_with_mnemonic(&self, str: &str) {
1436        unsafe {
1437            ffi::gtk_label_set_text_with_mnemonic(self.to_glib_none().0, str.to_glib_none().0);
1438        }
1439    }
1440
1441    /// Sets whether the text of the label contains markup.
1442    ///
1443    /// See [`set_markup()`][Self::set_markup()].
1444    /// ## `setting`
1445    /// s text should be parsed for markup.
1446    #[doc(alias = "gtk_label_set_use_markup")]
1447    #[doc(alias = "use-markup")]
1448    pub fn set_use_markup(&self, setting: bool) {
1449        unsafe {
1450            ffi::gtk_label_set_use_markup(self.to_glib_none().0, setting.into_glib());
1451        }
1452    }
1453
1454    /// Sets whether underlines in the text indicate mnemonics.
1455    /// ## `setting`
1456    /// true if underlines in the text indicate mnemonics
1457    #[doc(alias = "gtk_label_set_use_underline")]
1458    #[doc(alias = "use-underline")]
1459    pub fn set_use_underline(&self, setting: bool) {
1460        unsafe {
1461            ffi::gtk_label_set_use_underline(self.to_glib_none().0, setting.into_glib());
1462        }
1463    }
1464
1465    /// Sets the desired width in characters of the label.
1466    /// ## `n_chars`
1467    /// the new desired width, in characters.
1468    #[doc(alias = "gtk_label_set_width_chars")]
1469    #[doc(alias = "width-chars")]
1470    pub fn set_width_chars(&self, n_chars: i32) {
1471        unsafe {
1472            ffi::gtk_label_set_width_chars(self.to_glib_none().0, n_chars);
1473        }
1474    }
1475
1476    /// s width
1477    /// using [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()].
1478    /// ## `wrap`
1479    /// whether to wrap lines
1480    #[doc(alias = "gtk_label_set_wrap")]
1481    #[doc(alias = "wrap")]
1482    pub fn set_wrap(&self, wrap: bool) {
1483        unsafe {
1484            ffi::gtk_label_set_wrap(self.to_glib_none().0, wrap.into_glib());
1485        }
1486    }
1487
1488    /// Controls how line wrapping is done.
1489    ///
1490    /// This only affects the label if line wrapping is on. (See
1491    /// [`set_wrap()`][Self::set_wrap()])
1492    ///
1493    /// The default is [enum@Pango.WrapMode.word], which means
1494    /// wrap on word boundaries.
1495    ///
1496    /// For sizing behavior, also consider the
1497    /// [`natural-wrap-mode`][struct@crate::Label#natural-wrap-mode] property.
1498    /// ## `wrap_mode`
1499    /// the line wrapping mode
1500    #[doc(alias = "gtk_label_set_wrap_mode")]
1501    #[doc(alias = "wrap-mode")]
1502    pub fn set_wrap_mode(&self, wrap_mode: pango::WrapMode) {
1503        unsafe {
1504            ffi::gtk_label_set_wrap_mode(self.to_glib_none().0, wrap_mode.into_glib());
1505        }
1506    }
1507
1508    /// Sets the `xalign` of the label.
1509    ///
1510    /// See the [`xalign`][struct@crate::Label#xalign] property.
1511    /// ## `xalign`
1512    /// the new xalign value, between 0 and 1
1513    #[doc(alias = "gtk_label_set_xalign")]
1514    #[doc(alias = "xalign")]
1515    pub fn set_xalign(&self, xalign: f32) {
1516        unsafe {
1517            ffi::gtk_label_set_xalign(self.to_glib_none().0, xalign);
1518        }
1519    }
1520
1521    /// Sets the `yalign` of the label.
1522    ///
1523    /// See the [`yalign`][struct@crate::Label#yalign] property.
1524    /// ## `yalign`
1525    /// the new yalign value, between 0 and 1
1526    #[doc(alias = "gtk_label_set_yalign")]
1527    #[doc(alias = "yalign")]
1528    pub fn set_yalign(&self, yalign: f32) {
1529        unsafe {
1530            ffi::gtk_label_set_yalign(self.to_glib_none().0, yalign);
1531        }
1532    }
1533
1534    ///  key.
1535    #[doc(alias = "activate-current-link")]
1536    pub fn connect_activate_current_link<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1537        unsafe extern "C" fn activate_current_link_trampoline<F: Fn(&Label) + 'static>(
1538            this: *mut ffi::GtkLabel,
1539            f: glib::ffi::gpointer,
1540        ) {
1541            unsafe {
1542                let f: &F = &*(f as *const F);
1543                f(&from_glib_borrow(this))
1544            }
1545        }
1546        unsafe {
1547            let f: Box_<F> = Box_::new(f);
1548            connect_raw(
1549                self.as_ptr() as *mut _,
1550                c"activate-current-link".as_ptr(),
1551                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1552                    activate_current_link_trampoline::<F> as *const (),
1553                )),
1554                Box_::into_raw(f),
1555            )
1556        }
1557    }
1558
1559    pub fn emit_activate_current_link(&self) {
1560        self.emit_by_name::<()>("activate-current-link", &[]);
1561    }
1562
1563    /// Gets emitted to activate a URI.
1564    ///
1565    /// Applications may connect to it to override the default behaviour,
1566    /// which is to call [`FileLauncher::launch()`][crate::FileLauncher::launch()].
1567    /// ## `uri`
1568    /// the URI that is activated
1569    ///
1570    /// # Returns
1571    ///
1572    /// true if the link has been activated
1573    #[doc(alias = "activate-link")]
1574    pub fn connect_activate_link<F: Fn(&Self, &str) -> glib::Propagation + 'static>(
1575        &self,
1576        f: F,
1577    ) -> SignalHandlerId {
1578        unsafe extern "C" fn activate_link_trampoline<
1579            F: Fn(&Label, &str) -> glib::Propagation + 'static,
1580        >(
1581            this: *mut ffi::GtkLabel,
1582            uri: *mut std::ffi::c_char,
1583            f: glib::ffi::gpointer,
1584        ) -> glib::ffi::gboolean {
1585            unsafe {
1586                let f: &F = &*(f as *const F);
1587                f(
1588                    &from_glib_borrow(this),
1589                    &glib::GString::from_glib_borrow(uri),
1590                )
1591                .into_glib()
1592            }
1593        }
1594        unsafe {
1595            let f: Box_<F> = Box_::new(f);
1596            connect_raw(
1597                self.as_ptr() as *mut _,
1598                c"activate-link".as_ptr(),
1599                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1600                    activate_link_trampoline::<F> as *const (),
1601                )),
1602                Box_::into_raw(f),
1603            )
1604        }
1605    }
1606
1607    /// .
1608    #[doc(alias = "copy-clipboard")]
1609    pub fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1610        unsafe extern "C" fn copy_clipboard_trampoline<F: Fn(&Label) + 'static>(
1611            this: *mut ffi::GtkLabel,
1612            f: glib::ffi::gpointer,
1613        ) {
1614            unsafe {
1615                let f: &F = &*(f as *const F);
1616                f(&from_glib_borrow(this))
1617            }
1618        }
1619        unsafe {
1620            let f: Box_<F> = Box_::new(f);
1621            connect_raw(
1622                self.as_ptr() as *mut _,
1623                c"copy-clipboard".as_ptr(),
1624                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1625                    copy_clipboard_trampoline::<F> as *const (),
1626                )),
1627                Box_::into_raw(f),
1628            )
1629        }
1630    }
1631
1632    pub fn emit_copy_clipboard(&self) {
1633        self.emit_by_name::<()>("copy-clipboard", &[]);
1634    }
1635
1636    ///  move to the ends of the buffer
1637    /// ## `step`
1638    /// the granularity of the move, as a [`MovementStep`][crate::MovementStep]
1639    /// ## `count`
1640    /// the number of @step units to move
1641    /// ## `extend_selection`
1642    /// true if the move should extend the selection
1643    #[doc(alias = "move-cursor")]
1644    pub fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
1645        &self,
1646        f: F,
1647    ) -> SignalHandlerId {
1648        unsafe extern "C" fn move_cursor_trampoline<
1649            F: Fn(&Label, MovementStep, i32, bool) + 'static,
1650        >(
1651            this: *mut ffi::GtkLabel,
1652            step: ffi::GtkMovementStep,
1653            count: std::ffi::c_int,
1654            extend_selection: glib::ffi::gboolean,
1655            f: glib::ffi::gpointer,
1656        ) {
1657            unsafe {
1658                let f: &F = &*(f as *const F);
1659                f(
1660                    &from_glib_borrow(this),
1661                    from_glib(step),
1662                    count,
1663                    from_glib(extend_selection),
1664                )
1665            }
1666        }
1667        unsafe {
1668            let f: Box_<F> = Box_::new(f);
1669            connect_raw(
1670                self.as_ptr() as *mut _,
1671                c"move-cursor".as_ptr(),
1672                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1673                    move_cursor_trampoline::<F> as *const (),
1674                )),
1675                Box_::into_raw(f),
1676            )
1677        }
1678    }
1679
1680    pub fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) {
1681        self.emit_by_name::<()>("move-cursor", &[&step, &count, &extend_selection]);
1682    }
1683
1684    #[doc(alias = "attributes")]
1685    pub fn connect_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1686        unsafe extern "C" fn notify_attributes_trampoline<F: Fn(&Label) + 'static>(
1687            this: *mut ffi::GtkLabel,
1688            _param_spec: glib::ffi::gpointer,
1689            f: glib::ffi::gpointer,
1690        ) {
1691            unsafe {
1692                let f: &F = &*(f as *const F);
1693                f(&from_glib_borrow(this))
1694            }
1695        }
1696        unsafe {
1697            let f: Box_<F> = Box_::new(f);
1698            connect_raw(
1699                self.as_ptr() as *mut _,
1700                c"notify::attributes".as_ptr(),
1701                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1702                    notify_attributes_trampoline::<F> as *const (),
1703                )),
1704                Box_::into_raw(f),
1705            )
1706        }
1707    }
1708
1709    #[doc(alias = "ellipsize")]
1710    pub fn connect_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1711        unsafe extern "C" fn notify_ellipsize_trampoline<F: Fn(&Label) + 'static>(
1712            this: *mut ffi::GtkLabel,
1713            _param_spec: glib::ffi::gpointer,
1714            f: glib::ffi::gpointer,
1715        ) {
1716            unsafe {
1717                let f: &F = &*(f as *const F);
1718                f(&from_glib_borrow(this))
1719            }
1720        }
1721        unsafe {
1722            let f: Box_<F> = Box_::new(f);
1723            connect_raw(
1724                self.as_ptr() as *mut _,
1725                c"notify::ellipsize".as_ptr(),
1726                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1727                    notify_ellipsize_trampoline::<F> as *const (),
1728                )),
1729                Box_::into_raw(f),
1730            )
1731        }
1732    }
1733
1734    #[doc(alias = "extra-menu")]
1735    pub fn connect_extra_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1736        unsafe extern "C" fn notify_extra_menu_trampoline<F: Fn(&Label) + 'static>(
1737            this: *mut ffi::GtkLabel,
1738            _param_spec: glib::ffi::gpointer,
1739            f: glib::ffi::gpointer,
1740        ) {
1741            unsafe {
1742                let f: &F = &*(f as *const F);
1743                f(&from_glib_borrow(this))
1744            }
1745        }
1746        unsafe {
1747            let f: Box_<F> = Box_::new(f);
1748            connect_raw(
1749                self.as_ptr() as *mut _,
1750                c"notify::extra-menu".as_ptr(),
1751                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1752                    notify_extra_menu_trampoline::<F> as *const (),
1753                )),
1754                Box_::into_raw(f),
1755            )
1756        }
1757    }
1758
1759    #[doc(alias = "justify")]
1760    pub fn connect_justify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1761        unsafe extern "C" fn notify_justify_trampoline<F: Fn(&Label) + 'static>(
1762            this: *mut ffi::GtkLabel,
1763            _param_spec: glib::ffi::gpointer,
1764            f: glib::ffi::gpointer,
1765        ) {
1766            unsafe {
1767                let f: &F = &*(f as *const F);
1768                f(&from_glib_borrow(this))
1769            }
1770        }
1771        unsafe {
1772            let f: Box_<F> = Box_::new(f);
1773            connect_raw(
1774                self.as_ptr() as *mut _,
1775                c"notify::justify".as_ptr(),
1776                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1777                    notify_justify_trampoline::<F> as *const (),
1778                )),
1779                Box_::into_raw(f),
1780            )
1781        }
1782    }
1783
1784    #[doc(alias = "label")]
1785    pub fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1786        unsafe extern "C" fn notify_label_trampoline<F: Fn(&Label) + 'static>(
1787            this: *mut ffi::GtkLabel,
1788            _param_spec: glib::ffi::gpointer,
1789            f: glib::ffi::gpointer,
1790        ) {
1791            unsafe {
1792                let f: &F = &*(f as *const F);
1793                f(&from_glib_borrow(this))
1794            }
1795        }
1796        unsafe {
1797            let f: Box_<F> = Box_::new(f);
1798            connect_raw(
1799                self.as_ptr() as *mut _,
1800                c"notify::label".as_ptr(),
1801                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1802                    notify_label_trampoline::<F> as *const (),
1803                )),
1804                Box_::into_raw(f),
1805            )
1806        }
1807    }
1808
1809    #[doc(alias = "lines")]
1810    pub fn connect_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1811        unsafe extern "C" fn notify_lines_trampoline<F: Fn(&Label) + 'static>(
1812            this: *mut ffi::GtkLabel,
1813            _param_spec: glib::ffi::gpointer,
1814            f: glib::ffi::gpointer,
1815        ) {
1816            unsafe {
1817                let f: &F = &*(f as *const F);
1818                f(&from_glib_borrow(this))
1819            }
1820        }
1821        unsafe {
1822            let f: Box_<F> = Box_::new(f);
1823            connect_raw(
1824                self.as_ptr() as *mut _,
1825                c"notify::lines".as_ptr(),
1826                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1827                    notify_lines_trampoline::<F> as *const (),
1828                )),
1829                Box_::into_raw(f),
1830            )
1831        }
1832    }
1833
1834    #[doc(alias = "max-width-chars")]
1835    pub fn connect_max_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1836        unsafe extern "C" fn notify_max_width_chars_trampoline<F: Fn(&Label) + 'static>(
1837            this: *mut ffi::GtkLabel,
1838            _param_spec: glib::ffi::gpointer,
1839            f: glib::ffi::gpointer,
1840        ) {
1841            unsafe {
1842                let f: &F = &*(f as *const F);
1843                f(&from_glib_borrow(this))
1844            }
1845        }
1846        unsafe {
1847            let f: Box_<F> = Box_::new(f);
1848            connect_raw(
1849                self.as_ptr() as *mut _,
1850                c"notify::max-width-chars".as_ptr(),
1851                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1852                    notify_max_width_chars_trampoline::<F> as *const (),
1853                )),
1854                Box_::into_raw(f),
1855            )
1856        }
1857    }
1858
1859    #[doc(alias = "mnemonic-keyval")]
1860    pub fn connect_mnemonic_keyval_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1861        unsafe extern "C" fn notify_mnemonic_keyval_trampoline<F: Fn(&Label) + 'static>(
1862            this: *mut ffi::GtkLabel,
1863            _param_spec: glib::ffi::gpointer,
1864            f: glib::ffi::gpointer,
1865        ) {
1866            unsafe {
1867                let f: &F = &*(f as *const F);
1868                f(&from_glib_borrow(this))
1869            }
1870        }
1871        unsafe {
1872            let f: Box_<F> = Box_::new(f);
1873            connect_raw(
1874                self.as_ptr() as *mut _,
1875                c"notify::mnemonic-keyval".as_ptr(),
1876                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1877                    notify_mnemonic_keyval_trampoline::<F> as *const (),
1878                )),
1879                Box_::into_raw(f),
1880            )
1881        }
1882    }
1883
1884    #[doc(alias = "mnemonic-widget")]
1885    pub fn connect_mnemonic_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1886        unsafe extern "C" fn notify_mnemonic_widget_trampoline<F: Fn(&Label) + 'static>(
1887            this: *mut ffi::GtkLabel,
1888            _param_spec: glib::ffi::gpointer,
1889            f: glib::ffi::gpointer,
1890        ) {
1891            unsafe {
1892                let f: &F = &*(f as *const F);
1893                f(&from_glib_borrow(this))
1894            }
1895        }
1896        unsafe {
1897            let f: Box_<F> = Box_::new(f);
1898            connect_raw(
1899                self.as_ptr() as *mut _,
1900                c"notify::mnemonic-widget".as_ptr(),
1901                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1902                    notify_mnemonic_widget_trampoline::<F> as *const (),
1903                )),
1904                Box_::into_raw(f),
1905            )
1906        }
1907    }
1908
1909    #[cfg(feature = "v4_6")]
1910    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1911    #[doc(alias = "natural-wrap-mode")]
1912    pub fn connect_natural_wrap_mode_notify<F: Fn(&Self) + 'static>(
1913        &self,
1914        f: F,
1915    ) -> SignalHandlerId {
1916        unsafe extern "C" fn notify_natural_wrap_mode_trampoline<F: Fn(&Label) + 'static>(
1917            this: *mut ffi::GtkLabel,
1918            _param_spec: glib::ffi::gpointer,
1919            f: glib::ffi::gpointer,
1920        ) {
1921            unsafe {
1922                let f: &F = &*(f as *const F);
1923                f(&from_glib_borrow(this))
1924            }
1925        }
1926        unsafe {
1927            let f: Box_<F> = Box_::new(f);
1928            connect_raw(
1929                self.as_ptr() as *mut _,
1930                c"notify::natural-wrap-mode".as_ptr(),
1931                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1932                    notify_natural_wrap_mode_trampoline::<F> as *const (),
1933                )),
1934                Box_::into_raw(f),
1935            )
1936        }
1937    }
1938
1939    #[doc(alias = "selectable")]
1940    pub fn connect_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1941        unsafe extern "C" fn notify_selectable_trampoline<F: Fn(&Label) + 'static>(
1942            this: *mut ffi::GtkLabel,
1943            _param_spec: glib::ffi::gpointer,
1944            f: glib::ffi::gpointer,
1945        ) {
1946            unsafe {
1947                let f: &F = &*(f as *const F);
1948                f(&from_glib_borrow(this))
1949            }
1950        }
1951        unsafe {
1952            let f: Box_<F> = Box_::new(f);
1953            connect_raw(
1954                self.as_ptr() as *mut _,
1955                c"notify::selectable".as_ptr(),
1956                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1957                    notify_selectable_trampoline::<F> as *const (),
1958                )),
1959                Box_::into_raw(f),
1960            )
1961        }
1962    }
1963
1964    #[doc(alias = "single-line-mode")]
1965    pub fn connect_single_line_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1966        unsafe extern "C" fn notify_single_line_mode_trampoline<F: Fn(&Label) + 'static>(
1967            this: *mut ffi::GtkLabel,
1968            _param_spec: glib::ffi::gpointer,
1969            f: glib::ffi::gpointer,
1970        ) {
1971            unsafe {
1972                let f: &F = &*(f as *const F);
1973                f(&from_glib_borrow(this))
1974            }
1975        }
1976        unsafe {
1977            let f: Box_<F> = Box_::new(f);
1978            connect_raw(
1979                self.as_ptr() as *mut _,
1980                c"notify::single-line-mode".as_ptr(),
1981                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1982                    notify_single_line_mode_trampoline::<F> as *const (),
1983                )),
1984                Box_::into_raw(f),
1985            )
1986        }
1987    }
1988
1989    #[cfg(feature = "v4_8")]
1990    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1991    #[doc(alias = "tabs")]
1992    pub fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1993        unsafe extern "C" fn notify_tabs_trampoline<F: Fn(&Label) + 'static>(
1994            this: *mut ffi::GtkLabel,
1995            _param_spec: glib::ffi::gpointer,
1996            f: glib::ffi::gpointer,
1997        ) {
1998            unsafe {
1999                let f: &F = &*(f as *const F);
2000                f(&from_glib_borrow(this))
2001            }
2002        }
2003        unsafe {
2004            let f: Box_<F> = Box_::new(f);
2005            connect_raw(
2006                self.as_ptr() as *mut _,
2007                c"notify::tabs".as_ptr(),
2008                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2009                    notify_tabs_trampoline::<F> as *const (),
2010                )),
2011                Box_::into_raw(f),
2012            )
2013        }
2014    }
2015
2016    #[doc(alias = "use-markup")]
2017    pub fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2018        unsafe extern "C" fn notify_use_markup_trampoline<F: Fn(&Label) + 'static>(
2019            this: *mut ffi::GtkLabel,
2020            _param_spec: glib::ffi::gpointer,
2021            f: glib::ffi::gpointer,
2022        ) {
2023            unsafe {
2024                let f: &F = &*(f as *const F);
2025                f(&from_glib_borrow(this))
2026            }
2027        }
2028        unsafe {
2029            let f: Box_<F> = Box_::new(f);
2030            connect_raw(
2031                self.as_ptr() as *mut _,
2032                c"notify::use-markup".as_ptr(),
2033                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2034                    notify_use_markup_trampoline::<F> as *const (),
2035                )),
2036                Box_::into_raw(f),
2037            )
2038        }
2039    }
2040
2041    #[doc(alias = "use-underline")]
2042    pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2043        unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&Label) + 'static>(
2044            this: *mut ffi::GtkLabel,
2045            _param_spec: glib::ffi::gpointer,
2046            f: glib::ffi::gpointer,
2047        ) {
2048            unsafe {
2049                let f: &F = &*(f as *const F);
2050                f(&from_glib_borrow(this))
2051            }
2052        }
2053        unsafe {
2054            let f: Box_<F> = Box_::new(f);
2055            connect_raw(
2056                self.as_ptr() as *mut _,
2057                c"notify::use-underline".as_ptr(),
2058                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2059                    notify_use_underline_trampoline::<F> as *const (),
2060                )),
2061                Box_::into_raw(f),
2062            )
2063        }
2064    }
2065
2066    #[doc(alias = "width-chars")]
2067    pub fn connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2068        unsafe extern "C" fn notify_width_chars_trampoline<F: Fn(&Label) + 'static>(
2069            this: *mut ffi::GtkLabel,
2070            _param_spec: glib::ffi::gpointer,
2071            f: glib::ffi::gpointer,
2072        ) {
2073            unsafe {
2074                let f: &F = &*(f as *const F);
2075                f(&from_glib_borrow(this))
2076            }
2077        }
2078        unsafe {
2079            let f: Box_<F> = Box_::new(f);
2080            connect_raw(
2081                self.as_ptr() as *mut _,
2082                c"notify::width-chars".as_ptr(),
2083                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2084                    notify_width_chars_trampoline::<F> as *const (),
2085                )),
2086                Box_::into_raw(f),
2087            )
2088        }
2089    }
2090
2091    #[doc(alias = "wrap")]
2092    pub fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2093        unsafe extern "C" fn notify_wrap_trampoline<F: Fn(&Label) + 'static>(
2094            this: *mut ffi::GtkLabel,
2095            _param_spec: glib::ffi::gpointer,
2096            f: glib::ffi::gpointer,
2097        ) {
2098            unsafe {
2099                let f: &F = &*(f as *const F);
2100                f(&from_glib_borrow(this))
2101            }
2102        }
2103        unsafe {
2104            let f: Box_<F> = Box_::new(f);
2105            connect_raw(
2106                self.as_ptr() as *mut _,
2107                c"notify::wrap".as_ptr(),
2108                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2109                    notify_wrap_trampoline::<F> as *const (),
2110                )),
2111                Box_::into_raw(f),
2112            )
2113        }
2114    }
2115
2116    #[doc(alias = "wrap-mode")]
2117    pub fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2118        unsafe extern "C" fn notify_wrap_mode_trampoline<F: Fn(&Label) + 'static>(
2119            this: *mut ffi::GtkLabel,
2120            _param_spec: glib::ffi::gpointer,
2121            f: glib::ffi::gpointer,
2122        ) {
2123            unsafe {
2124                let f: &F = &*(f as *const F);
2125                f(&from_glib_borrow(this))
2126            }
2127        }
2128        unsafe {
2129            let f: Box_<F> = Box_::new(f);
2130            connect_raw(
2131                self.as_ptr() as *mut _,
2132                c"notify::wrap-mode".as_ptr(),
2133                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2134                    notify_wrap_mode_trampoline::<F> as *const (),
2135                )),
2136                Box_::into_raw(f),
2137            )
2138        }
2139    }
2140
2141    #[doc(alias = "xalign")]
2142    pub fn connect_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2143        unsafe extern "C" fn notify_xalign_trampoline<F: Fn(&Label) + 'static>(
2144            this: *mut ffi::GtkLabel,
2145            _param_spec: glib::ffi::gpointer,
2146            f: glib::ffi::gpointer,
2147        ) {
2148            unsafe {
2149                let f: &F = &*(f as *const F);
2150                f(&from_glib_borrow(this))
2151            }
2152        }
2153        unsafe {
2154            let f: Box_<F> = Box_::new(f);
2155            connect_raw(
2156                self.as_ptr() as *mut _,
2157                c"notify::xalign".as_ptr(),
2158                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2159                    notify_xalign_trampoline::<F> as *const (),
2160                )),
2161                Box_::into_raw(f),
2162            )
2163        }
2164    }
2165
2166    #[doc(alias = "yalign")]
2167    pub fn connect_yalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2168        unsafe extern "C" fn notify_yalign_trampoline<F: Fn(&Label) + 'static>(
2169            this: *mut ffi::GtkLabel,
2170            _param_spec: glib::ffi::gpointer,
2171            f: glib::ffi::gpointer,
2172        ) {
2173            unsafe {
2174                let f: &F = &*(f as *const F);
2175                f(&from_glib_borrow(this))
2176            }
2177        }
2178        unsafe {
2179            let f: Box_<F> = Box_::new(f);
2180            connect_raw(
2181                self.as_ptr() as *mut _,
2182                c"notify::yalign".as_ptr(),
2183                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2184                    notify_yalign_trampoline::<F> as *const (),
2185                )),
2186                Box_::into_raw(f),
2187            )
2188        }
2189    }
2190}
2191
2192impl Default for Label {
2193    fn default() -> Self {
2194        glib::object::Object::new::<Self>()
2195    }
2196}
2197
2198// rustdoc-stripper-ignore-next
2199/// A [builder-pattern] type to construct [`Label`] objects.
2200///
2201/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
2202#[must_use = "The builder must be built to be used"]
2203pub struct LabelBuilder {
2204    builder: glib::object::ObjectBuilder<'static, Label>,
2205}
2206
2207impl LabelBuilder {
2208    fn new() -> Self {
2209        Self {
2210            builder: glib::object::Object::builder(),
2211        }
2212    }
2213
2214    /// A list of style attributes to apply to the text of the label.
2215    pub fn attributes(self, attributes: &pango::AttrList) -> Self {
2216        Self {
2217            builder: self.builder.property("attributes", attributes.clone()),
2218        }
2219    }
2220
2221    /// The preferred place to ellipsize the string, if the label does
2222    /// not have enough room to display the entire string.
2223    ///
2224    /// Note that setting this property to a value other than
2225    /// [enum.Pango.EllipsizeMode.none] has the side-effect that the label requests
2226    /// only enough space to display the ellipsis "...". In particular, this
2227    /// means that ellipsizing labels do not work well in notebook tabs, unless
2228    /// the [`tab-expand`][struct@crate::NotebookPage#tab-expand] child property is set to true.
2229    ///
2230    /// Other ways to set a label's width are [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()]
2231    /// and [`Label::set_width_chars()`][crate::Label::set_width_chars()].
2232    pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
2233        Self {
2234            builder: self.builder.property("ellipsize", ellipsize),
2235        }
2236    }
2237
2238    /// A menu model whose contents will be appended to the context menu.
2239    pub fn extra_menu(self, extra_menu: &impl IsA<gio::MenuModel>) -> Self {
2240        Self {
2241            builder: self
2242                .builder
2243                .property("extra-menu", extra_menu.clone().upcast()),
2244        }
2245    }
2246
2247    /// The alignment of the lines in the text of the label, relative to each other.
2248    ///
2249    /// This does *not* affect the alignment of the label within its allocation.
2250    /// See [`xalign`][struct@crate::Label#xalign] for that.
2251    pub fn justify(self, justify: Justification) -> Self {
2252        Self {
2253            builder: self.builder.property("justify", justify),
2254        }
2255    }
2256
2257    /// The contents of the label.
2258    ///
2259    /// If the string contains Pango markup (see `parse_markup()`),
2260    /// you will have to set the [`use-markup`][struct@crate::Label#use-markup] property to
2261    /// true in order for the label to display the markup attributes. See also
2262    /// [`Label::set_markup()`][crate::Label::set_markup()] for a convenience function that sets both
2263    /// this property and the [`use-markup`][struct@crate::Label#use-markup] property at the
2264    /// same time.
2265    ///
2266    /// If the string contains underlines acting as mnemonics, you will have to
2267    /// set the [`use-underline`][struct@crate::Label#use-underline] property to true in order
2268    /// for the label to display them.
2269    pub fn label(self, label: impl Into<glib::GString>) -> Self {
2270        Self {
2271            builder: self.builder.property("label", label.into()),
2272        }
2273    }
2274
2275    /// The number of lines to which an ellipsized, wrapping label
2276    /// should display before it gets ellipsized. This both prevents the label
2277    /// from ellipsizing before this many lines are displayed, and limits the
2278    /// height request of the label to this many lines.
2279    ///
2280    /// ::: warning
2281    ///     Setting this property has unintuitive and unfortunate consequences
2282    ///     for the minimum _width_ of the label. Specifically, if the height
2283    ///     of the label is such that it fits a smaller number of lines than
2284    ///     the value of this property, the label can not be ellipsized at all,
2285    ///     which means it must be wide enough to fit all the text fully.
2286    ///
2287    /// This property has no effect if the label is not wrapping or ellipsized.
2288    ///
2289    /// Set this property to -1 if you don't want to limit the number of lines.
2290    pub fn lines(self, lines: i32) -> Self {
2291        Self {
2292            builder: self.builder.property("lines", lines),
2293        }
2294    }
2295
2296    /// The desired maximum width of the label, in characters.
2297    ///
2298    /// If this property is set to -1, the width will be calculated automatically.
2299    ///
2300    /// See the section on [text layout](class.Label.html#text-layout) for details
2301    /// of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
2302    /// determine the width of ellipsized and wrapped labels.
2303    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
2304        Self {
2305            builder: self.builder.property("max-width-chars", max_width_chars),
2306        }
2307    }
2308
2309    /// The widget to be activated when the labels mnemonic key is pressed.
2310    pub fn mnemonic_widget(self, mnemonic_widget: &impl IsA<Widget>) -> Self {
2311        Self {
2312            builder: self
2313                .builder
2314                .property("mnemonic-widget", mnemonic_widget.clone().upcast()),
2315        }
2316    }
2317
2318    /// Select the line wrapping for the natural size request.
2319    ///
2320    /// This only affects the natural size requested. For the actual wrapping
2321    /// used, see the [`wrap-mode`][struct@crate::Label#wrap-mode] property.
2322    ///
2323    /// The default is [enum@Gtk.NaturalWrapMode.inherit], which inherits
2324    /// the behavior of the [`wrap-mode`][struct@crate::Label#wrap-mode] property.
2325    #[cfg(feature = "v4_6")]
2326    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2327    pub fn natural_wrap_mode(self, natural_wrap_mode: NaturalWrapMode) -> Self {
2328        Self {
2329            builder: self
2330                .builder
2331                .property("natural-wrap-mode", natural_wrap_mode),
2332        }
2333    }
2334
2335    /// Whether the label text can be selected with the mouse.
2336    pub fn selectable(self, selectable: bool) -> Self {
2337        Self {
2338            builder: self.builder.property("selectable", selectable),
2339        }
2340    }
2341
2342    /// Whether the label is in single line mode.
2343    ///
2344    /// In single line mode, the height of the label does not depend on the
2345    /// actual text, it is always set to ascent + descent of the font. This
2346    /// can be an advantage in situations where resizing the label because
2347    /// of text changes would be distracting, e.g. in a statusbar.
2348    pub fn single_line_mode(self, single_line_mode: bool) -> Self {
2349        Self {
2350            builder: self.builder.property("single-line-mode", single_line_mode),
2351        }
2352    }
2353
2354    /// Custom tabs for this label.
2355    #[cfg(feature = "v4_8")]
2356    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
2357    pub fn tabs(self, tabs: &pango::TabArray) -> Self {
2358        Self {
2359            builder: self.builder.property("tabs", tabs),
2360        }
2361    }
2362
2363    /// True if the text of the label includes Pango markup.
2364    ///
2365    /// See `parse_markup()`.
2366    pub fn use_markup(self, use_markup: bool) -> Self {
2367        Self {
2368            builder: self.builder.property("use-markup", use_markup),
2369        }
2370    }
2371
2372    /// True if the text of the label indicates a mnemonic with an `_`
2373    /// before the mnemonic character.
2374    pub fn use_underline(self, use_underline: bool) -> Self {
2375        Self {
2376            builder: self.builder.property("use-underline", use_underline),
2377        }
2378    }
2379
2380    /// The desired width of the label, in characters.
2381    ///
2382    /// If this property is set to -1, the width will be calculated automatically.
2383    ///
2384    /// See the section on [text layout](class.Label.html#text-layout) for details
2385    /// of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
2386    /// determine the width of ellipsized and wrapped labels.
2387    pub fn width_chars(self, width_chars: i32) -> Self {
2388        Self {
2389            builder: self.builder.property("width-chars", width_chars),
2390        }
2391    }
2392
2393    /// True if the label text will wrap if it gets too wide.
2394    pub fn wrap(self, wrap: bool) -> Self {
2395        Self {
2396            builder: self.builder.property("wrap", wrap),
2397        }
2398    }
2399
2400    /// Controls how the line wrapping is done.
2401    ///
2402    /// This only affects the formatting if line wrapping is on (see the
2403    /// [`wrap`][struct@crate::Label#wrap] property). The default is [enum@Pango.WrapMode.word],
2404    /// which means wrap on word boundaries.
2405    ///
2406    /// For sizing behavior, also consider the [`natural-wrap-mode`][struct@crate::Label#natural-wrap-mode]
2407    /// property.
2408    pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
2409        Self {
2410            builder: self.builder.property("wrap-mode", wrap_mode),
2411        }
2412    }
2413
2414    /// The horizontal alignment of the label text inside its size allocation.
2415    ///
2416    /// Compare this to [`halign`][struct@crate::Widget#halign], which determines how the
2417    /// labels size allocation is positioned in the space available for the label.
2418    pub fn xalign(self, xalign: f32) -> Self {
2419        Self {
2420            builder: self.builder.property("xalign", xalign),
2421        }
2422    }
2423
2424    /// The vertical alignment of the label text inside its size allocation.
2425    ///
2426    /// Compare this to [`valign`][struct@crate::Widget#valign], which determines how the
2427    /// labels size allocation is positioned in the space available for the label.
2428    pub fn yalign(self, yalign: f32) -> Self {
2429        Self {
2430            builder: self.builder.property("yalign", yalign),
2431        }
2432    }
2433
2434    /// Whether the widget or any of its descendents can accept
2435    /// the input focus.
2436    ///
2437    /// This property is meant to be set by widget implementations,
2438    /// typically in their instance init function.
2439    pub fn can_focus(self, can_focus: bool) -> Self {
2440        Self {
2441            builder: self.builder.property("can-focus", can_focus),
2442        }
2443    }
2444
2445    /// Whether the widget can receive pointer events.
2446    pub fn can_target(self, can_target: bool) -> Self {
2447        Self {
2448            builder: self.builder.property("can-target", can_target),
2449        }
2450    }
2451
2452    /// A list of css classes applied to this widget.
2453    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
2454        Self {
2455            builder: self.builder.property("css-classes", css_classes.into()),
2456        }
2457    }
2458
2459    /// The name of this widget in the CSS tree.
2460    ///
2461    /// This property is meant to be set by widget implementations,
2462    /// typically in their instance init function.
2463    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
2464        Self {
2465            builder: self.builder.property("css-name", css_name.into()),
2466        }
2467    }
2468
2469    /// The cursor used by @widget.
2470    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
2471        Self {
2472            builder: self.builder.property("cursor", cursor.clone()),
2473        }
2474    }
2475
2476    /// Whether the widget should grab focus when it is clicked with the mouse.
2477    ///
2478    /// This property is only relevant for widgets that can take focus.
2479    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
2480        Self {
2481            builder: self.builder.property("focus-on-click", focus_on_click),
2482        }
2483    }
2484
2485    /// Whether this widget itself will accept the input focus.
2486    pub fn focusable(self, focusable: bool) -> Self {
2487        Self {
2488            builder: self.builder.property("focusable", focusable),
2489        }
2490    }
2491
2492    /// How to distribute horizontal space if widget gets extra space.
2493    pub fn halign(self, halign: Align) -> Self {
2494        Self {
2495            builder: self.builder.property("halign", halign),
2496        }
2497    }
2498
2499    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
2500    /// signal on @widget.
2501    ///
2502    /// A true value indicates that @widget can have a tooltip, in this case
2503    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
2504    /// determine whether it will provide a tooltip or not.
2505    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
2506        Self {
2507            builder: self.builder.property("has-tooltip", has_tooltip),
2508        }
2509    }
2510
2511    /// Overrides for height request of the widget.
2512    ///
2513    /// If this is -1, the natural request will be used.
2514    pub fn height_request(self, height_request: i32) -> Self {
2515        Self {
2516            builder: self.builder.property("height-request", height_request),
2517        }
2518    }
2519
2520    /// Whether to expand horizontally.
2521    pub fn hexpand(self, hexpand: bool) -> Self {
2522        Self {
2523            builder: self.builder.property("hexpand", hexpand),
2524        }
2525    }
2526
2527    /// Whether to use the `hexpand` property.
2528    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
2529        Self {
2530            builder: self.builder.property("hexpand-set", hexpand_set),
2531        }
2532    }
2533
2534    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
2535    /// the preferred size of the widget, and allocate its children.
2536    ///
2537    /// This property is meant to be set by widget implementations,
2538    /// typically in their instance init function.
2539    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
2540        Self {
2541            builder: self
2542                .builder
2543                .property("layout-manager", layout_manager.clone().upcast()),
2544        }
2545    }
2546
2547    /// Makes this widget act like a modal dialog, with respect to
2548    /// event delivery.
2549    ///
2550    /// Global event controllers will not handle events with targets
2551    /// inside the widget, unless they are set up to ignore propagation
2552    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
2553    #[cfg(feature = "v4_18")]
2554    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
2555    pub fn limit_events(self, limit_events: bool) -> Self {
2556        Self {
2557            builder: self.builder.property("limit-events", limit_events),
2558        }
2559    }
2560
2561    /// Margin on bottom side of widget.
2562    ///
2563    /// This property adds margin outside of the widget's normal size
2564    /// request, the margin will be added in addition to the size from
2565    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2566    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
2567        Self {
2568            builder: self.builder.property("margin-bottom", margin_bottom),
2569        }
2570    }
2571
2572    /// Margin on end of widget, horizontally.
2573    ///
2574    /// This property supports left-to-right and right-to-left text
2575    /// directions.
2576    ///
2577    /// This property adds margin outside of the widget's normal size
2578    /// request, the margin will be added in addition to the size from
2579    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2580    pub fn margin_end(self, margin_end: i32) -> Self {
2581        Self {
2582            builder: self.builder.property("margin-end", margin_end),
2583        }
2584    }
2585
2586    /// Margin on start of widget, horizontally.
2587    ///
2588    /// This property supports left-to-right and right-to-left text
2589    /// directions.
2590    ///
2591    /// This property adds margin outside of the widget's normal size
2592    /// request, the margin will be added in addition to the size from
2593    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2594    pub fn margin_start(self, margin_start: i32) -> Self {
2595        Self {
2596            builder: self.builder.property("margin-start", margin_start),
2597        }
2598    }
2599
2600    /// Margin on top side of widget.
2601    ///
2602    /// This property adds margin outside of the widget's normal size
2603    /// request, the margin will be added in addition to the size from
2604    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2605    pub fn margin_top(self, margin_top: i32) -> Self {
2606        Self {
2607            builder: self.builder.property("margin-top", margin_top),
2608        }
2609    }
2610
2611    /// The name of the widget.
2612    pub fn name(self, name: impl Into<glib::GString>) -> Self {
2613        Self {
2614            builder: self.builder.property("name", name.into()),
2615        }
2616    }
2617
2618    /// The requested opacity of the widget.
2619    pub fn opacity(self, opacity: f64) -> Self {
2620        Self {
2621            builder: self.builder.property("opacity", opacity),
2622        }
2623    }
2624
2625    /// How content outside the widget's content area is treated.
2626    ///
2627    /// This property is meant to be set by widget implementations,
2628    /// typically in their instance init function.
2629    pub fn overflow(self, overflow: Overflow) -> Self {
2630        Self {
2631            builder: self.builder.property("overflow", overflow),
2632        }
2633    }
2634
2635    /// Whether the widget will receive the default action when it is focused.
2636    pub fn receives_default(self, receives_default: bool) -> Self {
2637        Self {
2638            builder: self.builder.property("receives-default", receives_default),
2639        }
2640    }
2641
2642    /// Whether the widget responds to input.
2643    pub fn sensitive(self, sensitive: bool) -> Self {
2644        Self {
2645            builder: self.builder.property("sensitive", sensitive),
2646        }
2647    }
2648
2649    /// Sets the text of tooltip to be the given string, which is marked up
2650    /// with Pango markup.
2651    ///
2652    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
2653    ///
2654    /// This is a convenience property which will take care of getting the
2655    /// tooltip shown if the given string is not `NULL`:
2656    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2657    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2658    /// the default signal handler.
2659    ///
2660    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2661    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2662    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2663        Self {
2664            builder: self
2665                .builder
2666                .property("tooltip-markup", tooltip_markup.into()),
2667        }
2668    }
2669
2670    /// Sets the text of tooltip to be the given string.
2671    ///
2672    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2673    ///
2674    /// This is a convenience property which will take care of getting the
2675    /// tooltip shown if the given string is not `NULL`:
2676    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2677    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2678    /// the default signal handler.
2679    ///
2680    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2681    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2682    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2683        Self {
2684            builder: self.builder.property("tooltip-text", tooltip_text.into()),
2685        }
2686    }
2687
2688    /// How to distribute vertical space if widget gets extra space.
2689    pub fn valign(self, valign: Align) -> Self {
2690        Self {
2691            builder: self.builder.property("valign", valign),
2692        }
2693    }
2694
2695    /// Whether to expand vertically.
2696    pub fn vexpand(self, vexpand: bool) -> Self {
2697        Self {
2698            builder: self.builder.property("vexpand", vexpand),
2699        }
2700    }
2701
2702    /// Whether to use the `vexpand` property.
2703    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2704        Self {
2705            builder: self.builder.property("vexpand-set", vexpand_set),
2706        }
2707    }
2708
2709    /// Whether the widget is visible.
2710    pub fn visible(self, visible: bool) -> Self {
2711        Self {
2712            builder: self.builder.property("visible", visible),
2713        }
2714    }
2715
2716    /// Overrides for width request of the widget.
2717    ///
2718    /// If this is -1, the natural request will be used.
2719    pub fn width_request(self, width_request: i32) -> Self {
2720        Self {
2721            builder: self.builder.property("width-request", width_request),
2722        }
2723    }
2724
2725    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
2726    ///
2727    /// The accessible role cannot be changed once set.
2728    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
2729        Self {
2730            builder: self.builder.property("accessible-role", accessible_role),
2731        }
2732    }
2733
2734    // rustdoc-stripper-ignore-next
2735    /// Build the [`Label`].
2736    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2737    pub fn build(self) -> Label {
2738        assert_initialized_main_thread!();
2739        self.builder.build()
2740    }
2741}