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