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    ///  Emitted when the widget’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    /// the target of the label’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    /// Gets the tab stops for the label.
1042    ///
1043    /// The returned array will be `NULL` if “standard” (8-space) tabs are used.
1044    ///
1045    /// # Returns
1046    ///
1047    /// copy of default tab array,
1048    ///   or `NULL` if standard tabs are used
1049    #[cfg(feature = "v4_8")]
1050    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1051    #[doc(alias = "gtk_label_get_tabs")]
1052    #[doc(alias = "get_tabs")]
1053    pub fn tabs(&self) -> Option<pango::TabArray> {
1054        unsafe { from_glib_full(ffi::gtk_label_get_tabs(self.to_glib_none().0)) }
1055    }
1056
1057    /// Gets the text of the label.
1058    ///
1059    /// The returned text is as it appears on screen. This does not include
1060    /// any embedded underlines indicating mnemonics or Pango markup. (See
1061    /// [`label()`][Self::label()])
1062    ///
1063    /// # Returns
1064    ///
1065    /// the text in the label widget
1066    #[doc(alias = "gtk_label_get_text")]
1067    #[doc(alias = "get_text")]
1068    pub fn text(&self) -> glib::GString {
1069        unsafe { from_glib_none(ffi::gtk_label_get_text(self.to_glib_none().0)) }
1070    }
1071
1072    /// Returns whether the label’s text is interpreted as Pango markup.
1073    ///
1074    /// See [`set_use_markup()`][Self::set_use_markup()].
1075    ///
1076    /// # Returns
1077    ///
1078    /// true if the label’s text will be parsed for markup
1079    #[doc(alias = "gtk_label_get_use_markup")]
1080    #[doc(alias = "get_use_markup")]
1081    #[doc(alias = "use-markup")]
1082    pub fn uses_markup(&self) -> bool {
1083        unsafe { from_glib(ffi::gtk_label_get_use_markup(self.to_glib_none().0)) }
1084    }
1085
1086    /// Returns whether underlines in the label indicate mnemonics.
1087    ///
1088    /// See [`set_use_underline()`][Self::set_use_underline()].
1089    ///
1090    /// # Returns
1091    ///
1092    /// true if underlines in the label indicate mnemonics
1093    #[doc(alias = "gtk_label_get_use_underline")]
1094    #[doc(alias = "get_use_underline")]
1095    #[doc(alias = "use-underline")]
1096    pub fn uses_underline(&self) -> bool {
1097        unsafe { from_glib(ffi::gtk_label_get_use_underline(self.to_glib_none().0)) }
1098    }
1099
1100    /// Retrieves the desired width of the label in characters.
1101    ///
1102    /// See [`set_width_chars()`][Self::set_width_chars()].
1103    ///
1104    /// # Returns
1105    ///
1106    /// the desired width of the label, in characters
1107    #[doc(alias = "gtk_label_get_width_chars")]
1108    #[doc(alias = "get_width_chars")]
1109    #[doc(alias = "width-chars")]
1110    pub fn width_chars(&self) -> i32 {
1111        unsafe { ffi::gtk_label_get_width_chars(self.to_glib_none().0) }
1112    }
1113
1114    /// Returns whether lines in the label are automatically wrapped.
1115    ///
1116    /// See [`set_wrap()`][Self::set_wrap()].
1117    ///
1118    /// # Returns
1119    ///
1120    /// true if the lines of the label are automatically wrapped
1121    #[doc(alias = "gtk_label_get_wrap")]
1122    #[doc(alias = "get_wrap")]
1123    #[doc(alias = "wrap")]
1124    pub fn wraps(&self) -> bool {
1125        unsafe { from_glib(ffi::gtk_label_get_wrap(self.to_glib_none().0)) }
1126    }
1127
1128    /// Returns line wrap mode used by the label.
1129    ///
1130    /// See [`set_wrap_mode()`][Self::set_wrap_mode()].
1131    ///
1132    /// # Returns
1133    ///
1134    /// the line wrap mode
1135    #[doc(alias = "gtk_label_get_wrap_mode")]
1136    #[doc(alias = "get_wrap_mode")]
1137    #[doc(alias = "wrap-mode")]
1138    pub fn wrap_mode(&self) -> pango::WrapMode {
1139        unsafe { from_glib(ffi::gtk_label_get_wrap_mode(self.to_glib_none().0)) }
1140    }
1141
1142    /// Gets the `xalign` of the label.
1143    ///
1144    /// See the [`xalign`][struct@crate::Label#xalign] property.
1145    ///
1146    /// # Returns
1147    ///
1148    /// the xalign value
1149    #[doc(alias = "gtk_label_get_xalign")]
1150    #[doc(alias = "get_xalign")]
1151    pub fn xalign(&self) -> f32 {
1152        unsafe { ffi::gtk_label_get_xalign(self.to_glib_none().0) }
1153    }
1154
1155    /// Gets the `yalign` of the label.
1156    ///
1157    /// See the [`yalign`][struct@crate::Label#yalign] property.
1158    ///
1159    /// # Returns
1160    ///
1161    /// the yalign value
1162    #[doc(alias = "gtk_label_get_yalign")]
1163    #[doc(alias = "get_yalign")]
1164    pub fn yalign(&self) -> f32 {
1165        unsafe { ffi::gtk_label_get_yalign(self.to_glib_none().0) }
1166    }
1167
1168    /// Selects a range of characters in the label, if the label is selectable.
1169    ///
1170    /// See [`set_selectable()`][Self::set_selectable()]. If the label is not selectable,
1171    /// this function has no effect. If @start_offset or
1172    /// @end_offset are -1, then the end of the label will be substituted.
1173    /// ## `start_offset`
1174    /// start offset, in characters
1175    /// ## `end_offset`
1176    /// end offset, in characters
1177    #[doc(alias = "gtk_label_select_region")]
1178    pub fn select_region(&self, start_offset: i32, end_offset: i32) {
1179        unsafe {
1180            ffi::gtk_label_select_region(self.to_glib_none().0, start_offset, end_offset);
1181        }
1182    }
1183
1184    /// Apply attributes to the label text.
1185    ///
1186    /// The attributes set with this function will be applied and merged with
1187    /// any other attributes previously effected by way of the
1188    /// [`use-underline`][struct@crate::Label#use-underline] or [`use-markup`][struct@crate::Label#use-markup]
1189    /// properties
1190    ///
1191    /// While it is not recommended to mix markup strings with manually set
1192    /// attributes, if you must; know that the attributes will be applied
1193    /// to the label after the markup string is parsed.
1194    /// ## `attrs`
1195    /// a list of style attributes
1196    #[doc(alias = "gtk_label_set_attributes")]
1197    #[doc(alias = "attributes")]
1198    pub fn set_attributes(&self, attrs: Option<&pango::AttrList>) {
1199        unsafe {
1200            ffi::gtk_label_set_attributes(self.to_glib_none().0, attrs.to_glib_none().0);
1201        }
1202    }
1203
1204    /// Sets the mode used to ellipsize the text.
1205    ///
1206    /// The text will be ellipsized if there is not
1207    /// enough space to render the entire string.
1208    /// ## `mode`
1209    /// the ellipsization mode
1210    #[doc(alias = "gtk_label_set_ellipsize")]
1211    #[doc(alias = "ellipsize")]
1212    pub fn set_ellipsize(&self, mode: pango::EllipsizeMode) {
1213        unsafe {
1214            ffi::gtk_label_set_ellipsize(self.to_glib_none().0, mode.into_glib());
1215        }
1216    }
1217
1218    /// Sets a menu model to add to the context menu of the label.
1219    /// ## `model`
1220    /// a menu model
1221    #[doc(alias = "gtk_label_set_extra_menu")]
1222    #[doc(alias = "extra-menu")]
1223    pub fn set_extra_menu(&self, model: Option<&impl IsA<gio::MenuModel>>) {
1224        unsafe {
1225            ffi::gtk_label_set_extra_menu(
1226                self.to_glib_none().0,
1227                model.map(|p| p.as_ref()).to_glib_none().0,
1228            );
1229        }
1230    }
1231
1232    /// Sets the alignment of lines in the label relative to each other.
1233    ///
1234    /// This function has no effect on labels containing only a single line.
1235    ///
1236    /// [enum@Gtk.Justification.left] is the default value when the widget
1237    /// is first created with [`new()`][Self::new()].
1238    ///
1239    /// If you instead want to set the alignment of the label as a whole,
1240    /// use [`WidgetExt::set_halign()`][crate::prelude::WidgetExt::set_halign()] instead.
1241    /// ## `jtype`
1242    /// the new justification
1243    #[doc(alias = "gtk_label_set_justify")]
1244    #[doc(alias = "justify")]
1245    pub fn set_justify(&self, jtype: Justification) {
1246        unsafe {
1247            ffi::gtk_label_set_justify(self.to_glib_none().0, jtype.into_glib());
1248        }
1249    }
1250
1251    /// Sets the text of the label.
1252    ///
1253    /// The label is interpreted as including embedded underlines and/or Pango
1254    /// markup depending on the values of the [`use-underline`][struct@crate::Label#use-underline]
1255    /// and [`use-markup`][struct@crate::Label#use-markup] properties.
1256    /// ## `str`
1257    /// the new text to set for the label
1258    #[doc(alias = "gtk_label_set_label")]
1259    #[doc(alias = "label")]
1260    pub fn set_label(&self, str: &str) {
1261        unsafe {
1262            ffi::gtk_label_set_label(self.to_glib_none().0, str.to_glib_none().0);
1263        }
1264    }
1265
1266    /// Sets the number of lines to which an ellipsized, wrapping label
1267    /// should be limited.
1268    ///
1269    /// This has no effect if the label is not wrapping or ellipsized.
1270    /// Set this to -1 if you don’t want to limit the number of lines.
1271    /// ## `lines`
1272    /// the desired number of lines, or -1
1273    #[doc(alias = "gtk_label_set_lines")]
1274    #[doc(alias = "lines")]
1275    pub fn set_lines(&self, lines: i32) {
1276        unsafe {
1277            ffi::gtk_label_set_lines(self.to_glib_none().0, lines);
1278        }
1279    }
1280
1281    /// ";
1282    /// char *markup;
1283    ///
1284    /// markup = g_markup_printf_escaped (format, str);
1285    /// gtk_label_set_markup (GTK_LABEL (self), markup);
1286    /// g_free (markup);
1287    /// ```text
1288    ///
1289    /// This function sets the [`use-markup`][struct@crate::Label#use-markup] property
1290    /// to true.
1291    ///
1292    /// Also see [`set_text()`][Self::set_text()].
1293    /// ## `str`
1294    /// the markup string
1295    #[doc(alias = "gtk_label_set_markup")]
1296    pub fn set_markup(&self, str: &str) {
1297        unsafe {
1298            ffi::gtk_label_set_markup(self.to_glib_none().0, str.to_glib_none().0);
1299        }
1300    }
1301
1302    /// Sets the labels text, attributes and mnemonic from markup.
1303    ///
1304    /// Parses @str which is marked up with Pango markup (see `parse_markup()`),
1305    /// setting the label’s text and attribute list based on the parse results.
1306    /// If characters in @str are preceded by an underscore, they are underlined
1307    /// indicating that they represent a keyboard accelerator called a mnemonic.
1308    ///
1309    /// The mnemonic key can be used to activate another widget, chosen
1310    /// automatically, or explicitly using [`set_mnemonic_widget()`][Self::set_mnemonic_widget()].
1311    /// ## `str`
1312    /// the markup string
1313    #[doc(alias = "gtk_label_set_markup_with_mnemonic")]
1314    pub fn set_markup_with_mnemonic(&self, str: &str) {
1315        unsafe {
1316            ffi::gtk_label_set_markup_with_mnemonic(self.to_glib_none().0, str.to_glib_none().0);
1317        }
1318    }
1319
1320    /// Sets the maximum width of the label in characters.
1321    /// ## `n_chars`
1322    /// the new maximum width, in characters.
1323    #[doc(alias = "gtk_label_set_max_width_chars")]
1324    #[doc(alias = "max-width-chars")]
1325    pub fn set_max_width_chars(&self, n_chars: i32) {
1326        unsafe {
1327            ffi::gtk_label_set_max_width_chars(self.to_glib_none().0, n_chars);
1328        }
1329    }
1330
1331    /// Associate the label with its mnemonic target.
1332    ///
1333    /// If the label has been set so that it has a mnemonic key (using
1334    /// i.e. [`set_markup_with_mnemonic()`][Self::set_markup_with_mnemonic()],
1335    /// [`set_text_with_mnemonic()`][Self::set_text_with_mnemonic()],
1336    /// [`with_mnemonic()`][Self::with_mnemonic()]
1337    /// or the [`use_underline`][struct@crate::Label#use_underline] property) the label can
1338    /// be associated with a widget that is the target of the mnemonic.
1339    /// When the label is inside a widget (like a [`Button`][crate::Button] or a
1340    /// [`Notebook`][crate::Notebook] tab) it is automatically associated with the
1341    /// correct widget, but sometimes (i.e. when the target is a [`Entry`][crate::Entry]
1342    /// next to the label) you need to set it explicitly using this function.
1343    ///
1344    /// The target widget will be accelerated by emitting the
1345    /// [`mnemonic-activate`][struct@crate::Widget#mnemonic-activate] signal on it. The default handler
1346    /// for this signal will activate the widget if there are no mnemonic
1347    /// collisions and toggle focus between the colliding widgets otherwise.
1348    /// ## `widget`
1349    /// the target widget
1350    #[doc(alias = "gtk_label_set_mnemonic_widget")]
1351    #[doc(alias = "mnemonic-widget")]
1352    pub fn set_mnemonic_widget(&self, widget: Option<&impl IsA<Widget>>) {
1353        unsafe {
1354            ffi::gtk_label_set_mnemonic_widget(
1355                self.to_glib_none().0,
1356                widget.map(|p| p.as_ref()).to_glib_none().0,
1357            );
1358        }
1359    }
1360
1361    /// Selects the line wrapping for the natural size request.
1362    ///
1363    /// This only affects the natural size requested, for the actual wrapping used,
1364    /// see the [`wrap-mode`][struct@crate::Label#wrap-mode] property.
1365    /// ## `wrap_mode`
1366    /// the line wrapping mode
1367    #[cfg(feature = "v4_6")]
1368    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1369    #[doc(alias = "gtk_label_set_natural_wrap_mode")]
1370    #[doc(alias = "natural-wrap-mode")]
1371    pub fn set_natural_wrap_mode(&self, wrap_mode: NaturalWrapMode) {
1372        unsafe {
1373            ffi::gtk_label_set_natural_wrap_mode(self.to_glib_none().0, wrap_mode.into_glib());
1374        }
1375    }
1376
1377    /// Makes text in the label selectable.
1378    ///
1379    /// Selectable labels allow the user to select text from the label,
1380    /// for copy-and-paste.
1381    /// ## `setting`
1382    /// true to allow selecting text in the label
1383    #[doc(alias = "gtk_label_set_selectable")]
1384    #[doc(alias = "selectable")]
1385    pub fn set_selectable(&self, setting: bool) {
1386        unsafe {
1387            ffi::gtk_label_set_selectable(self.to_glib_none().0, setting.into_glib());
1388        }
1389    }
1390
1391    /// Sets whether the label is in single line mode.
1392    /// ## `single_line_mode`
1393    /// true to enable single line mode
1394    #[doc(alias = "gtk_label_set_single_line_mode")]
1395    #[doc(alias = "single-line-mode")]
1396    pub fn set_single_line_mode(&self, single_line_mode: bool) {
1397        unsafe {
1398            ffi::gtk_label_set_single_line_mode(
1399                self.to_glib_none().0,
1400                single_line_mode.into_glib(),
1401            );
1402        }
1403    }
1404
1405    /// Sets tab stops for the label.
1406    /// ## `tabs`
1407    /// tab stops
1408    #[cfg(feature = "v4_8")]
1409    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1410    #[doc(alias = "gtk_label_set_tabs")]
1411    #[doc(alias = "tabs")]
1412    pub fn set_tabs(&self, tabs: Option<&pango::TabArray>) {
1413        unsafe {
1414            ffi::gtk_label_set_tabs(self.to_glib_none().0, mut_override(tabs.to_glib_none().0));
1415        }
1416    }
1417
1418    /// Sets the text for the label.
1419    ///
1420    /// It overwrites any text that was there before and clears any
1421    /// previously set mnemonic accelerators, and sets the
1422    /// [`use-underline`][struct@crate::Label#use-underline] and
1423    /// [`use-markup`][struct@crate::Label#use-markup] properties to false.
1424    ///
1425    /// Also see [`set_markup()`][Self::set_markup()].
1426    /// ## `str`
1427    /// the text to show in @self
1428    #[doc(alias = "gtk_label_set_text")]
1429    pub fn set_text(&self, str: &str) {
1430        unsafe {
1431            ffi::gtk_label_set_text(self.to_glib_none().0, str.to_glib_none().0);
1432        }
1433    }
1434
1435    /// Sets the text for the label, with mnemonics.
1436    ///
1437    /// If characters in @str are preceded by an underscore, they are underlined
1438    /// indicating that they represent a keyboard accelerator called a mnemonic.
1439    /// The mnemonic key can be used to activate another widget, chosen
1440    /// automatically, or explicitly using [`set_mnemonic_widget()`][Self::set_mnemonic_widget()].
1441    /// ## `str`
1442    /// the text
1443    #[doc(alias = "gtk_label_set_text_with_mnemonic")]
1444    pub fn set_text_with_mnemonic(&self, str: &str) {
1445        unsafe {
1446            ffi::gtk_label_set_text_with_mnemonic(self.to_glib_none().0, str.to_glib_none().0);
1447        }
1448    }
1449
1450    /// Sets whether the text of the label contains markup.
1451    ///
1452    /// See [`set_markup()`][Self::set_markup()].
1453    /// ## `setting`
1454    /// true if the label’s text should be parsed for markup.
1455    #[doc(alias = "gtk_label_set_use_markup")]
1456    #[doc(alias = "use-markup")]
1457    pub fn set_use_markup(&self, setting: bool) {
1458        unsafe {
1459            ffi::gtk_label_set_use_markup(self.to_glib_none().0, setting.into_glib());
1460        }
1461    }
1462
1463    /// Sets whether underlines in the text indicate mnemonics.
1464    /// ## `setting`
1465    /// true if underlines in the text indicate mnemonics
1466    #[doc(alias = "gtk_label_set_use_underline")]
1467    #[doc(alias = "use-underline")]
1468    pub fn set_use_underline(&self, setting: bool) {
1469        unsafe {
1470            ffi::gtk_label_set_use_underline(self.to_glib_none().0, setting.into_glib());
1471        }
1472    }
1473
1474    /// Sets the desired width in characters of the label.
1475    /// ## `n_chars`
1476    /// the new desired width, in characters.
1477    #[doc(alias = "gtk_label_set_width_chars")]
1478    #[doc(alias = "width-chars")]
1479    pub fn set_width_chars(&self, n_chars: i32) {
1480        unsafe {
1481            ffi::gtk_label_set_width_chars(self.to_glib_none().0, n_chars);
1482        }
1483    }
1484
1485    /// Toggles line wrapping within the label.
1486    ///
1487    /// True makes it break lines if text exceeds the widget’s size.
1488    /// false lets the text get cut off by the edge of the widget if
1489    /// it exceeds the widget size.
1490    ///
1491    /// Note that setting line wrapping to true does not make the label
1492    /// wrap at its parent widget’s width, because GTK widgets conceptually
1493    /// can’t make their requisition depend on the parent  widget’s size.
1494    /// For a label that wraps at a specific position, set the label’s width
1495    /// using [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()].
1496    /// ## `wrap`
1497    /// whether to wrap lines
1498    #[doc(alias = "gtk_label_set_wrap")]
1499    #[doc(alias = "wrap")]
1500    pub fn set_wrap(&self, wrap: bool) {
1501        unsafe {
1502            ffi::gtk_label_set_wrap(self.to_glib_none().0, wrap.into_glib());
1503        }
1504    }
1505
1506    /// Controls how line wrapping is done.
1507    ///
1508    /// This only affects the label if line wrapping is on. (See
1509    /// [`set_wrap()`][Self::set_wrap()])
1510    ///
1511    /// The default is [enum@Pango.WrapMode.word], which means
1512    /// wrap on word boundaries.
1513    ///
1514    /// For sizing behavior, also consider the
1515    /// [`natural-wrap-mode`][struct@crate::Label#natural-wrap-mode] property.
1516    /// ## `wrap_mode`
1517    /// the line wrapping mode
1518    #[doc(alias = "gtk_label_set_wrap_mode")]
1519    #[doc(alias = "wrap-mode")]
1520    pub fn set_wrap_mode(&self, wrap_mode: pango::WrapMode) {
1521        unsafe {
1522            ffi::gtk_label_set_wrap_mode(self.to_glib_none().0, wrap_mode.into_glib());
1523        }
1524    }
1525
1526    /// Sets the `xalign` of the label.
1527    ///
1528    /// See the [`xalign`][struct@crate::Label#xalign] property.
1529    /// ## `xalign`
1530    /// the new xalign value, between 0 and 1
1531    #[doc(alias = "gtk_label_set_xalign")]
1532    #[doc(alias = "xalign")]
1533    pub fn set_xalign(&self, xalign: f32) {
1534        unsafe {
1535            ffi::gtk_label_set_xalign(self.to_glib_none().0, xalign);
1536        }
1537    }
1538
1539    /// Sets the `yalign` of the label.
1540    ///
1541    /// See the [`yalign`][struct@crate::Label#yalign] property.
1542    /// ## `yalign`
1543    /// the new yalign value, between 0 and 1
1544    #[doc(alias = "gtk_label_set_yalign")]
1545    #[doc(alias = "yalign")]
1546    pub fn set_yalign(&self, yalign: f32) {
1547        unsafe {
1548            ffi::gtk_label_set_yalign(self.to_glib_none().0, yalign);
1549        }
1550    }
1551
1552    ///  key.
1553    #[doc(alias = "activate-current-link")]
1554    pub fn connect_activate_current_link<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1555        unsafe extern "C" fn activate_current_link_trampoline<F: Fn(&Label) + 'static>(
1556            this: *mut ffi::GtkLabel,
1557            f: glib::ffi::gpointer,
1558        ) {
1559            unsafe {
1560                let f: &F = &*(f as *const F);
1561                f(&from_glib_borrow(this))
1562            }
1563        }
1564        unsafe {
1565            let f: Box_<F> = Box_::new(f);
1566            connect_raw(
1567                self.as_ptr() as *mut _,
1568                c"activate-current-link".as_ptr(),
1569                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1570                    activate_current_link_trampoline::<F> as *const (),
1571                )),
1572                Box_::into_raw(f),
1573            )
1574        }
1575    }
1576
1577    pub fn emit_activate_current_link(&self) {
1578        self.emit_by_name::<()>("activate-current-link", &[]);
1579    }
1580
1581    /// Gets emitted to activate a URI.
1582    ///
1583    /// Applications may connect to it to override the default behaviour,
1584    /// which is to call [`FileLauncher::launch()`][crate::FileLauncher::launch()].
1585    /// ## `uri`
1586    /// the URI that is activated
1587    ///
1588    /// # Returns
1589    ///
1590    /// true if the link has been activated
1591    #[doc(alias = "activate-link")]
1592    pub fn connect_activate_link<F: Fn(&Self, &str) -> glib::Propagation + 'static>(
1593        &self,
1594        f: F,
1595    ) -> SignalHandlerId {
1596        unsafe extern "C" fn activate_link_trampoline<
1597            F: Fn(&Label, &str) -> glib::Propagation + 'static,
1598        >(
1599            this: *mut ffi::GtkLabel,
1600            uri: *mut std::ffi::c_char,
1601            f: glib::ffi::gpointer,
1602        ) -> glib::ffi::gboolean {
1603            unsafe {
1604                let f: &F = &*(f as *const F);
1605                f(
1606                    &from_glib_borrow(this),
1607                    &glib::GString::from_glib_borrow(uri),
1608                )
1609                .into_glib()
1610            }
1611        }
1612        unsafe {
1613            let f: Box_<F> = Box_::new(f);
1614            connect_raw(
1615                self.as_ptr() as *mut _,
1616                c"activate-link".as_ptr(),
1617                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1618                    activate_link_trampoline::<F> as *const (),
1619                )),
1620                Box_::into_raw(f),
1621            )
1622        }
1623    }
1624
1625    /// .
1626    #[doc(alias = "copy-clipboard")]
1627    pub fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1628        unsafe extern "C" fn copy_clipboard_trampoline<F: Fn(&Label) + 'static>(
1629            this: *mut ffi::GtkLabel,
1630            f: glib::ffi::gpointer,
1631        ) {
1632            unsafe {
1633                let f: &F = &*(f as *const F);
1634                f(&from_glib_borrow(this))
1635            }
1636        }
1637        unsafe {
1638            let f: Box_<F> = Box_::new(f);
1639            connect_raw(
1640                self.as_ptr() as *mut _,
1641                c"copy-clipboard".as_ptr(),
1642                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1643                    copy_clipboard_trampoline::<F> as *const (),
1644                )),
1645                Box_::into_raw(f),
1646            )
1647        }
1648    }
1649
1650    pub fn emit_copy_clipboard(&self) {
1651        self.emit_by_name::<()>("copy-clipboard", &[]);
1652    }
1653
1654    ///  move to the ends of the buffer
1655    /// ## `step`
1656    /// the granularity of the move, as a [`MovementStep`][crate::MovementStep]
1657    /// ## `count`
1658    /// the number of @step units to move
1659    /// ## `extend_selection`
1660    /// true if the move should extend the selection
1661    #[doc(alias = "move-cursor")]
1662    pub fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
1663        &self,
1664        f: F,
1665    ) -> SignalHandlerId {
1666        unsafe extern "C" fn move_cursor_trampoline<
1667            F: Fn(&Label, MovementStep, i32, bool) + 'static,
1668        >(
1669            this: *mut ffi::GtkLabel,
1670            step: ffi::GtkMovementStep,
1671            count: std::ffi::c_int,
1672            extend_selection: glib::ffi::gboolean,
1673            f: glib::ffi::gpointer,
1674        ) {
1675            unsafe {
1676                let f: &F = &*(f as *const F);
1677                f(
1678                    &from_glib_borrow(this),
1679                    from_glib(step),
1680                    count,
1681                    from_glib(extend_selection),
1682                )
1683            }
1684        }
1685        unsafe {
1686            let f: Box_<F> = Box_::new(f);
1687            connect_raw(
1688                self.as_ptr() as *mut _,
1689                c"move-cursor".as_ptr(),
1690                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1691                    move_cursor_trampoline::<F> as *const (),
1692                )),
1693                Box_::into_raw(f),
1694            )
1695        }
1696    }
1697
1698    pub fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) {
1699        self.emit_by_name::<()>("move-cursor", &[&step, &count, &extend_selection]);
1700    }
1701
1702    #[doc(alias = "attributes")]
1703    pub fn connect_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1704        unsafe extern "C" fn notify_attributes_trampoline<F: Fn(&Label) + 'static>(
1705            this: *mut ffi::GtkLabel,
1706            _param_spec: glib::ffi::gpointer,
1707            f: glib::ffi::gpointer,
1708        ) {
1709            unsafe {
1710                let f: &F = &*(f as *const F);
1711                f(&from_glib_borrow(this))
1712            }
1713        }
1714        unsafe {
1715            let f: Box_<F> = Box_::new(f);
1716            connect_raw(
1717                self.as_ptr() as *mut _,
1718                c"notify::attributes".as_ptr(),
1719                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1720                    notify_attributes_trampoline::<F> as *const (),
1721                )),
1722                Box_::into_raw(f),
1723            )
1724        }
1725    }
1726
1727    #[doc(alias = "ellipsize")]
1728    pub fn connect_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1729        unsafe extern "C" fn notify_ellipsize_trampoline<F: Fn(&Label) + 'static>(
1730            this: *mut ffi::GtkLabel,
1731            _param_spec: glib::ffi::gpointer,
1732            f: glib::ffi::gpointer,
1733        ) {
1734            unsafe {
1735                let f: &F = &*(f as *const F);
1736                f(&from_glib_borrow(this))
1737            }
1738        }
1739        unsafe {
1740            let f: Box_<F> = Box_::new(f);
1741            connect_raw(
1742                self.as_ptr() as *mut _,
1743                c"notify::ellipsize".as_ptr(),
1744                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1745                    notify_ellipsize_trampoline::<F> as *const (),
1746                )),
1747                Box_::into_raw(f),
1748            )
1749        }
1750    }
1751
1752    #[doc(alias = "extra-menu")]
1753    pub fn connect_extra_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1754        unsafe extern "C" fn notify_extra_menu_trampoline<F: Fn(&Label) + 'static>(
1755            this: *mut ffi::GtkLabel,
1756            _param_spec: glib::ffi::gpointer,
1757            f: glib::ffi::gpointer,
1758        ) {
1759            unsafe {
1760                let f: &F = &*(f as *const F);
1761                f(&from_glib_borrow(this))
1762            }
1763        }
1764        unsafe {
1765            let f: Box_<F> = Box_::new(f);
1766            connect_raw(
1767                self.as_ptr() as *mut _,
1768                c"notify::extra-menu".as_ptr(),
1769                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1770                    notify_extra_menu_trampoline::<F> as *const (),
1771                )),
1772                Box_::into_raw(f),
1773            )
1774        }
1775    }
1776
1777    #[doc(alias = "justify")]
1778    pub fn connect_justify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1779        unsafe extern "C" fn notify_justify_trampoline<F: Fn(&Label) + 'static>(
1780            this: *mut ffi::GtkLabel,
1781            _param_spec: glib::ffi::gpointer,
1782            f: glib::ffi::gpointer,
1783        ) {
1784            unsafe {
1785                let f: &F = &*(f as *const F);
1786                f(&from_glib_borrow(this))
1787            }
1788        }
1789        unsafe {
1790            let f: Box_<F> = Box_::new(f);
1791            connect_raw(
1792                self.as_ptr() as *mut _,
1793                c"notify::justify".as_ptr(),
1794                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1795                    notify_justify_trampoline::<F> as *const (),
1796                )),
1797                Box_::into_raw(f),
1798            )
1799        }
1800    }
1801
1802    #[doc(alias = "label")]
1803    pub fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1804        unsafe extern "C" fn notify_label_trampoline<F: Fn(&Label) + 'static>(
1805            this: *mut ffi::GtkLabel,
1806            _param_spec: glib::ffi::gpointer,
1807            f: glib::ffi::gpointer,
1808        ) {
1809            unsafe {
1810                let f: &F = &*(f as *const F);
1811                f(&from_glib_borrow(this))
1812            }
1813        }
1814        unsafe {
1815            let f: Box_<F> = Box_::new(f);
1816            connect_raw(
1817                self.as_ptr() as *mut _,
1818                c"notify::label".as_ptr(),
1819                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1820                    notify_label_trampoline::<F> as *const (),
1821                )),
1822                Box_::into_raw(f),
1823            )
1824        }
1825    }
1826
1827    #[doc(alias = "lines")]
1828    pub fn connect_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1829        unsafe extern "C" fn notify_lines_trampoline<F: Fn(&Label) + 'static>(
1830            this: *mut ffi::GtkLabel,
1831            _param_spec: glib::ffi::gpointer,
1832            f: glib::ffi::gpointer,
1833        ) {
1834            unsafe {
1835                let f: &F = &*(f as *const F);
1836                f(&from_glib_borrow(this))
1837            }
1838        }
1839        unsafe {
1840            let f: Box_<F> = Box_::new(f);
1841            connect_raw(
1842                self.as_ptr() as *mut _,
1843                c"notify::lines".as_ptr(),
1844                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1845                    notify_lines_trampoline::<F> as *const (),
1846                )),
1847                Box_::into_raw(f),
1848            )
1849        }
1850    }
1851
1852    #[doc(alias = "max-width-chars")]
1853    pub fn connect_max_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1854        unsafe extern "C" fn notify_max_width_chars_trampoline<F: Fn(&Label) + 'static>(
1855            this: *mut ffi::GtkLabel,
1856            _param_spec: glib::ffi::gpointer,
1857            f: glib::ffi::gpointer,
1858        ) {
1859            unsafe {
1860                let f: &F = &*(f as *const F);
1861                f(&from_glib_borrow(this))
1862            }
1863        }
1864        unsafe {
1865            let f: Box_<F> = Box_::new(f);
1866            connect_raw(
1867                self.as_ptr() as *mut _,
1868                c"notify::max-width-chars".as_ptr(),
1869                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1870                    notify_max_width_chars_trampoline::<F> as *const (),
1871                )),
1872                Box_::into_raw(f),
1873            )
1874        }
1875    }
1876
1877    #[doc(alias = "mnemonic-keyval")]
1878    pub fn connect_mnemonic_keyval_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1879        unsafe extern "C" fn notify_mnemonic_keyval_trampoline<F: Fn(&Label) + 'static>(
1880            this: *mut ffi::GtkLabel,
1881            _param_spec: glib::ffi::gpointer,
1882            f: glib::ffi::gpointer,
1883        ) {
1884            unsafe {
1885                let f: &F = &*(f as *const F);
1886                f(&from_glib_borrow(this))
1887            }
1888        }
1889        unsafe {
1890            let f: Box_<F> = Box_::new(f);
1891            connect_raw(
1892                self.as_ptr() as *mut _,
1893                c"notify::mnemonic-keyval".as_ptr(),
1894                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1895                    notify_mnemonic_keyval_trampoline::<F> as *const (),
1896                )),
1897                Box_::into_raw(f),
1898            )
1899        }
1900    }
1901
1902    #[doc(alias = "mnemonic-widget")]
1903    pub fn connect_mnemonic_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1904        unsafe extern "C" fn notify_mnemonic_widget_trampoline<F: Fn(&Label) + 'static>(
1905            this: *mut ffi::GtkLabel,
1906            _param_spec: glib::ffi::gpointer,
1907            f: glib::ffi::gpointer,
1908        ) {
1909            unsafe {
1910                let f: &F = &*(f as *const F);
1911                f(&from_glib_borrow(this))
1912            }
1913        }
1914        unsafe {
1915            let f: Box_<F> = Box_::new(f);
1916            connect_raw(
1917                self.as_ptr() as *mut _,
1918                c"notify::mnemonic-widget".as_ptr(),
1919                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1920                    notify_mnemonic_widget_trampoline::<F> as *const (),
1921                )),
1922                Box_::into_raw(f),
1923            )
1924        }
1925    }
1926
1927    #[cfg(feature = "v4_6")]
1928    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1929    #[doc(alias = "natural-wrap-mode")]
1930    pub fn connect_natural_wrap_mode_notify<F: Fn(&Self) + 'static>(
1931        &self,
1932        f: F,
1933    ) -> SignalHandlerId {
1934        unsafe extern "C" fn notify_natural_wrap_mode_trampoline<F: Fn(&Label) + 'static>(
1935            this: *mut ffi::GtkLabel,
1936            _param_spec: glib::ffi::gpointer,
1937            f: glib::ffi::gpointer,
1938        ) {
1939            unsafe {
1940                let f: &F = &*(f as *const F);
1941                f(&from_glib_borrow(this))
1942            }
1943        }
1944        unsafe {
1945            let f: Box_<F> = Box_::new(f);
1946            connect_raw(
1947                self.as_ptr() as *mut _,
1948                c"notify::natural-wrap-mode".as_ptr(),
1949                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1950                    notify_natural_wrap_mode_trampoline::<F> as *const (),
1951                )),
1952                Box_::into_raw(f),
1953            )
1954        }
1955    }
1956
1957    #[doc(alias = "selectable")]
1958    pub fn connect_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1959        unsafe extern "C" fn notify_selectable_trampoline<F: Fn(&Label) + 'static>(
1960            this: *mut ffi::GtkLabel,
1961            _param_spec: glib::ffi::gpointer,
1962            f: glib::ffi::gpointer,
1963        ) {
1964            unsafe {
1965                let f: &F = &*(f as *const F);
1966                f(&from_glib_borrow(this))
1967            }
1968        }
1969        unsafe {
1970            let f: Box_<F> = Box_::new(f);
1971            connect_raw(
1972                self.as_ptr() as *mut _,
1973                c"notify::selectable".as_ptr(),
1974                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1975                    notify_selectable_trampoline::<F> as *const (),
1976                )),
1977                Box_::into_raw(f),
1978            )
1979        }
1980    }
1981
1982    #[doc(alias = "single-line-mode")]
1983    pub fn connect_single_line_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1984        unsafe extern "C" fn notify_single_line_mode_trampoline<F: Fn(&Label) + 'static>(
1985            this: *mut ffi::GtkLabel,
1986            _param_spec: glib::ffi::gpointer,
1987            f: glib::ffi::gpointer,
1988        ) {
1989            unsafe {
1990                let f: &F = &*(f as *const F);
1991                f(&from_glib_borrow(this))
1992            }
1993        }
1994        unsafe {
1995            let f: Box_<F> = Box_::new(f);
1996            connect_raw(
1997                self.as_ptr() as *mut _,
1998                c"notify::single-line-mode".as_ptr(),
1999                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2000                    notify_single_line_mode_trampoline::<F> as *const (),
2001                )),
2002                Box_::into_raw(f),
2003            )
2004        }
2005    }
2006
2007    #[cfg(feature = "v4_8")]
2008    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
2009    #[doc(alias = "tabs")]
2010    pub fn connect_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2011        unsafe extern "C" fn notify_tabs_trampoline<F: Fn(&Label) + 'static>(
2012            this: *mut ffi::GtkLabel,
2013            _param_spec: glib::ffi::gpointer,
2014            f: glib::ffi::gpointer,
2015        ) {
2016            unsafe {
2017                let f: &F = &*(f as *const F);
2018                f(&from_glib_borrow(this))
2019            }
2020        }
2021        unsafe {
2022            let f: Box_<F> = Box_::new(f);
2023            connect_raw(
2024                self.as_ptr() as *mut _,
2025                c"notify::tabs".as_ptr(),
2026                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2027                    notify_tabs_trampoline::<F> as *const (),
2028                )),
2029                Box_::into_raw(f),
2030            )
2031        }
2032    }
2033
2034    #[doc(alias = "use-markup")]
2035    pub fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2036        unsafe extern "C" fn notify_use_markup_trampoline<F: Fn(&Label) + 'static>(
2037            this: *mut ffi::GtkLabel,
2038            _param_spec: glib::ffi::gpointer,
2039            f: glib::ffi::gpointer,
2040        ) {
2041            unsafe {
2042                let f: &F = &*(f as *const F);
2043                f(&from_glib_borrow(this))
2044            }
2045        }
2046        unsafe {
2047            let f: Box_<F> = Box_::new(f);
2048            connect_raw(
2049                self.as_ptr() as *mut _,
2050                c"notify::use-markup".as_ptr(),
2051                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2052                    notify_use_markup_trampoline::<F> as *const (),
2053                )),
2054                Box_::into_raw(f),
2055            )
2056        }
2057    }
2058
2059    #[doc(alias = "use-underline")]
2060    pub fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2061        unsafe extern "C" fn notify_use_underline_trampoline<F: Fn(&Label) + 'static>(
2062            this: *mut ffi::GtkLabel,
2063            _param_spec: glib::ffi::gpointer,
2064            f: glib::ffi::gpointer,
2065        ) {
2066            unsafe {
2067                let f: &F = &*(f as *const F);
2068                f(&from_glib_borrow(this))
2069            }
2070        }
2071        unsafe {
2072            let f: Box_<F> = Box_::new(f);
2073            connect_raw(
2074                self.as_ptr() as *mut _,
2075                c"notify::use-underline".as_ptr(),
2076                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2077                    notify_use_underline_trampoline::<F> as *const (),
2078                )),
2079                Box_::into_raw(f),
2080            )
2081        }
2082    }
2083
2084    #[doc(alias = "width-chars")]
2085    pub fn connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2086        unsafe extern "C" fn notify_width_chars_trampoline<F: Fn(&Label) + 'static>(
2087            this: *mut ffi::GtkLabel,
2088            _param_spec: glib::ffi::gpointer,
2089            f: glib::ffi::gpointer,
2090        ) {
2091            unsafe {
2092                let f: &F = &*(f as *const F);
2093                f(&from_glib_borrow(this))
2094            }
2095        }
2096        unsafe {
2097            let f: Box_<F> = Box_::new(f);
2098            connect_raw(
2099                self.as_ptr() as *mut _,
2100                c"notify::width-chars".as_ptr(),
2101                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2102                    notify_width_chars_trampoline::<F> as *const (),
2103                )),
2104                Box_::into_raw(f),
2105            )
2106        }
2107    }
2108
2109    #[doc(alias = "wrap")]
2110    pub fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2111        unsafe extern "C" fn notify_wrap_trampoline<F: Fn(&Label) + 'static>(
2112            this: *mut ffi::GtkLabel,
2113            _param_spec: glib::ffi::gpointer,
2114            f: glib::ffi::gpointer,
2115        ) {
2116            unsafe {
2117                let f: &F = &*(f as *const F);
2118                f(&from_glib_borrow(this))
2119            }
2120        }
2121        unsafe {
2122            let f: Box_<F> = Box_::new(f);
2123            connect_raw(
2124                self.as_ptr() as *mut _,
2125                c"notify::wrap".as_ptr(),
2126                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2127                    notify_wrap_trampoline::<F> as *const (),
2128                )),
2129                Box_::into_raw(f),
2130            )
2131        }
2132    }
2133
2134    #[doc(alias = "wrap-mode")]
2135    pub fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2136        unsafe extern "C" fn notify_wrap_mode_trampoline<F: Fn(&Label) + 'static>(
2137            this: *mut ffi::GtkLabel,
2138            _param_spec: glib::ffi::gpointer,
2139            f: glib::ffi::gpointer,
2140        ) {
2141            unsafe {
2142                let f: &F = &*(f as *const F);
2143                f(&from_glib_borrow(this))
2144            }
2145        }
2146        unsafe {
2147            let f: Box_<F> = Box_::new(f);
2148            connect_raw(
2149                self.as_ptr() as *mut _,
2150                c"notify::wrap-mode".as_ptr(),
2151                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2152                    notify_wrap_mode_trampoline::<F> as *const (),
2153                )),
2154                Box_::into_raw(f),
2155            )
2156        }
2157    }
2158
2159    #[doc(alias = "xalign")]
2160    pub fn connect_xalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2161        unsafe extern "C" fn notify_xalign_trampoline<F: Fn(&Label) + 'static>(
2162            this: *mut ffi::GtkLabel,
2163            _param_spec: glib::ffi::gpointer,
2164            f: glib::ffi::gpointer,
2165        ) {
2166            unsafe {
2167                let f: &F = &*(f as *const F);
2168                f(&from_glib_borrow(this))
2169            }
2170        }
2171        unsafe {
2172            let f: Box_<F> = Box_::new(f);
2173            connect_raw(
2174                self.as_ptr() as *mut _,
2175                c"notify::xalign".as_ptr(),
2176                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2177                    notify_xalign_trampoline::<F> as *const (),
2178                )),
2179                Box_::into_raw(f),
2180            )
2181        }
2182    }
2183
2184    #[doc(alias = "yalign")]
2185    pub fn connect_yalign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2186        unsafe extern "C" fn notify_yalign_trampoline<F: Fn(&Label) + 'static>(
2187            this: *mut ffi::GtkLabel,
2188            _param_spec: glib::ffi::gpointer,
2189            f: glib::ffi::gpointer,
2190        ) {
2191            unsafe {
2192                let f: &F = &*(f as *const F);
2193                f(&from_glib_borrow(this))
2194            }
2195        }
2196        unsafe {
2197            let f: Box_<F> = Box_::new(f);
2198            connect_raw(
2199                self.as_ptr() as *mut _,
2200                c"notify::yalign".as_ptr(),
2201                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2202                    notify_yalign_trampoline::<F> as *const (),
2203                )),
2204                Box_::into_raw(f),
2205            )
2206        }
2207    }
2208}
2209
2210impl Default for Label {
2211    fn default() -> Self {
2212        glib::object::Object::new::<Self>()
2213    }
2214}
2215
2216// rustdoc-stripper-ignore-next
2217/// A [builder-pattern] type to construct [`Label`] objects.
2218///
2219/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
2220#[must_use = "The builder must be built to be used"]
2221pub struct LabelBuilder {
2222    builder: glib::object::ObjectBuilder<'static, Label>,
2223}
2224
2225impl LabelBuilder {
2226    fn new() -> Self {
2227        Self {
2228            builder: glib::object::Object::builder(),
2229        }
2230    }
2231
2232    /// A list of style attributes to apply to the text of the label.
2233    pub fn attributes(self, attributes: &pango::AttrList) -> Self {
2234        Self {
2235            builder: self.builder.property("attributes", attributes.clone()),
2236        }
2237    }
2238
2239    /// The preferred place to ellipsize the string, if the label does
2240    /// not have enough room to display the entire string.
2241    ///
2242    /// Note that setting this property to a value other than
2243    /// [enum.Pango.EllipsizeMode.none] has the side-effect that the label requests
2244    /// only enough space to display the ellipsis "...". In particular, this
2245    /// means that ellipsizing labels do not work well in notebook tabs, unless
2246    /// the [`tab-expand`][struct@crate::NotebookPage#tab-expand] child property is set to true.
2247    ///
2248    /// Other ways to set a label's width are [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()]
2249    /// and [`Label::set_width_chars()`][crate::Label::set_width_chars()].
2250    pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
2251        Self {
2252            builder: self.builder.property("ellipsize", ellipsize),
2253        }
2254    }
2255
2256    /// A menu model whose contents will be appended to the context menu.
2257    pub fn extra_menu(self, extra_menu: &impl IsA<gio::MenuModel>) -> Self {
2258        Self {
2259            builder: self
2260                .builder
2261                .property("extra-menu", extra_menu.clone().upcast()),
2262        }
2263    }
2264
2265    /// The alignment of the lines in the text of the label, relative to each other.
2266    ///
2267    /// This does *not* affect the alignment of the label within its allocation.
2268    /// See [`xalign`][struct@crate::Label#xalign] for that.
2269    pub fn justify(self, justify: Justification) -> Self {
2270        Self {
2271            builder: self.builder.property("justify", justify),
2272        }
2273    }
2274
2275    /// The contents of the label.
2276    ///
2277    /// If the string contains Pango markup (see `parse_markup()`),
2278    /// you will have to set the [`use-markup`][struct@crate::Label#use-markup] property to
2279    /// true in order for the label to display the markup attributes. See also
2280    /// [`Label::set_markup()`][crate::Label::set_markup()] for a convenience function that sets both
2281    /// this property and the [`use-markup`][struct@crate::Label#use-markup] property at the
2282    /// same time.
2283    ///
2284    /// If the string contains underlines acting as mnemonics, you will have to
2285    /// set the [`use-underline`][struct@crate::Label#use-underline] property to true in order
2286    /// for the label to display them.
2287    pub fn label(self, label: impl Into<glib::GString>) -> Self {
2288        Self {
2289            builder: self.builder.property("label", label.into()),
2290        }
2291    }
2292
2293    /// The number of lines to which an ellipsized, wrapping label
2294    /// should display before it gets ellipsized. This both prevents the label
2295    /// from ellipsizing before this many lines are displayed, and limits the
2296    /// height request of the label to this many lines.
2297    ///
2298    /// ::: warning
2299    ///     Setting this property has unintuitive and unfortunate consequences
2300    ///     for the minimum _width_ of the label. Specifically, if the height
2301    ///     of the label is such that it fits a smaller number of lines than
2302    ///     the value of this property, the label can not be ellipsized at all,
2303    ///     which means it must be wide enough to fit all the text fully.
2304    ///
2305    /// This property has no effect if the label is not wrapping or ellipsized.
2306    ///
2307    /// Set this property to -1 if you don't want to limit the number of lines.
2308    pub fn lines(self, lines: i32) -> Self {
2309        Self {
2310            builder: self.builder.property("lines", lines),
2311        }
2312    }
2313
2314    /// The desired maximum width of the label, in characters.
2315    ///
2316    /// If this property is set to -1, the width will be calculated automatically.
2317    ///
2318    /// See the section on [text layout](class.Label.html#text-layout) for details
2319    /// of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
2320    /// determine the width of ellipsized and wrapped labels.
2321    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
2322        Self {
2323            builder: self.builder.property("max-width-chars", max_width_chars),
2324        }
2325    }
2326
2327    /// The widget to be activated when the labels mnemonic key is pressed.
2328    pub fn mnemonic_widget(self, mnemonic_widget: &impl IsA<Widget>) -> Self {
2329        Self {
2330            builder: self
2331                .builder
2332                .property("mnemonic-widget", mnemonic_widget.clone().upcast()),
2333        }
2334    }
2335
2336    /// Select the line wrapping for the natural size request.
2337    ///
2338    /// This only affects the natural size requested. For the actual wrapping
2339    /// used, see the [`wrap-mode`][struct@crate::Label#wrap-mode] property.
2340    ///
2341    /// The default is [enum@Gtk.NaturalWrapMode.inherit], which inherits
2342    /// the behavior of the [`wrap-mode`][struct@crate::Label#wrap-mode] property.
2343    #[cfg(feature = "v4_6")]
2344    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
2345    pub fn natural_wrap_mode(self, natural_wrap_mode: NaturalWrapMode) -> Self {
2346        Self {
2347            builder: self
2348                .builder
2349                .property("natural-wrap-mode", natural_wrap_mode),
2350        }
2351    }
2352
2353    /// Whether the label text can be selected with the mouse.
2354    pub fn selectable(self, selectable: bool) -> Self {
2355        Self {
2356            builder: self.builder.property("selectable", selectable),
2357        }
2358    }
2359
2360    /// Whether the label is in single line mode.
2361    ///
2362    /// In single line mode, the height of the label does not depend on the
2363    /// actual text, it is always set to ascent + descent of the font. This
2364    /// can be an advantage in situations where resizing the label because
2365    /// of text changes would be distracting, e.g. in a statusbar.
2366    pub fn single_line_mode(self, single_line_mode: bool) -> Self {
2367        Self {
2368            builder: self.builder.property("single-line-mode", single_line_mode),
2369        }
2370    }
2371
2372    /// Custom tabs for this label.
2373    #[cfg(feature = "v4_8")]
2374    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
2375    pub fn tabs(self, tabs: &pango::TabArray) -> Self {
2376        Self {
2377            builder: self.builder.property("tabs", tabs),
2378        }
2379    }
2380
2381    /// True if the text of the label includes Pango markup.
2382    ///
2383    /// See `parse_markup()`.
2384    pub fn use_markup(self, use_markup: bool) -> Self {
2385        Self {
2386            builder: self.builder.property("use-markup", use_markup),
2387        }
2388    }
2389
2390    /// True if the text of the label indicates a mnemonic with an `_`
2391    /// before the mnemonic character.
2392    pub fn use_underline(self, use_underline: bool) -> Self {
2393        Self {
2394            builder: self.builder.property("use-underline", use_underline),
2395        }
2396    }
2397
2398    /// The desired width of the label, in characters.
2399    ///
2400    /// If this property is set to -1, the width will be calculated automatically.
2401    ///
2402    /// See the section on [text layout](class.Label.html#text-layout) for details
2403    /// of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
2404    /// determine the width of ellipsized and wrapped labels.
2405    pub fn width_chars(self, width_chars: i32) -> Self {
2406        Self {
2407            builder: self.builder.property("width-chars", width_chars),
2408        }
2409    }
2410
2411    /// True if the label text will wrap if it gets too wide.
2412    pub fn wrap(self, wrap: bool) -> Self {
2413        Self {
2414            builder: self.builder.property("wrap", wrap),
2415        }
2416    }
2417
2418    /// Controls how the line wrapping is done.
2419    ///
2420    /// This only affects the formatting if line wrapping is on (see the
2421    /// [`wrap`][struct@crate::Label#wrap] property). The default is [enum@Pango.WrapMode.word],
2422    /// which means wrap on word boundaries.
2423    ///
2424    /// For sizing behavior, also consider the [`natural-wrap-mode`][struct@crate::Label#natural-wrap-mode]
2425    /// property.
2426    pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
2427        Self {
2428            builder: self.builder.property("wrap-mode", wrap_mode),
2429        }
2430    }
2431
2432    /// The horizontal alignment of the label text inside its size allocation.
2433    ///
2434    /// Compare this to [`halign`][struct@crate::Widget#halign], which determines how the
2435    /// labels size allocation is positioned in the space available for the label.
2436    pub fn xalign(self, xalign: f32) -> Self {
2437        Self {
2438            builder: self.builder.property("xalign", xalign),
2439        }
2440    }
2441
2442    /// The vertical alignment of the label text inside its size allocation.
2443    ///
2444    /// Compare this to [`valign`][struct@crate::Widget#valign], which determines how the
2445    /// labels size allocation is positioned in the space available for the label.
2446    pub fn yalign(self, yalign: f32) -> Self {
2447        Self {
2448            builder: self.builder.property("yalign", yalign),
2449        }
2450    }
2451
2452    /// Whether the widget or any of its descendents can accept
2453    /// the input focus.
2454    ///
2455    /// This property is meant to be set by widget implementations,
2456    /// typically in their instance init function.
2457    pub fn can_focus(self, can_focus: bool) -> Self {
2458        Self {
2459            builder: self.builder.property("can-focus", can_focus),
2460        }
2461    }
2462
2463    /// Whether the widget can receive pointer events.
2464    pub fn can_target(self, can_target: bool) -> Self {
2465        Self {
2466            builder: self.builder.property("can-target", can_target),
2467        }
2468    }
2469
2470    /// A list of css classes applied to this widget.
2471    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
2472        Self {
2473            builder: self.builder.property("css-classes", css_classes.into()),
2474        }
2475    }
2476
2477    /// The name of this widget in the CSS tree.
2478    ///
2479    /// This property is meant to be set by widget implementations,
2480    /// typically in their instance init function.
2481    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
2482        Self {
2483            builder: self.builder.property("css-name", css_name.into()),
2484        }
2485    }
2486
2487    /// The cursor used by @widget.
2488    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
2489        Self {
2490            builder: self.builder.property("cursor", cursor.clone()),
2491        }
2492    }
2493
2494    /// Whether the widget should grab focus when it is clicked with the mouse.
2495    ///
2496    /// This property is only relevant for widgets that can take focus.
2497    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
2498        Self {
2499            builder: self.builder.property("focus-on-click", focus_on_click),
2500        }
2501    }
2502
2503    /// Whether this widget itself will accept the input focus.
2504    pub fn focusable(self, focusable: bool) -> Self {
2505        Self {
2506            builder: self.builder.property("focusable", focusable),
2507        }
2508    }
2509
2510    /// How to distribute horizontal space if widget gets extra space.
2511    pub fn halign(self, halign: Align) -> Self {
2512        Self {
2513            builder: self.builder.property("halign", halign),
2514        }
2515    }
2516
2517    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
2518    /// signal on @widget.
2519    ///
2520    /// A true value indicates that @widget can have a tooltip, in this case
2521    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
2522    /// determine whether it will provide a tooltip or not.
2523    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
2524        Self {
2525            builder: self.builder.property("has-tooltip", has_tooltip),
2526        }
2527    }
2528
2529    /// Overrides for height request of the widget.
2530    ///
2531    /// If this is -1, the natural request will be used.
2532    pub fn height_request(self, height_request: i32) -> Self {
2533        Self {
2534            builder: self.builder.property("height-request", height_request),
2535        }
2536    }
2537
2538    /// Whether to expand horizontally.
2539    pub fn hexpand(self, hexpand: bool) -> Self {
2540        Self {
2541            builder: self.builder.property("hexpand", hexpand),
2542        }
2543    }
2544
2545    /// Whether to use the `hexpand` property.
2546    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
2547        Self {
2548            builder: self.builder.property("hexpand-set", hexpand_set),
2549        }
2550    }
2551
2552    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
2553    /// the preferred size of the widget, and allocate its children.
2554    ///
2555    /// This property is meant to be set by widget implementations,
2556    /// typically in their instance init function.
2557    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
2558        Self {
2559            builder: self
2560                .builder
2561                .property("layout-manager", layout_manager.clone().upcast()),
2562        }
2563    }
2564
2565    /// Makes this widget act like a modal dialog, with respect to
2566    /// event delivery.
2567    ///
2568    /// Global event controllers will not handle events with targets
2569    /// inside the widget, unless they are set up to ignore propagation
2570    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
2571    #[cfg(feature = "v4_18")]
2572    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
2573    pub fn limit_events(self, limit_events: bool) -> Self {
2574        Self {
2575            builder: self.builder.property("limit-events", limit_events),
2576        }
2577    }
2578
2579    /// Margin on bottom side of widget.
2580    ///
2581    /// This property adds margin outside of the widget's normal size
2582    /// request, the margin will be added in addition to the size from
2583    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2584    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
2585        Self {
2586            builder: self.builder.property("margin-bottom", margin_bottom),
2587        }
2588    }
2589
2590    /// Margin on end of widget, horizontally.
2591    ///
2592    /// This property supports left-to-right and right-to-left text
2593    /// directions.
2594    ///
2595    /// This property adds margin outside of the widget's normal size
2596    /// request, the margin will be added in addition to the size from
2597    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2598    pub fn margin_end(self, margin_end: i32) -> Self {
2599        Self {
2600            builder: self.builder.property("margin-end", margin_end),
2601        }
2602    }
2603
2604    /// Margin on start of widget, horizontally.
2605    ///
2606    /// This property supports left-to-right and right-to-left text
2607    /// directions.
2608    ///
2609    /// This property adds margin outside of the widget's normal size
2610    /// request, the margin will be added in addition to the size from
2611    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2612    pub fn margin_start(self, margin_start: i32) -> Self {
2613        Self {
2614            builder: self.builder.property("margin-start", margin_start),
2615        }
2616    }
2617
2618    /// Margin on top side of widget.
2619    ///
2620    /// This property adds margin outside of the widget's normal size
2621    /// request, the margin will be added in addition to the size from
2622    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2623    pub fn margin_top(self, margin_top: i32) -> Self {
2624        Self {
2625            builder: self.builder.property("margin-top", margin_top),
2626        }
2627    }
2628
2629    /// The name of the widget.
2630    pub fn name(self, name: impl Into<glib::GString>) -> Self {
2631        Self {
2632            builder: self.builder.property("name", name.into()),
2633        }
2634    }
2635
2636    /// The requested opacity of the widget.
2637    pub fn opacity(self, opacity: f64) -> Self {
2638        Self {
2639            builder: self.builder.property("opacity", opacity),
2640        }
2641    }
2642
2643    /// How content outside the widget's content area is treated.
2644    ///
2645    /// This property is meant to be set by widget implementations,
2646    /// typically in their instance init function.
2647    pub fn overflow(self, overflow: Overflow) -> Self {
2648        Self {
2649            builder: self.builder.property("overflow", overflow),
2650        }
2651    }
2652
2653    /// Whether the widget will receive the default action when it is focused.
2654    pub fn receives_default(self, receives_default: bool) -> Self {
2655        Self {
2656            builder: self.builder.property("receives-default", receives_default),
2657        }
2658    }
2659
2660    /// Whether the widget responds to input.
2661    pub fn sensitive(self, sensitive: bool) -> Self {
2662        Self {
2663            builder: self.builder.property("sensitive", sensitive),
2664        }
2665    }
2666
2667    /// Sets the text of tooltip to be the given string, which is marked up
2668    /// with Pango markup.
2669    ///
2670    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
2671    ///
2672    /// This is a convenience property which will take care of getting the
2673    /// tooltip shown if the given string is not `NULL`:
2674    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2675    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2676    /// the default signal handler.
2677    ///
2678    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2679    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2680    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2681        Self {
2682            builder: self
2683                .builder
2684                .property("tooltip-markup", tooltip_markup.into()),
2685        }
2686    }
2687
2688    /// Sets the text of tooltip to be the given string.
2689    ///
2690    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2691    ///
2692    /// This is a convenience property which will take care of getting the
2693    /// tooltip shown if the given string is not `NULL`:
2694    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2695    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2696    /// the default signal handler.
2697    ///
2698    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2699    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2700    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2701        Self {
2702            builder: self.builder.property("tooltip-text", tooltip_text.into()),
2703        }
2704    }
2705
2706    /// How to distribute vertical space if widget gets extra space.
2707    pub fn valign(self, valign: Align) -> Self {
2708        Self {
2709            builder: self.builder.property("valign", valign),
2710        }
2711    }
2712
2713    /// Whether to expand vertically.
2714    pub fn vexpand(self, vexpand: bool) -> Self {
2715        Self {
2716            builder: self.builder.property("vexpand", vexpand),
2717        }
2718    }
2719
2720    /// Whether to use the `vexpand` property.
2721    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2722        Self {
2723            builder: self.builder.property("vexpand-set", vexpand_set),
2724        }
2725    }
2726
2727    /// Whether the widget is visible.
2728    pub fn visible(self, visible: bool) -> Self {
2729        Self {
2730            builder: self.builder.property("visible", visible),
2731        }
2732    }
2733
2734    /// Overrides for width request of the widget.
2735    ///
2736    /// If this is -1, the natural request will be used.
2737    pub fn width_request(self, width_request: i32) -> Self {
2738        Self {
2739            builder: self.builder.property("width-request", width_request),
2740        }
2741    }
2742
2743    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
2744    ///
2745    /// The accessible role cannot be changed once set.
2746    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
2747        Self {
2748            builder: self.builder.property("accessible-role", accessible_role),
2749        }
2750    }
2751
2752    // rustdoc-stripper-ignore-next
2753    /// Build the [`Label`].
2754    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2755    pub fn build(self) -> Label {
2756        assert_initialized_main_thread!();
2757        self.builder.build()
2758    }
2759}