gtk/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
5use crate::{Align, Buildable, Container, Justification, Menu, Misc, MovementStep, Widget};
6use glib::{
7 prelude::*,
8 signal::{connect_raw, SignalHandlerId},
9 translate::*,
10};
11use std::{boxed::Box as Box_, fmt, mem, mem::transmute};
12
13glib::wrapper! {
14 /// The [`Label`][crate::Label] widget displays a small amount of text. As the name
15 /// implies, most labels are used to label another widget such as a
16 /// [`Button`][crate::Button], a [`MenuItem`][crate::MenuItem], or a [`ComboBox`][crate::ComboBox].
17 ///
18 /// # CSS nodes
19 ///
20 ///
21 ///
22 /// **⚠️ The following code is in plain ⚠️**
23 ///
24 /// ```plain
25 /// label
26 /// ├── [selection]
27 /// ├── [link]
28 /// ┊
29 /// ╰── [link]
30 /// ```
31 ///
32 /// GtkLabel has a single CSS node with the name label. A wide variety
33 /// of style classes may be applied to labels, such as .title, .subtitle,
34 /// .dim-label, etc. In the [`ShortcutsWindow`][crate::ShortcutsWindow], labels are used wth the
35 /// .keycap style class.
36 ///
37 /// If the label has a selection, it gets a subnode with name selection.
38 ///
39 /// If the label has links, there is one subnode per link. These subnodes
40 /// carry the link or visited state depending on whether they have been
41 /// visited.
42 ///
43 /// # GtkLabel as GtkBuildable
44 ///
45 /// The GtkLabel implementation of the GtkBuildable interface supports a
46 /// custom ``<attributes>`` element, which supports any number of ``<attribute>``
47 /// elements. The ``<attribute>`` element has attributes named “name“, “value“,
48 /// “start“ and “end“ and allows you to specify `PangoAttribute` values for
49 /// this label.
50 ///
51 /// An example of a UI definition fragment specifying Pango attributes:
52 ///
53 ///
54 ///
55 /// **⚠️ The following code is in xml ⚠️**
56 ///
57 /// ```xml
58 /// <object class="GtkLabel">
59 /// <attributes>
60 /// <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
61 /// <attribute name="background" value="red" start="5" end="10"/>
62 /// </attributes>
63 /// </object>
64 /// ```
65 ///
66 /// The start and end attributes specify the range of characters to which the
67 /// Pango attribute applies. If start and end are not specified, the attribute is
68 /// applied to the whole text. Note that specifying ranges does not make much
69 /// sense with translatable attributes. Use markup embedded in the translatable
70 /// content instead.
71 ///
72 /// # Mnemonics
73 ///
74 /// Labels may contain “mnemonics”. Mnemonics are
75 /// underlined characters in the label, used for keyboard navigation.
76 /// Mnemonics are created by providing a string with an underscore before
77 /// the mnemonic character, such as `"_File"`, to the
78 /// functions [`with_mnemonic()`][Self::with_mnemonic()] or
79 /// [`LabelExt::set_text_with_mnemonic()`][crate::prelude::LabelExt::set_text_with_mnemonic()].
80 ///
81 /// Mnemonics automatically activate any activatable widget the label is
82 /// inside, such as a [`Button`][crate::Button]; if the label is not inside the
83 /// mnemonic’s target widget, you have to tell the label about the target
84 /// using [`LabelExt::set_mnemonic_widget()`][crate::prelude::LabelExt::set_mnemonic_widget()]. Here’s a simple example where
85 /// the label is inside a button:
86 ///
87 ///
88 ///
89 /// **⚠️ The following code is in C ⚠️**
90 ///
91 /// ```C
92 /// // Pressing Alt+H will activate this button
93 /// GtkWidget *button = gtk_button_new ();
94 /// GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello");
95 /// gtk_container_add (GTK_CONTAINER (button), label);
96 /// ```
97 ///
98 /// There’s a convenience function to create buttons with a mnemonic label
99 /// already inside:
100 ///
101 ///
102 ///
103 /// **⚠️ The following code is in C ⚠️**
104 ///
105 /// ```C
106 /// // Pressing Alt+H will activate this button
107 /// GtkWidget *button = gtk_button_new_with_mnemonic ("_Hello");
108 /// ```
109 ///
110 /// To create a mnemonic for a widget alongside the label, such as a
111 /// [`Entry`][crate::Entry], you have to point the label at the entry with
112 /// [`LabelExt::set_mnemonic_widget()`][crate::prelude::LabelExt::set_mnemonic_widget()]:
113 ///
114 ///
115 ///
116 /// **⚠️ The following code is in C ⚠️**
117 ///
118 /// ```C
119 /// // Pressing Alt+H will focus the entry
120 /// GtkWidget *entry = gtk_entry_new ();
121 /// GtkWidget *label = gtk_label_new_with_mnemonic ("_Hello");
122 /// gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
123 /// ```
124 ///
125 /// # Markup (styled text)
126 ///
127 /// To make it easy to format text in a label (changing colors,
128 /// fonts, etc.), label text can be provided in a simple
129 /// [markup format][PangoMarkupFormat].
130 ///
131 /// Here’s how to create a label with a small font:
132 ///
133 ///
134 /// **⚠️ The following code is in C ⚠️**
135 ///
136 /// ```C
137 /// GtkWidget *label = gtk_label_new (NULL);
138 /// gtk_label_set_markup (GTK_LABEL (label), "<small>Small text</small>");
139 /// ```
140 ///
141 /// (See [complete documentation][PangoMarkupFormat] of available
142 /// tags in the Pango manual.)
143 ///
144 /// The markup passed to [`LabelExt::set_markup()`][crate::prelude::LabelExt::set_markup()] must be valid; for example,
145 /// literal <, > and & characters must be escaped as <, >, and &.
146 /// If you pass text obtained from the user, file, or a network to
147 /// [`LabelExt::set_markup()`][crate::prelude::LabelExt::set_markup()], you’ll want to escape it with
148 /// `g_markup_escape_text()` or `g_markup_printf_escaped()`.
149 ///
150 /// Markup strings are just a convenient way to set the [`pango::AttrList`][crate::pango::AttrList] on
151 /// a label; [`LabelExt::set_attributes()`][crate::prelude::LabelExt::set_attributes()] may be a simpler way to set
152 /// attributes in some cases. Be careful though; [`pango::AttrList`][crate::pango::AttrList] tends to
153 /// cause internationalization problems, unless you’re applying attributes
154 /// to the entire string (i.e. unless you set the range of each attribute
155 /// to [0, `G_MAXINT`)). The reason is that specifying the start_index and
156 /// end_index for a `PangoAttribute` requires knowledge of the exact string
157 /// being displayed, so translations will cause problems.
158 ///
159 /// # Selectable labels
160 ///
161 /// Labels can be made selectable with [`LabelExt::set_selectable()`][crate::prelude::LabelExt::set_selectable()].
162 /// Selectable labels allow the user to copy the label contents to
163 /// the clipboard. Only labels that contain useful-to-copy information
164 /// — such as error messages — should be made selectable.
165 ///
166 /// # Text layout # {`label`-text-layout}
167 ///
168 /// A label can contain any number of paragraphs, but will have
169 /// performance problems if it contains more than a small number.
170 /// Paragraphs are separated by newlines or other paragraph separators
171 /// understood by Pango.
172 ///
173 /// Labels can automatically wrap text if you call
174 /// [`LabelExt::set_line_wrap()`][crate::prelude::LabelExt::set_line_wrap()].
175 ///
176 /// [`LabelExt::set_justify()`][crate::prelude::LabelExt::set_justify()] sets how the lines in a label align
177 /// with one another. If you want to set how the label as a whole
178 /// aligns in its available space, see the [`halign`][struct@crate::Widget#halign] and
179 /// [`valign`][struct@crate::Widget#valign] properties.
180 ///
181 /// The [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars] properties
182 /// can be used to control the size allocation of ellipsized or wrapped
183 /// labels. For ellipsizing labels, if either is specified (and less
184 /// than the actual text size), it is used as the minimum width, and the actual
185 /// text size is used as the natural width of the label. For wrapping labels,
186 /// width-chars is used as the minimum width, if specified, and max-width-chars
187 /// is used as the natural width. Even if max-width-chars specified, wrapping
188 /// labels will be rewrapped to use all of the available width.
189 ///
190 /// Note that the interpretation of [`width-chars`][struct@crate::Label#width-chars] and
191 /// [`max-width-chars`][struct@crate::Label#max-width-chars] has changed a bit with the introduction of
192 /// [width-for-height geometry management.][geometry-management]
193 ///
194 /// # Links
195 ///
196 /// Since 2.18, GTK+ supports markup for clickable hyperlinks in addition
197 /// to regular Pango markup. The markup for links is borrowed from HTML,
198 /// using the ``<a>`` with “href“ and “title“ attributes. GTK+ renders links
199 /// similar to the way they appear in web browsers, with colored, underlined
200 /// text. The “title“ attribute is displayed as a tooltip on the link.
201 ///
202 /// An example looks like this:
203 ///
204 ///
205 ///
206 /// **⚠️ The following code is in C ⚠️**
207 ///
208 /// ```C
209 /// const gchar *text =
210 /// "Go to the"
211 /// "<a href=\"http://www.gtk.org title=\"<i>Our</i> website\">"
212 /// "GTK+ website</a> for more...";
213 /// GtkWidget *label = gtk_label_new (NULL);
214 /// gtk_label_set_markup (GTK_LABEL (label), text);
215 /// ```
216 ///
217 /// It is possible to implement custom handling for links and their tooltips with
218 /// the [`activate-link`][struct@crate::Label#activate-link] signal and the [`LabelExt::current_uri()`][crate::prelude::LabelExt::current_uri()] function.
219 ///
220 /// ## Properties
221 ///
222 ///
223 /// #### `angle`
224 /// The angle that the baseline of the label makes with the horizontal,
225 /// in degrees, measured counterclockwise. An angle of 90 reads from
226 /// from bottom to top, an angle of 270, from top to bottom. Ignored
227 /// if the label is selectable.
228 ///
229 /// Readable | Writeable
230 ///
231 ///
232 /// #### `attributes`
233 /// Readable | Writeable
234 ///
235 ///
236 /// #### `cursor-position`
237 /// Readable
238 ///
239 ///
240 /// #### `ellipsize`
241 /// The preferred place to ellipsize the string, if the label does
242 /// not have enough room to display the entire string, specified as a
243 /// [`pango::EllipsizeMode`][crate::pango::EllipsizeMode].
244 ///
245 /// Note that setting this property to a value other than
246 /// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] has the side-effect that the label requests
247 /// only enough space to display the ellipsis "...". In particular, this
248 /// means that ellipsizing labels do not work well in notebook tabs, unless
249 /// the [`Notebook`][crate::Notebook] tab-expand child property is set to [`true`]. Other ways
250 /// to set a label's width are [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] and
251 /// [`LabelExt::set_width_chars()`][crate::prelude::LabelExt::set_width_chars()].
252 ///
253 /// Readable | Writeable
254 ///
255 ///
256 /// #### `justify`
257 /// Readable | Writeable
258 ///
259 ///
260 /// #### `label`
261 /// The contents of the label.
262 ///
263 /// If the string contains [Pango XML markup][PangoMarkupFormat], you will
264 /// have to set the [`use-markup`][struct@crate::Label#use-markup] property to [`true`] in order for the
265 /// label to display the markup attributes. See also [`LabelExt::set_markup()`][crate::prelude::LabelExt::set_markup()]
266 /// for a convenience function that sets both this property and the
267 /// [`use-markup`][struct@crate::Label#use-markup] property at the same time.
268 ///
269 /// If the string contains underlines acting as mnemonics, you will have to
270 /// set the [`use-underline`][struct@crate::Label#use-underline] property to [`true`] in order for the label
271 /// to display them.
272 ///
273 /// Readable | Writeable
274 ///
275 ///
276 /// #### `lines`
277 /// The number of lines to which an ellipsized, wrapping label
278 /// should be limited. This property has no effect if the
279 /// label is not wrapping or ellipsized. Set this property to
280 /// -1 if you don't want to limit the number of lines.
281 ///
282 /// Readable | Writeable
283 ///
284 ///
285 /// #### `max-width-chars`
286 /// The desired maximum width of the label, in characters. If this property
287 /// is set to -1, the width will be calculated automatically.
288 ///
289 /// See the section on [text layout][label-text-layout]
290 /// for details of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
291 /// determine the width of ellipsized and wrapped labels.
292 ///
293 /// Readable | Writeable
294 ///
295 ///
296 /// #### `mnemonic-keyval`
297 /// Readable
298 ///
299 ///
300 /// #### `mnemonic-widget`
301 /// Readable | Writeable
302 ///
303 ///
304 /// #### `pattern`
305 /// Writeable
306 ///
307 ///
308 /// #### `selectable`
309 /// Readable | Writeable
310 ///
311 ///
312 /// #### `selection-bound`
313 /// Readable
314 ///
315 ///
316 /// #### `single-line-mode`
317 /// Whether the label is in single line mode. In single line mode,
318 /// the height of the label does not depend on the actual text, it
319 /// is always set to ascent + descent of the font. This can be an
320 /// advantage in situations where resizing the label because of text
321 /// changes would be distracting, e.g. in a statusbar.
322 ///
323 /// Readable | Writeable
324 ///
325 ///
326 /// #### `track-visited-links`
327 /// Set this property to [`true`] to make the label track which links
328 /// have been visited. It will then apply the [`StateFlags::VISITED`][crate::StateFlags::VISITED]
329 /// when rendering this link, in addition to [`StateFlags::LINK`][crate::StateFlags::LINK].
330 ///
331 /// Readable | Writeable
332 ///
333 ///
334 /// #### `use-markup`
335 /// Readable | Writeable
336 ///
337 ///
338 /// #### `use-underline`
339 /// Readable | Writeable
340 ///
341 ///
342 /// #### `width-chars`
343 /// The desired width of the label, in characters. If this property is set to
344 /// -1, the width will be calculated automatically.
345 ///
346 /// See the section on [text layout][label-text-layout]
347 /// for details of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
348 /// determine the width of ellipsized and wrapped labels.
349 ///
350 /// Readable | Writeable
351 ///
352 ///
353 /// #### `wrap`
354 /// Readable | Writeable
355 ///
356 ///
357 /// #### `wrap-mode`
358 /// If line wrapping is on (see the [`wrap`][struct@crate::Label#wrap] property) this controls
359 /// how the line wrapping is done. The default is [`pango::WrapMode::Word`][crate::pango::WrapMode::Word], which
360 /// means wrap on word boundaries.
361 ///
362 /// Readable | Writeable
363 ///
364 ///
365 /// #### `xalign`
366 /// The xalign property determines the horizontal aligment of the label text
367 /// inside the labels size allocation. Compare this to [`halign`][struct@crate::Widget#halign],
368 /// which determines how the labels size allocation is positioned in the
369 /// space available for the label.
370 ///
371 /// Readable | Writeable
372 ///
373 ///
374 /// #### `yalign`
375 /// The yalign property determines the vertical aligment of the label text
376 /// inside the labels size allocation. Compare this to [`valign`][struct@crate::Widget#valign],
377 /// which determines how the labels size allocation is positioned in the
378 /// space available for the label.
379 ///
380 /// Readable | Writeable
381 /// <details><summary><h4>Misc</h4></summary>
382 ///
383 ///
384 /// #### `xalign`
385 /// The horizontal alignment. A value of 0.0 means left alignment (or right
386 /// on RTL locales); a value of 1.0 means right alignment (or left on RTL
387 /// locales).
388 ///
389 /// Readable | Writeable
390 ///
391 ///
392 /// #### `xpad`
393 /// The amount of space to add on the left and right of the widget, in
394 /// pixels.
395 ///
396 /// Readable | Writeable
397 ///
398 ///
399 /// #### `yalign`
400 /// The vertical alignment. A value of 0.0 means top alignment;
401 /// a value of 1.0 means bottom alignment.
402 ///
403 /// Readable | Writeable
404 ///
405 ///
406 /// #### `ypad`
407 /// The amount of space to add on the top and bottom of the widget, in
408 /// pixels.
409 ///
410 /// Readable | Writeable
411 /// </details>
412 /// <details><summary><h4>Widget</h4></summary>
413 ///
414 ///
415 /// #### `app-paintable`
416 /// Readable | Writeable
417 ///
418 ///
419 /// #### `can-default`
420 /// Readable | Writeable
421 ///
422 ///
423 /// #### `can-focus`
424 /// Readable | Writeable
425 ///
426 ///
427 /// #### `composite-child`
428 /// Readable
429 ///
430 ///
431 /// #### `double-buffered`
432 /// Whether the widget is double buffered.
433 ///
434 /// Readable | Writeable
435 ///
436 ///
437 /// #### `events`
438 /// Readable | Writeable
439 ///
440 ///
441 /// #### `expand`
442 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
443 ///
444 /// Readable | Writeable
445 ///
446 ///
447 /// #### `focus-on-click`
448 /// Whether the widget should grab focus when it is clicked with the mouse.
449 ///
450 /// This property is only relevant for widgets that can take focus.
451 ///
452 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
453 /// GtkComboBox) implemented this property individually.
454 ///
455 /// Readable | Writeable
456 ///
457 ///
458 /// #### `halign`
459 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
460 ///
461 /// Readable | Writeable
462 ///
463 ///
464 /// #### `has-default`
465 /// Readable | Writeable
466 ///
467 ///
468 /// #### `has-focus`
469 /// Readable | Writeable
470 ///
471 ///
472 /// #### `has-tooltip`
473 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
474 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
475 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
476 /// whether it will provide a tooltip or not.
477 ///
478 /// Note that setting this property to [`true`] for the first time will change
479 /// the event masks of the GdkWindows of this widget to include leave-notify
480 /// and motion-notify events. This cannot and will not be undone when the
481 /// property is set to [`false`] again.
482 ///
483 /// Readable | Writeable
484 ///
485 ///
486 /// #### `height-request`
487 /// Readable | Writeable
488 ///
489 ///
490 /// #### `hexpand`
491 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
492 ///
493 /// Readable | Writeable
494 ///
495 ///
496 /// #### `hexpand-set`
497 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
498 ///
499 /// Readable | Writeable
500 ///
501 ///
502 /// #### `is-focus`
503 /// Readable | Writeable
504 ///
505 ///
506 /// #### `margin`
507 /// Sets all four sides' margin at once. If read, returns max
508 /// margin on any side.
509 ///
510 /// Readable | Writeable
511 ///
512 ///
513 /// #### `margin-bottom`
514 /// Margin on bottom side of widget.
515 ///
516 /// This property adds margin outside of the widget's normal size
517 /// request, the margin will be added in addition to the size from
518 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
519 ///
520 /// Readable | Writeable
521 ///
522 ///
523 /// #### `margin-end`
524 /// Margin on end of widget, horizontally. This property supports
525 /// left-to-right and right-to-left text directions.
526 ///
527 /// This property adds margin outside of the widget's normal size
528 /// request, the margin will be added in addition to the size from
529 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
530 ///
531 /// Readable | Writeable
532 ///
533 ///
534 /// #### `margin-left`
535 /// Margin on left side of widget.
536 ///
537 /// This property adds margin outside of the widget's normal size
538 /// request, the margin will be added in addition to the size from
539 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
540 ///
541 /// Readable | Writeable
542 ///
543 ///
544 /// #### `margin-right`
545 /// Margin on right side of widget.
546 ///
547 /// This property adds margin outside of the widget's normal size
548 /// request, the margin will be added in addition to the size from
549 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
550 ///
551 /// Readable | Writeable
552 ///
553 ///
554 /// #### `margin-start`
555 /// Margin on start of widget, horizontally. This property supports
556 /// left-to-right and right-to-left text directions.
557 ///
558 /// This property adds margin outside of the widget's normal size
559 /// request, the margin will be added in addition to the size from
560 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
561 ///
562 /// Readable | Writeable
563 ///
564 ///
565 /// #### `margin-top`
566 /// Margin on top side of widget.
567 ///
568 /// This property adds margin outside of the widget's normal size
569 /// request, the margin will be added in addition to the size from
570 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
571 ///
572 /// Readable | Writeable
573 ///
574 ///
575 /// #### `name`
576 /// Readable | Writeable
577 ///
578 ///
579 /// #### `no-show-all`
580 /// Readable | Writeable
581 ///
582 ///
583 /// #### `opacity`
584 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
585 /// more details about window opacity.
586 ///
587 /// Before 3.8 this was only available in GtkWindow
588 ///
589 /// Readable | Writeable
590 ///
591 ///
592 /// #### `parent`
593 /// Readable | Writeable
594 ///
595 ///
596 /// #### `receives-default`
597 /// Readable | Writeable
598 ///
599 ///
600 /// #### `scale-factor`
601 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
602 /// more details about widget scaling.
603 ///
604 /// Readable
605 ///
606 ///
607 /// #### `sensitive`
608 /// Readable | Writeable
609 ///
610 ///
611 /// #### `style`
612 /// The style of the widget, which contains information about how it will look (colors, etc).
613 ///
614 /// Readable | Writeable
615 ///
616 ///
617 /// #### `tooltip-markup`
618 /// Sets the text of tooltip to be the given string, which is marked up
619 /// with the [Pango text markup language][PangoMarkupFormat].
620 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
621 ///
622 /// This is a convenience property which will take care of getting the
623 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
624 /// will automatically be set to [`true`] and there will be taken care of
625 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
626 ///
627 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
628 /// are set, the last one wins.
629 ///
630 /// Readable | Writeable
631 ///
632 ///
633 /// #### `tooltip-text`
634 /// Sets the text of tooltip to be the given string.
635 ///
636 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
637 ///
638 /// This is a convenience property which will take care of getting the
639 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
640 /// will automatically be set to [`true`] and there will be taken care of
641 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
642 ///
643 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
644 /// are set, the last one wins.
645 ///
646 /// Readable | Writeable
647 ///
648 ///
649 /// #### `valign`
650 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
651 ///
652 /// Readable | Writeable
653 ///
654 ///
655 /// #### `vexpand`
656 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
657 ///
658 /// Readable | Writeable
659 ///
660 ///
661 /// #### `vexpand-set`
662 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
663 ///
664 /// Readable | Writeable
665 ///
666 ///
667 /// #### `visible`
668 /// Readable | Writeable
669 ///
670 ///
671 /// #### `width-request`
672 /// Readable | Writeable
673 ///
674 ///
675 /// #### `window`
676 /// The widget's window if it is realized, [`None`] otherwise.
677 ///
678 /// Readable
679 /// </details>
680 ///
681 /// ## Signals
682 ///
683 ///
684 /// #### `activate-current-link`
685 /// A [keybinding signal][GtkBindingSignal]
686 /// which gets emitted when the user activates a link in the label.
687 ///
688 /// Applications may also emit the signal with `g_signal_emit_by_name()`
689 /// if they need to control activation of URIs programmatically.
690 ///
691 /// The default bindings for this signal are all forms of the Enter key.
692 ///
693 /// Action
694 ///
695 ///
696 /// #### `activate-link`
697 /// The signal which gets emitted to activate a URI.
698 /// Applications may connect to it to override the default behaviour,
699 /// which is to call [`show_uri_on_window()`][crate::show_uri_on_window()].
700 ///
701 ///
702 ///
703 ///
704 /// #### `copy-clipboard`
705 /// The ::copy-clipboard signal is a
706 /// [keybinding signal][GtkBindingSignal]
707 /// which gets emitted to copy the selection to the clipboard.
708 ///
709 /// The default binding for this signal is Ctrl-c.
710 ///
711 /// Action
712 ///
713 ///
714 /// #### `move-cursor`
715 /// The ::move-cursor signal is a
716 /// [keybinding signal][GtkBindingSignal]
717 /// which gets emitted when the user initiates a cursor movement.
718 /// If the cursor is not visible in `entry`, this signal causes
719 /// the viewport to be moved instead.
720 ///
721 /// Applications should not connect to it, but may emit it with
722 /// `g_signal_emit_by_name()` if they need to control the cursor
723 /// programmatically.
724 ///
725 /// The default bindings for this signal come in two variants,
726 /// the variant with the Shift modifier extends the selection,
727 /// the variant without the Shift modifer does not.
728 /// There are too many key combinations to list them all here.
729 /// - Arrow keys move by individual characters/lines
730 /// - Ctrl-arrow key combinations move by words/paragraphs
731 /// - Home/End keys move to the ends of the buffer
732 ///
733 /// Action
734 ///
735 ///
736 /// #### `populate-popup`
737 /// The ::populate-popup signal gets emitted before showing the
738 /// context menu of the label. Note that only selectable labels
739 /// have context menus.
740 ///
741 /// If you need to add items to the context menu, connect
742 /// to this signal and append your menuitems to the `menu`.
743 ///
744 ///
745 /// <details><summary><h4>Widget</h4></summary>
746 ///
747 ///
748 /// #### `accel-closures-changed`
749 ///
750 ///
751 ///
752 /// #### `button-press-event`
753 /// The ::button-press-event signal will be emitted when a button
754 /// (typically from a mouse) is pressed.
755 ///
756 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
757 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
758 ///
759 /// This signal will be sent to the grab widget if there is one.
760 ///
761 ///
762 ///
763 ///
764 /// #### `button-release-event`
765 /// The ::button-release-event signal will be emitted when a button
766 /// (typically from a mouse) is released.
767 ///
768 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
769 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
770 ///
771 /// This signal will be sent to the grab widget if there is one.
772 ///
773 ///
774 ///
775 ///
776 /// #### `can-activate-accel`
777 /// Determines whether an accelerator that activates the signal
778 /// identified by `signal_id` can currently be activated.
779 /// This signal is present to allow applications and derived
780 /// widgets to override the default [`Widget`][crate::Widget] handling
781 /// for determining whether an accelerator can be activated.
782 ///
783 ///
784 ///
785 ///
786 /// #### `child-notify`
787 /// The ::child-notify signal is emitted for each
788 /// [child property][child-properties] that has
789 /// changed on an object. The signal's detail holds the property name.
790 ///
791 /// Detailed
792 ///
793 ///
794 /// #### `composited-changed`
795 /// The ::composited-changed signal is emitted when the composited
796 /// status of `widgets` screen changes.
797 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
798 ///
799 /// Action
800 ///
801 ///
802 /// #### `configure-event`
803 /// The ::configure-event signal will be emitted when the size, position or
804 /// stacking of the `widget`'s window has changed.
805 ///
806 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
807 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
808 /// automatically for all new windows.
809 ///
810 ///
811 ///
812 ///
813 /// #### `damage-event`
814 /// Emitted when a redirected window belonging to `widget` gets drawn into.
815 /// The region/area members of the event shows what area of the redirected
816 /// drawable was drawn into.
817 ///
818 ///
819 ///
820 ///
821 /// #### `delete-event`
822 /// The ::delete-event signal is emitted if a user requests that
823 /// a toplevel window is closed. The default handler for this signal
824 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
825 /// this signal will cause the window to be hidden instead, so that
826 /// it can later be shown again without reconstructing it.
827 ///
828 ///
829 ///
830 ///
831 /// #### `destroy`
832 /// Signals that all holders of a reference to the widget should release
833 /// the reference that they hold. May result in finalization of the widget
834 /// if all references are released.
835 ///
836 /// This signal is not suitable for saving widget state.
837 ///
838 ///
839 ///
840 ///
841 /// #### `destroy-event`
842 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
843 /// You rarely get this signal, because most widgets disconnect themselves
844 /// from their window before they destroy it, so no widget owns the
845 /// window at destroy time.
846 ///
847 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
848 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
849 /// automatically for all new windows.
850 ///
851 ///
852 ///
853 ///
854 /// #### `direction-changed`
855 /// The ::direction-changed signal is emitted when the text direction
856 /// of a widget changes.
857 ///
858 ///
859 ///
860 ///
861 /// #### `drag-begin`
862 /// The ::drag-begin signal is emitted on the drag source when a drag is
863 /// started. A typical reason to connect to this signal is to set up a
864 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
865 ///
866 /// Note that some widgets set up a drag icon in the default handler of
867 /// this signal, so you may have to use `g_signal_connect_after()` to
868 /// override what the default handler did.
869 ///
870 ///
871 ///
872 ///
873 /// #### `drag-data-delete`
874 /// The ::drag-data-delete signal is emitted on the drag source when a drag
875 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
876 /// handler is responsible for deleting the data that has been dropped. What
877 /// "delete" means depends on the context of the drag operation.
878 ///
879 ///
880 ///
881 ///
882 /// #### `drag-data-get`
883 /// The ::drag-data-get signal is emitted on the drag source when the drop
884 /// site requests the data which is dragged. It is the responsibility of
885 /// the signal handler to fill `data` with the data in the format which
886 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
887 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
888 ///
889 ///
890 ///
891 ///
892 /// #### `drag-data-received`
893 /// The ::drag-data-received signal is emitted on the drop site when the
894 /// dragged data has been received. If the data was received in order to
895 /// determine whether the drop will be accepted, the handler is expected
896 /// to call `gdk_drag_status()` and not finish the drag.
897 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
898 /// (and this is the last target to be received), the handler for this
899 /// signal is expected to process the received data and then call
900 /// `gtk_drag_finish()`, setting the `success` parameter depending on
901 /// whether the data was processed successfully.
902 ///
903 /// Applications must create some means to determine why the signal was emitted
904 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
905 ///
906 /// The handler may inspect the selected action with
907 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
908 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
909 /// shown in the following example:
910 ///
911 ///
912 /// **⚠️ The following code is in C ⚠️**
913 ///
914 /// ```C
915 /// void
916 /// drag_data_received (GtkWidget *widget,
917 /// GdkDragContext *context,
918 /// gint x,
919 /// gint y,
920 /// GtkSelectionData *data,
921 /// guint info,
922 /// guint time)
923 /// {
924 /// if ((data->length >= 0) && (data->format == 8))
925 /// {
926 /// GdkDragAction action;
927 ///
928 /// // handle data here
929 ///
930 /// action = gdk_drag_context_get_selected_action (context);
931 /// if (action == GDK_ACTION_ASK)
932 /// {
933 /// GtkWidget *dialog;
934 /// gint response;
935 ///
936 /// dialog = gtk_message_dialog_new (NULL,
937 /// GTK_DIALOG_MODAL |
938 /// GTK_DIALOG_DESTROY_WITH_PARENT,
939 /// GTK_MESSAGE_INFO,
940 /// GTK_BUTTONS_YES_NO,
941 /// "Move the data ?\n");
942 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
943 /// gtk_widget_destroy (dialog);
944 ///
945 /// if (response == GTK_RESPONSE_YES)
946 /// action = GDK_ACTION_MOVE;
947 /// else
948 /// action = GDK_ACTION_COPY;
949 /// }
950 ///
951 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
952 /// }
953 /// else
954 /// gtk_drag_finish (context, FALSE, FALSE, time);
955 /// }
956 /// ```
957 ///
958 ///
959 ///
960 ///
961 /// #### `drag-drop`
962 /// The ::drag-drop signal is emitted on the drop site when the user drops
963 /// the data onto the widget. The signal handler must determine whether
964 /// the cursor position is in a drop zone or not. If it is not in a drop
965 /// zone, it returns [`false`] and no further processing is necessary.
966 /// Otherwise, the handler returns [`true`]. In this case, the handler must
967 /// ensure that `gtk_drag_finish()` is called to let the source know that
968 /// the drop is done. The call to `gtk_drag_finish()` can be done either
969 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
970 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
971 /// or more of the supported targets.
972 ///
973 ///
974 ///
975 ///
976 /// #### `drag-end`
977 /// The ::drag-end signal is emitted on the drag source when a drag is
978 /// finished. A typical reason to connect to this signal is to undo
979 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
980 ///
981 ///
982 ///
983 ///
984 /// #### `drag-failed`
985 /// The ::drag-failed signal is emitted on the drag source when a drag has
986 /// failed. The signal handler may hook custom code to handle a failed DnD
987 /// operation based on the type of error, it returns [`true`] is the failure has
988 /// been already handled (not showing the default "drag operation failed"
989 /// animation), otherwise it returns [`false`].
990 ///
991 ///
992 ///
993 ///
994 /// #### `drag-leave`
995 /// The ::drag-leave signal is emitted on the drop site when the cursor
996 /// leaves the widget. A typical reason to connect to this signal is to
997 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
998 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
999 ///
1000 ///
1001 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
1002 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
1003 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
1004 ///
1005 ///
1006 ///
1007 ///
1008 /// #### `drag-motion`
1009 /// The ::drag-motion signal is emitted on the drop site when the user
1010 /// moves the cursor over the widget during a drag. The signal handler
1011 /// must determine whether the cursor position is in a drop zone or not.
1012 /// If it is not in a drop zone, it returns [`false`] and no further processing
1013 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
1014 /// handler is responsible for providing the necessary information for
1015 /// displaying feedback to the user, by calling `gdk_drag_status()`.
1016 ///
1017 /// If the decision whether the drop will be accepted or rejected can't be
1018 /// made based solely on the cursor position and the type of the data, the
1019 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
1020 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
1021 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
1022 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
1023 /// when using the drag-motion signal that way.
1024 ///
1025 /// Also note that there is no drag-enter signal. The drag receiver has to
1026 /// keep track of whether he has received any drag-motion signals since the
1027 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
1028 /// an "enter" signal. Upon an "enter", the handler will typically highlight
1029 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
1030 ///
1031 ///
1032 /// **⚠️ The following code is in C ⚠️**
1033 ///
1034 /// ```C
1035 /// static void
1036 /// drag_motion (GtkWidget *widget,
1037 /// GdkDragContext *context,
1038 /// gint x,
1039 /// gint y,
1040 /// guint time)
1041 /// {
1042 /// GdkAtom target;
1043 ///
1044 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
1045 ///
1046 /// if (!private_data->drag_highlight)
1047 /// {
1048 /// private_data->drag_highlight = 1;
1049 /// gtk_drag_highlight (widget);
1050 /// }
1051 ///
1052 /// target = gtk_drag_dest_find_target (widget, context, NULL);
1053 /// if (target == GDK_NONE)
1054 /// gdk_drag_status (context, 0, time);
1055 /// else
1056 /// {
1057 /// private_data->pending_status
1058 /// = gdk_drag_context_get_suggested_action (context);
1059 /// gtk_drag_get_data (widget, context, target, time);
1060 /// }
1061 ///
1062 /// return TRUE;
1063 /// }
1064 ///
1065 /// static void
1066 /// drag_data_received (GtkWidget *widget,
1067 /// GdkDragContext *context,
1068 /// gint x,
1069 /// gint y,
1070 /// GtkSelectionData *selection_data,
1071 /// guint info,
1072 /// guint time)
1073 /// {
1074 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
1075 ///
1076 /// if (private_data->suggested_action)
1077 /// {
1078 /// private_data->suggested_action = 0;
1079 ///
1080 /// // We are getting this data due to a request in drag_motion,
1081 /// // rather than due to a request in drag_drop, so we are just
1082 /// // supposed to call gdk_drag_status(), not actually paste in
1083 /// // the data.
1084 ///
1085 /// str = gtk_selection_data_get_text (selection_data);
1086 /// if (!data_is_acceptable (str))
1087 /// gdk_drag_status (context, 0, time);
1088 /// else
1089 /// gdk_drag_status (context,
1090 /// private_data->suggested_action,
1091 /// time);
1092 /// }
1093 /// else
1094 /// {
1095 /// // accept the drop
1096 /// }
1097 /// }
1098 /// ```
1099 ///
1100 ///
1101 ///
1102 ///
1103 /// #### `draw`
1104 /// This signal is emitted when a widget is supposed to render itself.
1105 /// The `widget`'s top left corner must be painted at the origin of
1106 /// the passed in context and be sized to the values returned by
1107 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
1108 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
1109 ///
1110 /// Signal handlers connected to this signal can modify the cairo
1111 /// context passed as `cr` in any way they like and don't need to
1112 /// restore it. The signal emission takes care of calling `cairo_save()`
1113 /// before and `cairo_restore()` after invoking the handler.
1114 ///
1115 /// The signal handler will get a `cr` with a clip region already set to the
1116 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
1117 /// widgets that want to avoid redrawing themselves completely can get the full
1118 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
1119 /// get a finer-grained representation of the dirty region with
1120 /// `cairo_copy_clip_rectangle_list()`.
1121 ///
1122 ///
1123 ///
1124 ///
1125 /// #### `enter-notify-event`
1126 /// The ::enter-notify-event will be emitted when the pointer enters
1127 /// the `widget`'s window.
1128 ///
1129 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1130 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
1131 ///
1132 /// This signal will be sent to the grab widget if there is one.
1133 ///
1134 ///
1135 ///
1136 ///
1137 /// #### `event`
1138 /// The GTK+ main loop will emit three signals for each GDK event delivered
1139 /// to a widget: one generic ::event signal, another, more specific,
1140 /// signal that matches the type of event delivered (e.g.
1141 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
1142 /// [`event-after`][struct@crate::Widget#event-after] signal.
1143 ///
1144 ///
1145 ///
1146 ///
1147 /// #### `event-after`
1148 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
1149 /// the second more specific signal, ::event-after will be emitted
1150 /// regardless of the previous two signals handlers return values.
1151 ///
1152 ///
1153 ///
1154 ///
1155 /// #### `focus`
1156 ///
1157 ///
1158 ///
1159 /// #### `focus-in-event`
1160 /// The ::focus-in-event signal will be emitted when the keyboard focus
1161 /// enters the `widget`'s window.
1162 ///
1163 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1164 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1165 ///
1166 ///
1167 ///
1168 ///
1169 /// #### `focus-out-event`
1170 /// The ::focus-out-event signal will be emitted when the keyboard focus
1171 /// leaves the `widget`'s window.
1172 ///
1173 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1174 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1175 ///
1176 ///
1177 ///
1178 ///
1179 /// #### `grab-broken-event`
1180 /// Emitted when a pointer or keyboard grab on a window belonging
1181 /// to `widget` gets broken.
1182 ///
1183 /// On X11, this happens when the grab window becomes unviewable
1184 /// (i.e. it or one of its ancestors is unmapped), or if the same
1185 /// application grabs the pointer or keyboard again.
1186 ///
1187 ///
1188 ///
1189 ///
1190 /// #### `grab-focus`
1191 /// Action
1192 ///
1193 ///
1194 /// #### `grab-notify`
1195 /// The ::grab-notify signal is emitted when a widget becomes
1196 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
1197 /// another widget, or when it becomes unshadowed due to a grab
1198 /// being removed.
1199 ///
1200 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1201 /// grab widget in the grab stack of its window group is not
1202 /// its ancestor.
1203 ///
1204 ///
1205 ///
1206 ///
1207 /// #### `hide`
1208 /// The ::hide signal is emitted when `widget` is hidden, for example with
1209 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1210 ///
1211 ///
1212 ///
1213 ///
1214 /// #### `hierarchy-changed`
1215 /// The ::hierarchy-changed signal is emitted when the
1216 /// anchored state of a widget changes. A widget is
1217 /// “anchored” when its toplevel
1218 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1219 /// a widget changes from un-anchored to anchored or vice-versa.
1220 ///
1221 ///
1222 ///
1223 ///
1224 /// #### `key-press-event`
1225 /// The ::key-press-event signal is emitted when a key is pressed. The signal
1226 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1227 ///
1228 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1229 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1230 ///
1231 /// This signal will be sent to the grab widget if there is one.
1232 ///
1233 ///
1234 ///
1235 ///
1236 /// #### `key-release-event`
1237 /// The ::key-release-event signal is emitted when a key is released.
1238 ///
1239 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1240 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1241 ///
1242 /// This signal will be sent to the grab widget if there is one.
1243 ///
1244 ///
1245 ///
1246 ///
1247 /// #### `keynav-failed`
1248 /// Gets emitted if keyboard navigation fails.
1249 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1250 ///
1251 ///
1252 ///
1253 ///
1254 /// #### `leave-notify-event`
1255 /// The ::leave-notify-event will be emitted when the pointer leaves
1256 /// the `widget`'s window.
1257 ///
1258 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1259 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1260 ///
1261 /// This signal will be sent to the grab widget if there is one.
1262 ///
1263 ///
1264 ///
1265 ///
1266 /// #### `map`
1267 /// The ::map signal is emitted when `widget` is going to be mapped, that is
1268 /// when the widget is visible (which is controlled with
1269 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1270 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1271 /// be emitted.
1272 ///
1273 /// The ::map signal can be used to determine whether a widget will be drawn,
1274 /// for instance it can resume an animation that was stopped during the
1275 /// emission of [`unmap`][struct@crate::Widget#unmap].
1276 ///
1277 ///
1278 ///
1279 ///
1280 /// #### `map-event`
1281 /// The ::map-event signal will be emitted when the `widget`'s window is
1282 /// mapped. A window is mapped when it becomes visible on the screen.
1283 ///
1284 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1285 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1286 /// automatically for all new windows.
1287 ///
1288 ///
1289 ///
1290 ///
1291 /// #### `mnemonic-activate`
1292 /// The default handler for this signal activates `widget` if `group_cycling`
1293 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1294 ///
1295 ///
1296 ///
1297 ///
1298 /// #### `motion-notify-event`
1299 /// The ::motion-notify-event signal is emitted when the pointer moves
1300 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1301 ///
1302 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1303 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1304 ///
1305 /// This signal will be sent to the grab widget if there is one.
1306 ///
1307 ///
1308 ///
1309 ///
1310 /// #### `move-focus`
1311 /// Action
1312 ///
1313 ///
1314 /// #### `parent-set`
1315 /// The ::parent-set signal is emitted when a new parent
1316 /// has been set on a widget.
1317 ///
1318 ///
1319 ///
1320 ///
1321 /// #### `popup-menu`
1322 /// This signal gets emitted whenever a widget should pop up a context
1323 /// menu. This usually happens through the standard key binding mechanism;
1324 /// by pressing a certain key while a widget is focused, the user can cause
1325 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1326 /// a menu with clipboard commands. See the
1327 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1328 /// for an example of how to use this signal.
1329 ///
1330 /// Action
1331 ///
1332 ///
1333 /// #### `property-notify-event`
1334 /// The ::property-notify-event signal will be emitted when a property on
1335 /// the `widget`'s window has been changed or deleted.
1336 ///
1337 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1338 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1339 ///
1340 ///
1341 ///
1342 ///
1343 /// #### `proximity-in-event`
1344 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1345 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1346 ///
1347 /// This signal will be sent to the grab widget if there is one.
1348 ///
1349 ///
1350 ///
1351 ///
1352 /// #### `proximity-out-event`
1353 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1354 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1355 ///
1356 /// This signal will be sent to the grab widget if there is one.
1357 ///
1358 ///
1359 ///
1360 ///
1361 /// #### `query-tooltip`
1362 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1363 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1364 /// focus in keyboard mode.
1365 ///
1366 /// Using the given coordinates, the signal handler should determine
1367 /// whether a tooltip should be shown for `widget`. If this is the case
1368 /// [`true`] should be returned, [`false`] otherwise. Note that if
1369 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1370 /// should not be used.
1371 ///
1372 /// The signal handler is free to manipulate `tooltip` with the therefore
1373 /// destined function calls.
1374 ///
1375 ///
1376 ///
1377 ///
1378 /// #### `realize`
1379 /// The ::realize signal is emitted when `widget` is associated with a
1380 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1381 /// widget has been mapped (that is, it is going to be drawn).
1382 ///
1383 ///
1384 ///
1385 ///
1386 /// #### `screen-changed`
1387 /// The ::screen-changed signal gets emitted when the
1388 /// screen of a widget has changed.
1389 ///
1390 ///
1391 ///
1392 ///
1393 /// #### `scroll-event`
1394 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1395 /// range is pressed. Wheel mice are usually configured to generate
1396 /// button press events for buttons 4 and 5 when the wheel is turned.
1397 ///
1398 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1399 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1400 ///
1401 /// This signal will be sent to the grab widget if there is one.
1402 ///
1403 ///
1404 ///
1405 ///
1406 /// #### `selection-clear-event`
1407 /// The ::selection-clear-event signal will be emitted when the
1408 /// the `widget`'s window has lost ownership of a selection.
1409 ///
1410 ///
1411 ///
1412 ///
1413 /// #### `selection-get`
1414 ///
1415 ///
1416 ///
1417 /// #### `selection-notify-event`
1418 ///
1419 ///
1420 ///
1421 /// #### `selection-received`
1422 ///
1423 ///
1424 ///
1425 /// #### `selection-request-event`
1426 /// The ::selection-request-event signal will be emitted when
1427 /// another client requests ownership of the selection owned by
1428 /// the `widget`'s window.
1429 ///
1430 ///
1431 ///
1432 ///
1433 /// #### `show`
1434 /// The ::show signal is emitted when `widget` is shown, for example with
1435 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1436 ///
1437 ///
1438 ///
1439 ///
1440 /// #### `show-help`
1441 /// Action
1442 ///
1443 ///
1444 /// #### `size-allocate`
1445 ///
1446 ///
1447 ///
1448 /// #### `state-changed`
1449 /// The ::state-changed signal is emitted when the widget state changes.
1450 /// See `gtk_widget_get_state()`.
1451 ///
1452 ///
1453 ///
1454 ///
1455 /// #### `state-flags-changed`
1456 /// The ::state-flags-changed signal is emitted when the widget state
1457 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1458 ///
1459 ///
1460 ///
1461 ///
1462 /// #### `style-set`
1463 /// The ::style-set signal is emitted when a new style has been set
1464 /// on a widget. Note that style-modifying functions like
1465 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1466 ///
1467 /// Note that this signal is emitted for changes to the deprecated
1468 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1469 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1470 ///
1471 ///
1472 ///
1473 ///
1474 /// #### `style-updated`
1475 /// The ::style-updated signal is a convenience signal that is emitted when the
1476 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1477 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1478 ///
1479 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1480 /// cause this signal to be emitted.
1481 ///
1482 ///
1483 ///
1484 ///
1485 /// #### `touch-event`
1486 ///
1487 ///
1488 ///
1489 /// #### `unmap`
1490 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1491 /// means that either it or any of its parents up to the toplevel widget have
1492 /// been set as hidden.
1493 ///
1494 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1495 /// used to, for example, stop an animation on the widget.
1496 ///
1497 ///
1498 ///
1499 ///
1500 /// #### `unmap-event`
1501 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1502 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1503 ///
1504 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1505 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1506 /// automatically for all new windows.
1507 ///
1508 ///
1509 ///
1510 ///
1511 /// #### `unrealize`
1512 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1513 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1514 /// called or the widget has been unmapped (that is, it is going to be
1515 /// hidden).
1516 ///
1517 ///
1518 ///
1519 ///
1520 /// #### `visibility-notify-event`
1521 /// The ::visibility-notify-event will be emitted when the `widget`'s
1522 /// window is obscured or unobscured.
1523 ///
1524 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1525 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1526 ///
1527 ///
1528 ///
1529 ///
1530 /// #### `window-state-event`
1531 /// The ::window-state-event will be emitted when the state of the
1532 /// toplevel window associated to the `widget` changes.
1533 ///
1534 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1535 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1536 /// this mask automatically for all new windows.
1537 ///
1538 ///
1539 /// </details>
1540 ///
1541 /// # Implements
1542 ///
1543 /// [`LabelExt`][trait@crate::prelude::LabelExt], [`MiscExt`][trait@crate::prelude::MiscExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1544 #[doc(alias = "GtkLabel")]
1545 pub struct Label(Object<ffi::GtkLabel, ffi::GtkLabelClass>) @extends Misc, Widget, @implements Buildable;
1546
1547 match fn {
1548 type_ => || ffi::gtk_label_get_type(),
1549 }
1550}
1551
1552impl Label {
1553 pub const NONE: Option<&'static Label> = None;
1554
1555 /// Creates a new label with the given text inside it. You can
1556 /// pass [`None`] to get an empty label widget.
1557 /// ## `str`
1558 /// The text of the label
1559 ///
1560 /// # Returns
1561 ///
1562 /// the new [`Label`][crate::Label]
1563 #[doc(alias = "gtk_label_new")]
1564 pub fn new(str: Option<&str>) -> Label {
1565 assert_initialized_main_thread!();
1566 unsafe { Widget::from_glib_none(ffi::gtk_label_new(str.to_glib_none().0)).unsafe_cast() }
1567 }
1568
1569 /// Creates a new [`Label`][crate::Label], containing the text in `str`.
1570 ///
1571 /// If characters in `str` are preceded by an underscore, they are
1572 /// underlined. If you need a literal underscore character in a label, use
1573 /// '__' (two underscores). The first underlined character represents a
1574 /// keyboard accelerator called a mnemonic. The mnemonic key can be used
1575 /// to activate another widget, chosen automatically, or explicitly using
1576 /// [`LabelExt::set_mnemonic_widget()`][crate::prelude::LabelExt::set_mnemonic_widget()].
1577 ///
1578 /// If [`LabelExt::set_mnemonic_widget()`][crate::prelude::LabelExt::set_mnemonic_widget()] is not called, then the first
1579 /// activatable ancestor of the [`Label`][crate::Label] will be chosen as the mnemonic
1580 /// widget. For instance, if the label is inside a button or menu item,
1581 /// the button or menu item will automatically become the mnemonic widget
1582 /// and be activated by the mnemonic.
1583 /// ## `str`
1584 /// The text of the label, with an underscore in front of the
1585 /// mnemonic character
1586 ///
1587 /// # Returns
1588 ///
1589 /// the new [`Label`][crate::Label]
1590 #[doc(alias = "gtk_label_new_with_mnemonic")]
1591 #[doc(alias = "new_with_mnemonic")]
1592 pub fn with_mnemonic(str: &str) -> Label {
1593 assert_initialized_main_thread!();
1594 unsafe {
1595 Widget::from_glib_none(ffi::gtk_label_new_with_mnemonic(str.to_glib_none().0))
1596 .unsafe_cast()
1597 }
1598 }
1599
1600 // rustdoc-stripper-ignore-next
1601 /// Creates a new builder-pattern struct instance to construct [`Label`] objects.
1602 ///
1603 /// This method returns an instance of [`LabelBuilder`](crate::builders::LabelBuilder) which can be used to create [`Label`] objects.
1604 pub fn builder() -> LabelBuilder {
1605 LabelBuilder::new()
1606 }
1607}
1608
1609impl Default for Label {
1610 fn default() -> Self {
1611 glib::object::Object::new::<Self>()
1612 }
1613}
1614
1615// rustdoc-stripper-ignore-next
1616/// A [builder-pattern] type to construct [`Label`] objects.
1617///
1618/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1619#[must_use = "The builder must be built to be used"]
1620pub struct LabelBuilder {
1621 builder: glib::object::ObjectBuilder<'static, Label>,
1622}
1623
1624impl LabelBuilder {
1625 fn new() -> Self {
1626 Self {
1627 builder: glib::object::Object::builder(),
1628 }
1629 }
1630
1631 /// The angle that the baseline of the label makes with the horizontal,
1632 /// in degrees, measured counterclockwise. An angle of 90 reads from
1633 /// from bottom to top, an angle of 270, from top to bottom. Ignored
1634 /// if the label is selectable.
1635 pub fn angle(self, angle: f64) -> Self {
1636 Self {
1637 builder: self.builder.property("angle", angle),
1638 }
1639 }
1640
1641 pub fn attributes(self, attributes: &pango::AttrList) -> Self {
1642 Self {
1643 builder: self.builder.property("attributes", attributes.clone()),
1644 }
1645 }
1646
1647 /// The preferred place to ellipsize the string, if the label does
1648 /// not have enough room to display the entire string, specified as a
1649 /// [`pango::EllipsizeMode`][crate::pango::EllipsizeMode].
1650 ///
1651 /// Note that setting this property to a value other than
1652 /// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] has the side-effect that the label requests
1653 /// only enough space to display the ellipsis "...". In particular, this
1654 /// means that ellipsizing labels do not work well in notebook tabs, unless
1655 /// the [`Notebook`][crate::Notebook] tab-expand child property is set to [`true`]. Other ways
1656 /// to set a label's width are [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] and
1657 /// [`LabelExt::set_width_chars()`][crate::prelude::LabelExt::set_width_chars()].
1658 pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
1659 Self {
1660 builder: self.builder.property("ellipsize", ellipsize),
1661 }
1662 }
1663
1664 pub fn justify(self, justify: Justification) -> Self {
1665 Self {
1666 builder: self.builder.property("justify", justify),
1667 }
1668 }
1669
1670 /// The contents of the label.
1671 ///
1672 /// If the string contains [Pango XML markup][PangoMarkupFormat], you will
1673 /// have to set the [`use-markup`][struct@crate::Label#use-markup] property to [`true`] in order for the
1674 /// label to display the markup attributes. See also [`LabelExt::set_markup()`][crate::prelude::LabelExt::set_markup()]
1675 /// for a convenience function that sets both this property and the
1676 /// [`use-markup`][struct@crate::Label#use-markup] property at the same time.
1677 ///
1678 /// If the string contains underlines acting as mnemonics, you will have to
1679 /// set the [`use-underline`][struct@crate::Label#use-underline] property to [`true`] in order for the label
1680 /// to display them.
1681 pub fn label(self, label: impl Into<glib::GString>) -> Self {
1682 Self {
1683 builder: self.builder.property("label", label.into()),
1684 }
1685 }
1686
1687 /// The number of lines to which an ellipsized, wrapping label
1688 /// should be limited. This property has no effect if the
1689 /// label is not wrapping or ellipsized. Set this property to
1690 /// -1 if you don't want to limit the number of lines.
1691 pub fn lines(self, lines: i32) -> Self {
1692 Self {
1693 builder: self.builder.property("lines", lines),
1694 }
1695 }
1696
1697 /// The desired maximum width of the label, in characters. If this property
1698 /// is set to -1, the width will be calculated automatically.
1699 ///
1700 /// See the section on [text layout][label-text-layout]
1701 /// for details of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
1702 /// determine the width of ellipsized and wrapped labels.
1703 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
1704 Self {
1705 builder: self.builder.property("max-width-chars", max_width_chars),
1706 }
1707 }
1708
1709 pub fn mnemonic_widget(self, mnemonic_widget: &impl IsA<Widget>) -> Self {
1710 Self {
1711 builder: self
1712 .builder
1713 .property("mnemonic-widget", mnemonic_widget.clone().upcast()),
1714 }
1715 }
1716
1717 pub fn pattern(self, pattern: impl Into<glib::GString>) -> Self {
1718 Self {
1719 builder: self.builder.property("pattern", pattern.into()),
1720 }
1721 }
1722
1723 pub fn selectable(self, selectable: bool) -> Self {
1724 Self {
1725 builder: self.builder.property("selectable", selectable),
1726 }
1727 }
1728
1729 /// Whether the label is in single line mode. In single line mode,
1730 /// the height of the label does not depend on the actual text, it
1731 /// is always set to ascent + descent of the font. This can be an
1732 /// advantage in situations where resizing the label because of text
1733 /// changes would be distracting, e.g. in a statusbar.
1734 pub fn single_line_mode(self, single_line_mode: bool) -> Self {
1735 Self {
1736 builder: self.builder.property("single-line-mode", single_line_mode),
1737 }
1738 }
1739
1740 /// Set this property to [`true`] to make the label track which links
1741 /// have been visited. It will then apply the [`StateFlags::VISITED`][crate::StateFlags::VISITED]
1742 /// when rendering this link, in addition to [`StateFlags::LINK`][crate::StateFlags::LINK].
1743 pub fn track_visited_links(self, track_visited_links: bool) -> Self {
1744 Self {
1745 builder: self
1746 .builder
1747 .property("track-visited-links", track_visited_links),
1748 }
1749 }
1750
1751 pub fn use_markup(self, use_markup: bool) -> Self {
1752 Self {
1753 builder: self.builder.property("use-markup", use_markup),
1754 }
1755 }
1756
1757 pub fn use_underline(self, use_underline: bool) -> Self {
1758 Self {
1759 builder: self.builder.property("use-underline", use_underline),
1760 }
1761 }
1762
1763 /// The desired width of the label, in characters. If this property is set to
1764 /// -1, the width will be calculated automatically.
1765 ///
1766 /// See the section on [text layout][label-text-layout]
1767 /// for details of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
1768 /// determine the width of ellipsized and wrapped labels.
1769 pub fn width_chars(self, width_chars: i32) -> Self {
1770 Self {
1771 builder: self.builder.property("width-chars", width_chars),
1772 }
1773 }
1774
1775 pub fn wrap(self, wrap: bool) -> Self {
1776 Self {
1777 builder: self.builder.property("wrap", wrap),
1778 }
1779 }
1780
1781 /// If line wrapping is on (see the [`wrap`][struct@crate::Label#wrap] property) this controls
1782 /// how the line wrapping is done. The default is [`pango::WrapMode::Word`][crate::pango::WrapMode::Word], which
1783 /// means wrap on word boundaries.
1784 pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
1785 Self {
1786 builder: self.builder.property("wrap-mode", wrap_mode),
1787 }
1788 }
1789
1790 /// The xalign property determines the horizontal aligment of the label text
1791 /// inside the labels size allocation. Compare this to [`halign`][struct@crate::Widget#halign],
1792 /// which determines how the labels size allocation is positioned in the
1793 /// space available for the label.
1794 pub fn xalign(self, xalign: f32) -> Self {
1795 Self {
1796 builder: self.builder.property("xalign", xalign),
1797 }
1798 }
1799
1800 /// The yalign property determines the vertical aligment of the label text
1801 /// inside the labels size allocation. Compare this to [`valign`][struct@crate::Widget#valign],
1802 /// which determines how the labels size allocation is positioned in the
1803 /// space available for the label.
1804 pub fn yalign(self, yalign: f32) -> Self {
1805 Self {
1806 builder: self.builder.property("yalign", yalign),
1807 }
1808 }
1809
1810 pub fn app_paintable(self, app_paintable: bool) -> Self {
1811 Self {
1812 builder: self.builder.property("app-paintable", app_paintable),
1813 }
1814 }
1815
1816 pub fn can_default(self, can_default: bool) -> Self {
1817 Self {
1818 builder: self.builder.property("can-default", can_default),
1819 }
1820 }
1821
1822 pub fn can_focus(self, can_focus: bool) -> Self {
1823 Self {
1824 builder: self.builder.property("can-focus", can_focus),
1825 }
1826 }
1827
1828 pub fn events(self, events: gdk::EventMask) -> Self {
1829 Self {
1830 builder: self.builder.property("events", events),
1831 }
1832 }
1833
1834 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1835 pub fn expand(self, expand: bool) -> Self {
1836 Self {
1837 builder: self.builder.property("expand", expand),
1838 }
1839 }
1840
1841 /// Whether the widget should grab focus when it is clicked with the mouse.
1842 ///
1843 /// This property is only relevant for widgets that can take focus.
1844 ///
1845 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1846 /// GtkComboBox) implemented this property individually.
1847 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1848 Self {
1849 builder: self.builder.property("focus-on-click", focus_on_click),
1850 }
1851 }
1852
1853 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1854 pub fn halign(self, halign: Align) -> Self {
1855 Self {
1856 builder: self.builder.property("halign", halign),
1857 }
1858 }
1859
1860 pub fn has_default(self, has_default: bool) -> Self {
1861 Self {
1862 builder: self.builder.property("has-default", has_default),
1863 }
1864 }
1865
1866 pub fn has_focus(self, has_focus: bool) -> Self {
1867 Self {
1868 builder: self.builder.property("has-focus", has_focus),
1869 }
1870 }
1871
1872 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1873 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1874 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1875 /// whether it will provide a tooltip or not.
1876 ///
1877 /// Note that setting this property to [`true`] for the first time will change
1878 /// the event masks of the GdkWindows of this widget to include leave-notify
1879 /// and motion-notify events. This cannot and will not be undone when the
1880 /// property is set to [`false`] again.
1881 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1882 Self {
1883 builder: self.builder.property("has-tooltip", has_tooltip),
1884 }
1885 }
1886
1887 pub fn height_request(self, height_request: i32) -> Self {
1888 Self {
1889 builder: self.builder.property("height-request", height_request),
1890 }
1891 }
1892
1893 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1894 pub fn hexpand(self, hexpand: bool) -> Self {
1895 Self {
1896 builder: self.builder.property("hexpand", hexpand),
1897 }
1898 }
1899
1900 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1901 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1902 Self {
1903 builder: self.builder.property("hexpand-set", hexpand_set),
1904 }
1905 }
1906
1907 pub fn is_focus(self, is_focus: bool) -> Self {
1908 Self {
1909 builder: self.builder.property("is-focus", is_focus),
1910 }
1911 }
1912
1913 /// Sets all four sides' margin at once. If read, returns max
1914 /// margin on any side.
1915 pub fn margin(self, margin: i32) -> Self {
1916 Self {
1917 builder: self.builder.property("margin", margin),
1918 }
1919 }
1920
1921 /// Margin on bottom side of widget.
1922 ///
1923 /// This property adds margin outside of the widget's normal size
1924 /// request, the margin will be added in addition to the size from
1925 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1926 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1927 Self {
1928 builder: self.builder.property("margin-bottom", margin_bottom),
1929 }
1930 }
1931
1932 /// Margin on end of widget, horizontally. This property supports
1933 /// left-to-right and right-to-left text directions.
1934 ///
1935 /// This property adds margin outside of the widget's normal size
1936 /// request, the margin will be added in addition to the size from
1937 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1938 pub fn margin_end(self, margin_end: i32) -> Self {
1939 Self {
1940 builder: self.builder.property("margin-end", margin_end),
1941 }
1942 }
1943
1944 /// Margin on start of widget, horizontally. This property supports
1945 /// left-to-right and right-to-left text directions.
1946 ///
1947 /// This property adds margin outside of the widget's normal size
1948 /// request, the margin will be added in addition to the size from
1949 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1950 pub fn margin_start(self, margin_start: i32) -> Self {
1951 Self {
1952 builder: self.builder.property("margin-start", margin_start),
1953 }
1954 }
1955
1956 /// Margin on top side of widget.
1957 ///
1958 /// This property adds margin outside of the widget's normal size
1959 /// request, the margin will be added in addition to the size from
1960 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1961 pub fn margin_top(self, margin_top: i32) -> Self {
1962 Self {
1963 builder: self.builder.property("margin-top", margin_top),
1964 }
1965 }
1966
1967 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1968 Self {
1969 builder: self.builder.property("name", name.into()),
1970 }
1971 }
1972
1973 pub fn no_show_all(self, no_show_all: bool) -> Self {
1974 Self {
1975 builder: self.builder.property("no-show-all", no_show_all),
1976 }
1977 }
1978
1979 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1980 /// more details about window opacity.
1981 ///
1982 /// Before 3.8 this was only available in GtkWindow
1983 pub fn opacity(self, opacity: f64) -> Self {
1984 Self {
1985 builder: self.builder.property("opacity", opacity),
1986 }
1987 }
1988
1989 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1990 Self {
1991 builder: self.builder.property("parent", parent.clone().upcast()),
1992 }
1993 }
1994
1995 pub fn receives_default(self, receives_default: bool) -> Self {
1996 Self {
1997 builder: self.builder.property("receives-default", receives_default),
1998 }
1999 }
2000
2001 pub fn sensitive(self, sensitive: bool) -> Self {
2002 Self {
2003 builder: self.builder.property("sensitive", sensitive),
2004 }
2005 }
2006
2007 /// Sets the text of tooltip to be the given string, which is marked up
2008 /// with the [Pango text markup language][PangoMarkupFormat].
2009 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
2010 ///
2011 /// This is a convenience property which will take care of getting the
2012 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
2013 /// will automatically be set to [`true`] and there will be taken care of
2014 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
2015 ///
2016 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
2017 /// are set, the last one wins.
2018 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2019 Self {
2020 builder: self
2021 .builder
2022 .property("tooltip-markup", tooltip_markup.into()),
2023 }
2024 }
2025
2026 /// Sets the text of tooltip to be the given string.
2027 ///
2028 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2029 ///
2030 /// This is a convenience property which will take care of getting the
2031 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
2032 /// will automatically be set to [`true`] and there will be taken care of
2033 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
2034 ///
2035 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
2036 /// are set, the last one wins.
2037 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2038 Self {
2039 builder: self.builder.property("tooltip-text", tooltip_text.into()),
2040 }
2041 }
2042
2043 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
2044 pub fn valign(self, valign: Align) -> Self {
2045 Self {
2046 builder: self.builder.property("valign", valign),
2047 }
2048 }
2049
2050 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
2051 pub fn vexpand(self, vexpand: bool) -> Self {
2052 Self {
2053 builder: self.builder.property("vexpand", vexpand),
2054 }
2055 }
2056
2057 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
2058 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2059 Self {
2060 builder: self.builder.property("vexpand-set", vexpand_set),
2061 }
2062 }
2063
2064 pub fn visible(self, visible: bool) -> Self {
2065 Self {
2066 builder: self.builder.property("visible", visible),
2067 }
2068 }
2069
2070 pub fn width_request(self, width_request: i32) -> Self {
2071 Self {
2072 builder: self.builder.property("width-request", width_request),
2073 }
2074 }
2075
2076 // rustdoc-stripper-ignore-next
2077 /// Build the [`Label`].
2078 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2079 pub fn build(self) -> Label {
2080 self.builder.build()
2081 }
2082}
2083
2084mod sealed {
2085 pub trait Sealed {}
2086 impl<T: super::IsA<super::Label>> Sealed for T {}
2087}
2088
2089/// Trait containing all [`struct@Label`] methods.
2090///
2091/// # Implementors
2092///
2093/// [`AccelLabel`][struct@crate::AccelLabel], [`Label`][struct@crate::Label]
2094pub trait LabelExt: IsA<Label> + sealed::Sealed + 'static {
2095 /// Gets the angle of rotation for the label. See
2096 /// [`set_angle()`][Self::set_angle()].
2097 ///
2098 /// # Returns
2099 ///
2100 /// the angle of rotation for the label
2101 #[doc(alias = "gtk_label_get_angle")]
2102 #[doc(alias = "get_angle")]
2103 fn angle(&self) -> f64 {
2104 unsafe { ffi::gtk_label_get_angle(self.as_ref().to_glib_none().0) }
2105 }
2106
2107 /// Gets the attribute list that was set on the label using
2108 /// [`set_attributes()`][Self::set_attributes()], if any. This function does
2109 /// not reflect attributes that come from the labels markup
2110 /// (see [`set_markup()`][Self::set_markup()]). If you want to get the
2111 /// effective attributes for the label, use
2112 /// pango_layout_get_attribute (gtk_label_get_layout (label)).
2113 ///
2114 /// # Returns
2115 ///
2116 /// the attribute list, or [`None`]
2117 /// if none was set.
2118 #[doc(alias = "gtk_label_get_attributes")]
2119 #[doc(alias = "get_attributes")]
2120 fn attributes(&self) -> Option<pango::AttrList> {
2121 unsafe {
2122 from_glib_none(ffi::gtk_label_get_attributes(
2123 self.as_ref().to_glib_none().0,
2124 ))
2125 }
2126 }
2127
2128 /// Returns the URI for the currently active link in the label.
2129 /// The active link is the one under the mouse pointer or, in a
2130 /// selectable label, the link in which the text cursor is currently
2131 /// positioned.
2132 ///
2133 /// This function is intended for use in a [`activate-link`][struct@crate::Label#activate-link] handler
2134 /// or for use in a [`query-tooltip`][struct@crate::Widget#query-tooltip] handler.
2135 ///
2136 /// # Returns
2137 ///
2138 /// the currently active URI. The string is owned by GTK+ and must
2139 /// not be freed or modified.
2140 #[doc(alias = "gtk_label_get_current_uri")]
2141 #[doc(alias = "get_current_uri")]
2142 fn current_uri(&self) -> Option<glib::GString> {
2143 unsafe {
2144 from_glib_none(ffi::gtk_label_get_current_uri(
2145 self.as_ref().to_glib_none().0,
2146 ))
2147 }
2148 }
2149
2150 /// Returns the ellipsizing position of the label. See [`set_ellipsize()`][Self::set_ellipsize()].
2151 ///
2152 /// # Returns
2153 ///
2154 /// [`pango::EllipsizeMode`][crate::pango::EllipsizeMode]
2155 #[doc(alias = "gtk_label_get_ellipsize")]
2156 #[doc(alias = "get_ellipsize")]
2157 fn ellipsize(&self) -> pango::EllipsizeMode {
2158 unsafe { from_glib(ffi::gtk_label_get_ellipsize(self.as_ref().to_glib_none().0)) }
2159 }
2160
2161 /// Returns the justification of the label. See [`set_justify()`][Self::set_justify()].
2162 ///
2163 /// # Returns
2164 ///
2165 /// [`Justification`][crate::Justification]
2166 #[doc(alias = "gtk_label_get_justify")]
2167 #[doc(alias = "get_justify")]
2168 fn justify(&self) -> Justification {
2169 unsafe { from_glib(ffi::gtk_label_get_justify(self.as_ref().to_glib_none().0)) }
2170 }
2171
2172 /// Fetches the text from a label widget including any embedded
2173 /// underlines indicating mnemonics and Pango markup. (See
2174 /// [`text()`][Self::text()]).
2175 ///
2176 /// # Returns
2177 ///
2178 /// the text of the label widget. This string is
2179 /// owned by the widget and must not be modified or freed.
2180 #[doc(alias = "gtk_label_get_label")]
2181 #[doc(alias = "get_label")]
2182 fn label(&self) -> glib::GString {
2183 unsafe { from_glib_none(ffi::gtk_label_get_label(self.as_ref().to_glib_none().0)) }
2184 }
2185
2186 /// Gets the [`pango::Layout`][crate::pango::Layout] used to display the label.
2187 /// The layout is useful to e.g. convert text positions to
2188 /// pixel positions, in combination with [`layout_offsets()`][Self::layout_offsets()].
2189 /// The returned layout is owned by the `self` so need not be
2190 /// freed by the caller. The `self` is free to recreate its layout at
2191 /// any time, so it should be considered read-only.
2192 ///
2193 /// # Returns
2194 ///
2195 /// the [`pango::Layout`][crate::pango::Layout] for this label
2196 #[doc(alias = "gtk_label_get_layout")]
2197 #[doc(alias = "get_layout")]
2198 fn layout(&self) -> Option<pango::Layout> {
2199 unsafe { from_glib_none(ffi::gtk_label_get_layout(self.as_ref().to_glib_none().0)) }
2200 }
2201
2202 /// Obtains the coordinates where the label will draw the [`pango::Layout`][crate::pango::Layout]
2203 /// representing the text in the label; useful to convert mouse events
2204 /// into coordinates inside the [`pango::Layout`][crate::pango::Layout], e.g. to take some action
2205 /// if some part of the label is clicked. Of course you will need to
2206 /// create a [`EventBox`][crate::EventBox] to receive the events, and pack the label
2207 /// inside it, since labels are windowless (they return [`false`] from
2208 /// [`WidgetExt::has_window()`][crate::prelude::WidgetExt::has_window()]). Remember
2209 /// when using the [`pango::Layout`][crate::pango::Layout] functions you need to convert to
2210 /// and from pixels using PANGO_PIXELS() or `PANGO_SCALE`.
2211 ///
2212 /// # Returns
2213 ///
2214 ///
2215 /// ## `x`
2216 /// location to store X offset of layout, or [`None`]
2217 ///
2218 /// ## `y`
2219 /// location to store Y offset of layout, or [`None`]
2220 #[doc(alias = "gtk_label_get_layout_offsets")]
2221 #[doc(alias = "get_layout_offsets")]
2222 fn layout_offsets(&self) -> (i32, i32) {
2223 unsafe {
2224 let mut x = mem::MaybeUninit::uninit();
2225 let mut y = mem::MaybeUninit::uninit();
2226 ffi::gtk_label_get_layout_offsets(
2227 self.as_ref().to_glib_none().0,
2228 x.as_mut_ptr(),
2229 y.as_mut_ptr(),
2230 );
2231 (x.assume_init(), y.assume_init())
2232 }
2233 }
2234
2235 /// Returns whether lines in the label are automatically wrapped.
2236 /// See [`set_line_wrap()`][Self::set_line_wrap()].
2237 ///
2238 /// # Returns
2239 ///
2240 /// [`true`] if the lines of the label are automatically wrapped.
2241 #[doc(alias = "gtk_label_get_line_wrap")]
2242 #[doc(alias = "get_line_wrap")]
2243 fn is_line_wrap(&self) -> bool {
2244 unsafe { from_glib(ffi::gtk_label_get_line_wrap(self.as_ref().to_glib_none().0)) }
2245 }
2246
2247 /// Returns line wrap mode used by the label. See [`set_line_wrap_mode()`][Self::set_line_wrap_mode()].
2248 ///
2249 /// # Returns
2250 ///
2251 /// [`true`] if the lines of the label are automatically wrapped.
2252 #[doc(alias = "gtk_label_get_line_wrap_mode")]
2253 #[doc(alias = "get_line_wrap_mode")]
2254 fn line_wrap_mode(&self) -> pango::WrapMode {
2255 unsafe {
2256 from_glib(ffi::gtk_label_get_line_wrap_mode(
2257 self.as_ref().to_glib_none().0,
2258 ))
2259 }
2260 }
2261
2262 /// Gets the number of lines to which an ellipsized, wrapping
2263 /// label should be limited. See [`set_lines()`][Self::set_lines()].
2264 ///
2265 /// # Returns
2266 ///
2267 /// The number of lines
2268 #[doc(alias = "gtk_label_get_lines")]
2269 #[doc(alias = "get_lines")]
2270 fn lines(&self) -> i32 {
2271 unsafe { ffi::gtk_label_get_lines(self.as_ref().to_glib_none().0) }
2272 }
2273
2274 /// Retrieves the desired maximum width of `self`, in characters. See
2275 /// [`set_width_chars()`][Self::set_width_chars()].
2276 ///
2277 /// # Returns
2278 ///
2279 /// the maximum width of the label in characters.
2280 #[doc(alias = "gtk_label_get_max_width_chars")]
2281 #[doc(alias = "get_max_width_chars")]
2282 fn max_width_chars(&self) -> i32 {
2283 unsafe { ffi::gtk_label_get_max_width_chars(self.as_ref().to_glib_none().0) }
2284 }
2285
2286 /// If the label has been set so that it has an mnemonic key this function
2287 /// returns the keyval used for the mnemonic accelerator. If there is no
2288 /// mnemonic set up it returns `GDK_KEY_VoidSymbol`.
2289 ///
2290 /// # Returns
2291 ///
2292 /// GDK keyval usable for accelerators, or `GDK_KEY_VoidSymbol`
2293 #[doc(alias = "gtk_label_get_mnemonic_keyval")]
2294 #[doc(alias = "get_mnemonic_keyval")]
2295 fn mnemonic_keyval(&self) -> u32 {
2296 unsafe { ffi::gtk_label_get_mnemonic_keyval(self.as_ref().to_glib_none().0) }
2297 }
2298
2299 /// Retrieves the target of the mnemonic (keyboard shortcut) of this
2300 /// label. See [`set_mnemonic_widget()`][Self::set_mnemonic_widget()].
2301 ///
2302 /// # Returns
2303 ///
2304 /// the target of the label’s mnemonic,
2305 /// or [`None`] if none has been set and the default algorithm will be used.
2306 #[doc(alias = "gtk_label_get_mnemonic_widget")]
2307 #[doc(alias = "get_mnemonic_widget")]
2308 fn mnemonic_widget(&self) -> Option<Widget> {
2309 unsafe {
2310 from_glib_none(ffi::gtk_label_get_mnemonic_widget(
2311 self.as_ref().to_glib_none().0,
2312 ))
2313 }
2314 }
2315
2316 /// Gets the value set by [`set_selectable()`][Self::set_selectable()].
2317 ///
2318 /// # Returns
2319 ///
2320 /// [`true`] if the user can copy text from the label
2321 #[doc(alias = "gtk_label_get_selectable")]
2322 #[doc(alias = "get_selectable")]
2323 fn is_selectable(&self) -> bool {
2324 unsafe {
2325 from_glib(ffi::gtk_label_get_selectable(
2326 self.as_ref().to_glib_none().0,
2327 ))
2328 }
2329 }
2330
2331 /// Gets the selected range of characters in the label, returning [`true`]
2332 /// if there’s a selection.
2333 ///
2334 /// # Returns
2335 ///
2336 /// [`true`] if selection is non-empty
2337 ///
2338 /// ## `start`
2339 /// return location for start of selection, as a character offset
2340 ///
2341 /// ## `end`
2342 /// return location for end of selection, as a character offset
2343 #[doc(alias = "gtk_label_get_selection_bounds")]
2344 #[doc(alias = "get_selection_bounds")]
2345 fn selection_bounds(&self) -> Option<(i32, i32)> {
2346 unsafe {
2347 let mut start = mem::MaybeUninit::uninit();
2348 let mut end = mem::MaybeUninit::uninit();
2349 let ret = from_glib(ffi::gtk_label_get_selection_bounds(
2350 self.as_ref().to_glib_none().0,
2351 start.as_mut_ptr(),
2352 end.as_mut_ptr(),
2353 ));
2354 if ret {
2355 Some((start.assume_init(), end.assume_init()))
2356 } else {
2357 None
2358 }
2359 }
2360 }
2361
2362 /// Returns whether the label is in single line mode.
2363 ///
2364 /// # Returns
2365 ///
2366 /// [`true`] when the label is in single line mode.
2367 #[doc(alias = "gtk_label_get_single_line_mode")]
2368 #[doc(alias = "get_single_line_mode")]
2369 fn is_single_line_mode(&self) -> bool {
2370 unsafe {
2371 from_glib(ffi::gtk_label_get_single_line_mode(
2372 self.as_ref().to_glib_none().0,
2373 ))
2374 }
2375 }
2376
2377 /// Fetches the text from a label widget, as displayed on the
2378 /// screen. This does not include any embedded underlines
2379 /// indicating mnemonics or Pango markup. (See [`label()`][Self::label()])
2380 ///
2381 /// # Returns
2382 ///
2383 /// the text in the label widget. This is the internal
2384 /// string used by the label, and must not be modified.
2385 #[doc(alias = "gtk_label_get_text")]
2386 #[doc(alias = "get_text")]
2387 fn text(&self) -> glib::GString {
2388 unsafe { from_glib_none(ffi::gtk_label_get_text(self.as_ref().to_glib_none().0)) }
2389 }
2390
2391 /// Returns whether the label is currently keeping track
2392 /// of clicked links.
2393 ///
2394 /// # Returns
2395 ///
2396 /// [`true`] if clicked links are remembered
2397 #[doc(alias = "gtk_label_get_track_visited_links")]
2398 #[doc(alias = "get_track_visited_links")]
2399 fn tracks_visited_links(&self) -> bool {
2400 unsafe {
2401 from_glib(ffi::gtk_label_get_track_visited_links(
2402 self.as_ref().to_glib_none().0,
2403 ))
2404 }
2405 }
2406
2407 /// Returns whether the label’s text is interpreted as marked up with
2408 /// the [Pango text markup language][PangoMarkupFormat].
2409 /// See gtk_label_set_use_markup ().
2410 ///
2411 /// # Returns
2412 ///
2413 /// [`true`] if the label’s text will be parsed for markup.
2414 #[doc(alias = "gtk_label_get_use_markup")]
2415 #[doc(alias = "get_use_markup")]
2416 fn uses_markup(&self) -> bool {
2417 unsafe {
2418 from_glib(ffi::gtk_label_get_use_markup(
2419 self.as_ref().to_glib_none().0,
2420 ))
2421 }
2422 }
2423
2424 /// Returns whether an embedded underline in the label indicates a
2425 /// mnemonic. See [`set_use_underline()`][Self::set_use_underline()].
2426 ///
2427 /// # Returns
2428 ///
2429 /// [`true`] whether an embedded underline in the label indicates
2430 /// the mnemonic accelerator keys.
2431 #[doc(alias = "gtk_label_get_use_underline")]
2432 #[doc(alias = "get_use_underline")]
2433 fn uses_underline(&self) -> bool {
2434 unsafe {
2435 from_glib(ffi::gtk_label_get_use_underline(
2436 self.as_ref().to_glib_none().0,
2437 ))
2438 }
2439 }
2440
2441 /// Retrieves the desired width of `self`, in characters. See
2442 /// [`set_width_chars()`][Self::set_width_chars()].
2443 ///
2444 /// # Returns
2445 ///
2446 /// the width of the label in characters.
2447 #[doc(alias = "gtk_label_get_width_chars")]
2448 #[doc(alias = "get_width_chars")]
2449 fn width_chars(&self) -> i32 {
2450 unsafe { ffi::gtk_label_get_width_chars(self.as_ref().to_glib_none().0) }
2451 }
2452
2453 /// Gets the [`xalign`][struct@crate::Label#xalign] property for `self`.
2454 ///
2455 /// # Returns
2456 ///
2457 /// the xalign property
2458 #[doc(alias = "gtk_label_get_xalign")]
2459 #[doc(alias = "get_xalign")]
2460 fn xalign(&self) -> f32 {
2461 unsafe { ffi::gtk_label_get_xalign(self.as_ref().to_glib_none().0) }
2462 }
2463
2464 /// Gets the [`yalign`][struct@crate::Label#yalign] property for `self`.
2465 ///
2466 /// # Returns
2467 ///
2468 /// the yalign property
2469 #[doc(alias = "gtk_label_get_yalign")]
2470 #[doc(alias = "get_yalign")]
2471 fn yalign(&self) -> f32 {
2472 unsafe { ffi::gtk_label_get_yalign(self.as_ref().to_glib_none().0) }
2473 }
2474
2475 /// Selects a range of characters in the label, if the label is selectable.
2476 /// See [`set_selectable()`][Self::set_selectable()]. If the label is not selectable,
2477 /// this function has no effect. If `start_offset` or
2478 /// `end_offset` are -1, then the end of the label will be substituted.
2479 /// ## `start_offset`
2480 /// start offset (in characters not bytes)
2481 /// ## `end_offset`
2482 /// end offset (in characters not bytes)
2483 #[doc(alias = "gtk_label_select_region")]
2484 fn select_region(&self, start_offset: i32, end_offset: i32) {
2485 unsafe {
2486 ffi::gtk_label_select_region(self.as_ref().to_glib_none().0, start_offset, end_offset);
2487 }
2488 }
2489
2490 /// Sets the angle of rotation for the label. An angle of 90 reads from
2491 /// from bottom to top, an angle of 270, from top to bottom. The angle
2492 /// setting for the label is ignored if the label is selectable,
2493 /// wrapped, or ellipsized.
2494 /// ## `angle`
2495 /// the angle that the baseline of the label makes with
2496 /// the horizontal, in degrees, measured counterclockwise
2497 #[doc(alias = "gtk_label_set_angle")]
2498 fn set_angle(&self, angle: f64) {
2499 unsafe {
2500 ffi::gtk_label_set_angle(self.as_ref().to_glib_none().0, angle);
2501 }
2502 }
2503
2504 /// Sets a [`pango::AttrList`][crate::pango::AttrList]; the attributes in the list are applied to the
2505 /// label text.
2506 ///
2507 /// The attributes set with this function will be applied
2508 /// and merged with any other attributes previously effected by way
2509 /// of the [`use-underline`][struct@crate::Label#use-underline] or [`use-markup`][struct@crate::Label#use-markup] properties.
2510 /// While it is not recommended to mix markup strings with manually set
2511 /// attributes, if you must; know that the attributes will be applied
2512 /// to the label after the markup string is parsed.
2513 /// ## `attrs`
2514 /// a [`pango::AttrList`][crate::pango::AttrList], or [`None`]
2515 #[doc(alias = "gtk_label_set_attributes")]
2516 fn set_attributes(&self, attrs: Option<&pango::AttrList>) {
2517 unsafe {
2518 ffi::gtk_label_set_attributes(self.as_ref().to_glib_none().0, attrs.to_glib_none().0);
2519 }
2520 }
2521
2522 /// Sets the mode used to ellipsize (add an ellipsis: "...") to the text
2523 /// if there is not enough space to render the entire string.
2524 /// ## `mode`
2525 /// a [`pango::EllipsizeMode`][crate::pango::EllipsizeMode]
2526 #[doc(alias = "gtk_label_set_ellipsize")]
2527 fn set_ellipsize(&self, mode: pango::EllipsizeMode) {
2528 unsafe {
2529 ffi::gtk_label_set_ellipsize(self.as_ref().to_glib_none().0, mode.into_glib());
2530 }
2531 }
2532
2533 /// Sets the alignment of the lines in the text of the label relative to
2534 /// each other. [`Justification::Left`][crate::Justification::Left] is the default value when the widget is
2535 /// first created with [`Label::new()`][crate::Label::new()]. If you instead want to set the
2536 /// alignment of the label as a whole, use [`WidgetExt::set_halign()`][crate::prelude::WidgetExt::set_halign()] instead.
2537 /// [`set_justify()`][Self::set_justify()] has no effect on labels containing only a
2538 /// single line.
2539 /// ## `jtype`
2540 /// a [`Justification`][crate::Justification]
2541 #[doc(alias = "gtk_label_set_justify")]
2542 fn set_justify(&self, jtype: Justification) {
2543 unsafe {
2544 ffi::gtk_label_set_justify(self.as_ref().to_glib_none().0, jtype.into_glib());
2545 }
2546 }
2547
2548 /// Sets the text of the label. The label is interpreted as
2549 /// including embedded underlines and/or Pango markup depending
2550 /// on the values of the [`use-underline`][struct@crate::Label#use-underline] and
2551 /// [`use-markup`][struct@crate::Label#use-markup] properties.
2552 /// ## `str`
2553 /// the new text to set for the label
2554 #[doc(alias = "gtk_label_set_label")]
2555 fn set_label(&self, str: &str) {
2556 unsafe {
2557 ffi::gtk_label_set_label(self.as_ref().to_glib_none().0, str.to_glib_none().0);
2558 }
2559 }
2560
2561 /// Toggles line wrapping within the [`Label`][crate::Label] widget. [`true`] makes it break
2562 /// lines if text exceeds the widget’s size. [`false`] lets the text get cut off
2563 /// by the edge of the widget if it exceeds the widget size.
2564 ///
2565 /// Note that setting line wrapping to [`true`] does not make the label
2566 /// wrap at its parent container’s width, because GTK+ widgets
2567 /// conceptually can’t make their requisition depend on the parent
2568 /// container’s size. For a label that wraps at a specific position,
2569 /// set the label’s width using [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()].
2570 /// ## `wrap`
2571 /// the setting
2572 #[doc(alias = "gtk_label_set_line_wrap")]
2573 fn set_line_wrap(&self, wrap: bool) {
2574 unsafe {
2575 ffi::gtk_label_set_line_wrap(self.as_ref().to_glib_none().0, wrap.into_glib());
2576 }
2577 }
2578
2579 /// If line wrapping is on (see [`set_line_wrap()`][Self::set_line_wrap()]) this controls how
2580 /// the line wrapping is done. The default is [`pango::WrapMode::Word`][crate::pango::WrapMode::Word] which means
2581 /// wrap on word boundaries.
2582 /// ## `wrap_mode`
2583 /// the line wrapping mode
2584 #[doc(alias = "gtk_label_set_line_wrap_mode")]
2585 fn set_line_wrap_mode(&self, wrap_mode: pango::WrapMode) {
2586 unsafe {
2587 ffi::gtk_label_set_line_wrap_mode(
2588 self.as_ref().to_glib_none().0,
2589 wrap_mode.into_glib(),
2590 );
2591 }
2592 }
2593
2594 /// Sets the number of lines to which an ellipsized, wrapping label
2595 /// should be limited. This has no effect if the label is not wrapping
2596 /// or ellipsized. Set this to -1 if you don’t want to limit the
2597 /// number of lines.
2598 /// ## `lines`
2599 /// the desired number of lines, or -1
2600 #[doc(alias = "gtk_label_set_lines")]
2601 fn set_lines(&self, lines: i32) {
2602 unsafe {
2603 ffi::gtk_label_set_lines(self.as_ref().to_glib_none().0, lines);
2604 }
2605 }
2606
2607 /// Parses `str` which is marked up with the
2608 /// [Pango text markup language][PangoMarkupFormat], setting the
2609 /// label’s text and attribute list based on the parse results.
2610 ///
2611 /// If the `str` is external data, you may need to escape it with
2612 /// `g_markup_escape_text()` or `g_markup_printf_escaped()`:
2613 ///
2614 ///
2615 ///
2616 /// **⚠️ The following code is in C ⚠️**
2617 ///
2618 /// ```C
2619 /// GtkWidget *label = gtk_label_new (NULL);
2620 /// const char *str = "some text";
2621 /// const char *format = "<span style=\"italic\">\%s</span>";
2622 /// char *markup;
2623 ///
2624 /// markup = g_markup_printf_escaped (format, str);
2625 /// gtk_label_set_markup (GTK_LABEL (label), markup);
2626 /// g_free (markup);
2627 /// ```
2628 ///
2629 /// This function will set the [`use-markup`][struct@crate::Label#use-markup] property to [`true`] as
2630 /// a side effect.
2631 ///
2632 /// If you set the label contents using the [`label`][struct@crate::Label#label] property you
2633 /// should also ensure that you set the [`use-markup`][struct@crate::Label#use-markup] property
2634 /// accordingly.
2635 ///
2636 /// See also: [`set_text()`][Self::set_text()]
2637 /// ## `str`
2638 /// a markup string (see [Pango markup format][PangoMarkupFormat])
2639 #[doc(alias = "gtk_label_set_markup")]
2640 fn set_markup(&self, str: &str) {
2641 unsafe {
2642 ffi::gtk_label_set_markup(self.as_ref().to_glib_none().0, str.to_glib_none().0);
2643 }
2644 }
2645
2646 /// Parses `str` which is marked up with the
2647 /// [Pango text markup language][PangoMarkupFormat],
2648 /// setting the label’s text and attribute list based on the parse results.
2649 /// If characters in `str` are preceded by an underscore, they are underlined
2650 /// indicating that they represent a keyboard accelerator called a mnemonic.
2651 ///
2652 /// The mnemonic key can be used to activate another widget, chosen
2653 /// automatically, or explicitly using [`set_mnemonic_widget()`][Self::set_mnemonic_widget()].
2654 /// ## `str`
2655 /// a markup string (see
2656 /// [Pango markup format][PangoMarkupFormat])
2657 #[doc(alias = "gtk_label_set_markup_with_mnemonic")]
2658 fn set_markup_with_mnemonic(&self, str: &str) {
2659 unsafe {
2660 ffi::gtk_label_set_markup_with_mnemonic(
2661 self.as_ref().to_glib_none().0,
2662 str.to_glib_none().0,
2663 );
2664 }
2665 }
2666
2667 /// Sets the desired maximum width in characters of `self` to `n_chars`.
2668 /// ## `n_chars`
2669 /// the new desired maximum width, in characters.
2670 #[doc(alias = "gtk_label_set_max_width_chars")]
2671 fn set_max_width_chars(&self, n_chars: i32) {
2672 unsafe {
2673 ffi::gtk_label_set_max_width_chars(self.as_ref().to_glib_none().0, n_chars);
2674 }
2675 }
2676
2677 /// If the label has been set so that it has an mnemonic key (using
2678 /// i.e. [`set_markup_with_mnemonic()`][Self::set_markup_with_mnemonic()],
2679 /// [`set_text_with_mnemonic()`][Self::set_text_with_mnemonic()], [`Label::with_mnemonic()`][crate::Label::with_mnemonic()]
2680 /// or the “use_underline” property) the label can be associated with a
2681 /// widget that is the target of the mnemonic. When the label is inside
2682 /// a widget (like a [`Button`][crate::Button] or a [`Notebook`][crate::Notebook] tab) it is
2683 /// automatically associated with the correct widget, but sometimes
2684 /// (i.e. when the target is a [`Entry`][crate::Entry] next to the label) you need to
2685 /// set it explicitly using this function.
2686 ///
2687 /// The target widget will be accelerated by emitting the
2688 /// GtkWidget::mnemonic-activate signal on it. The default handler for
2689 /// this signal will activate the widget if there are no mnemonic collisions
2690 /// and toggle focus between the colliding widgets otherwise.
2691 /// ## `widget`
2692 /// the target [`Widget`][crate::Widget], or [`None`] to unset
2693 #[doc(alias = "gtk_label_set_mnemonic_widget")]
2694 fn set_mnemonic_widget(&self, widget: Option<&impl IsA<Widget>>) {
2695 unsafe {
2696 ffi::gtk_label_set_mnemonic_widget(
2697 self.as_ref().to_glib_none().0,
2698 widget.map(|p| p.as_ref()).to_glib_none().0,
2699 );
2700 }
2701 }
2702
2703 /// The pattern of underlines you want under the existing text within the
2704 /// [`Label`][crate::Label] widget. For example if the current text of the label says
2705 /// “FooBarBaz” passing a pattern of “___ ___” will underline
2706 /// “Foo” and “Baz” but not “Bar”.
2707 /// ## `pattern`
2708 /// The pattern as described above.
2709 #[doc(alias = "gtk_label_set_pattern")]
2710 fn set_pattern(&self, pattern: &str) {
2711 unsafe {
2712 ffi::gtk_label_set_pattern(self.as_ref().to_glib_none().0, pattern.to_glib_none().0);
2713 }
2714 }
2715
2716 /// Selectable labels allow the user to select text from the label, for
2717 /// copy-and-paste.
2718 /// ## `setting`
2719 /// [`true`] to allow selecting text in the label
2720 #[doc(alias = "gtk_label_set_selectable")]
2721 fn set_selectable(&self, setting: bool) {
2722 unsafe {
2723 ffi::gtk_label_set_selectable(self.as_ref().to_glib_none().0, setting.into_glib());
2724 }
2725 }
2726
2727 /// Sets whether the label is in single line mode.
2728 /// ## `single_line_mode`
2729 /// [`true`] if the label should be in single line mode
2730 #[doc(alias = "gtk_label_set_single_line_mode")]
2731 fn set_single_line_mode(&self, single_line_mode: bool) {
2732 unsafe {
2733 ffi::gtk_label_set_single_line_mode(
2734 self.as_ref().to_glib_none().0,
2735 single_line_mode.into_glib(),
2736 );
2737 }
2738 }
2739
2740 /// Sets the text within the [`Label`][crate::Label] widget. It overwrites any text that
2741 /// was there before.
2742 ///
2743 /// This function will clear any previously set mnemonic accelerators, and
2744 /// set the [`use-underline`][struct@crate::Label#use-underline] property to [`false`] as a side effect.
2745 ///
2746 /// This function will set the [`use-markup`][struct@crate::Label#use-markup] property to [`false`]
2747 /// as a side effect.
2748 ///
2749 /// See also: [`set_markup()`][Self::set_markup()]
2750 /// ## `str`
2751 /// The text you want to set
2752 #[doc(alias = "gtk_label_set_text")]
2753 fn set_text(&self, str: &str) {
2754 unsafe {
2755 ffi::gtk_label_set_text(self.as_ref().to_glib_none().0, str.to_glib_none().0);
2756 }
2757 }
2758
2759 /// Sets the label’s text from the string `str`.
2760 /// If characters in `str` are preceded by an underscore, they are underlined
2761 /// indicating that they represent a keyboard accelerator called a mnemonic.
2762 /// The mnemonic key can be used to activate another widget, chosen
2763 /// automatically, or explicitly using [`set_mnemonic_widget()`][Self::set_mnemonic_widget()].
2764 /// ## `str`
2765 /// a string
2766 #[doc(alias = "gtk_label_set_text_with_mnemonic")]
2767 fn set_text_with_mnemonic(&self, str: &str) {
2768 unsafe {
2769 ffi::gtk_label_set_text_with_mnemonic(
2770 self.as_ref().to_glib_none().0,
2771 str.to_glib_none().0,
2772 );
2773 }
2774 }
2775
2776 /// Sets whether the label should keep track of clicked
2777 /// links (and use a different color for them).
2778 /// ## `track_links`
2779 /// [`true`] to track visited links
2780 #[doc(alias = "gtk_label_set_track_visited_links")]
2781 fn set_track_visited_links(&self, track_links: bool) {
2782 unsafe {
2783 ffi::gtk_label_set_track_visited_links(
2784 self.as_ref().to_glib_none().0,
2785 track_links.into_glib(),
2786 );
2787 }
2788 }
2789
2790 /// Sets whether the text of the label contains markup in
2791 /// [Pango’s text markup language][PangoMarkupFormat].
2792 /// See [`set_markup()`][Self::set_markup()].
2793 /// ## `setting`
2794 /// [`true`] if the label’s text should be parsed for markup.
2795 #[doc(alias = "gtk_label_set_use_markup")]
2796 fn set_use_markup(&self, setting: bool) {
2797 unsafe {
2798 ffi::gtk_label_set_use_markup(self.as_ref().to_glib_none().0, setting.into_glib());
2799 }
2800 }
2801
2802 /// If true, an underline in the text indicates the next character should be
2803 /// used for the mnemonic accelerator key.
2804 /// ## `setting`
2805 /// [`true`] if underlines in the text indicate mnemonics
2806 #[doc(alias = "gtk_label_set_use_underline")]
2807 fn set_use_underline(&self, setting: bool) {
2808 unsafe {
2809 ffi::gtk_label_set_use_underline(self.as_ref().to_glib_none().0, setting.into_glib());
2810 }
2811 }
2812
2813 /// Sets the desired width in characters of `self` to `n_chars`.
2814 /// ## `n_chars`
2815 /// the new desired width, in characters.
2816 #[doc(alias = "gtk_label_set_width_chars")]
2817 fn set_width_chars(&self, n_chars: i32) {
2818 unsafe {
2819 ffi::gtk_label_set_width_chars(self.as_ref().to_glib_none().0, n_chars);
2820 }
2821 }
2822
2823 /// Sets the [`xalign`][struct@crate::Label#xalign] property for `self`.
2824 /// ## `xalign`
2825 /// the new xalign value, between 0 and 1
2826 #[doc(alias = "gtk_label_set_xalign")]
2827 fn set_xalign(&self, xalign: f32) {
2828 unsafe {
2829 ffi::gtk_label_set_xalign(self.as_ref().to_glib_none().0, xalign);
2830 }
2831 }
2832
2833 /// Sets the [`yalign`][struct@crate::Label#yalign] property for `self`.
2834 /// ## `yalign`
2835 /// the new yalign value, between 0 and 1
2836 #[doc(alias = "gtk_label_set_yalign")]
2837 fn set_yalign(&self, yalign: f32) {
2838 unsafe {
2839 ffi::gtk_label_set_yalign(self.as_ref().to_glib_none().0, yalign);
2840 }
2841 }
2842
2843 #[doc(alias = "cursor-position")]
2844 fn cursor_position(&self) -> i32 {
2845 ObjectExt::property(self.as_ref(), "cursor-position")
2846 }
2847
2848 #[doc(alias = "selection-bound")]
2849 fn selection_bound(&self) -> i32 {
2850 ObjectExt::property(self.as_ref(), "selection-bound")
2851 }
2852
2853 fn wraps(&self) -> bool {
2854 ObjectExt::property(self.as_ref(), "wrap")
2855 }
2856
2857 fn set_wrap(&self, wrap: bool) {
2858 ObjectExt::set_property(self.as_ref(), "wrap", wrap)
2859 }
2860
2861 /// If line wrapping is on (see the [`wrap`][struct@crate::Label#wrap] property) this controls
2862 /// how the line wrapping is done. The default is [`pango::WrapMode::Word`][crate::pango::WrapMode::Word], which
2863 /// means wrap on word boundaries.
2864 #[doc(alias = "wrap-mode")]
2865 fn wrap_mode(&self) -> pango::WrapMode {
2866 ObjectExt::property(self.as_ref(), "wrap-mode")
2867 }
2868
2869 /// If line wrapping is on (see the [`wrap`][struct@crate::Label#wrap] property) this controls
2870 /// how the line wrapping is done. The default is [`pango::WrapMode::Word`][crate::pango::WrapMode::Word], which
2871 /// means wrap on word boundaries.
2872 #[doc(alias = "wrap-mode")]
2873 fn set_wrap_mode(&self, wrap_mode: pango::WrapMode) {
2874 ObjectExt::set_property(self.as_ref(), "wrap-mode", wrap_mode)
2875 }
2876
2877 /// A [keybinding signal][GtkBindingSignal]
2878 /// which gets emitted when the user activates a link in the label.
2879 ///
2880 /// Applications may also emit the signal with `g_signal_emit_by_name()`
2881 /// if they need to control activation of URIs programmatically.
2882 ///
2883 /// The default bindings for this signal are all forms of the Enter key.
2884 #[doc(alias = "activate-current-link")]
2885 fn connect_activate_current_link<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2886 unsafe extern "C" fn activate_current_link_trampoline<
2887 P: IsA<Label>,
2888 F: Fn(&P) + 'static,
2889 >(
2890 this: *mut ffi::GtkLabel,
2891 f: glib::ffi::gpointer,
2892 ) {
2893 let f: &F = &*(f as *const F);
2894 f(Label::from_glib_borrow(this).unsafe_cast_ref())
2895 }
2896 unsafe {
2897 let f: Box_<F> = Box_::new(f);
2898 connect_raw(
2899 self.as_ptr() as *mut _,
2900 b"activate-current-link\0".as_ptr() as *const _,
2901 Some(transmute::<_, unsafe extern "C" fn()>(
2902 activate_current_link_trampoline::<Self, F> as *const (),
2903 )),
2904 Box_::into_raw(f),
2905 )
2906 }
2907 }
2908
2909 fn emit_activate_current_link(&self) {
2910 self.emit_by_name::<()>("activate-current-link", &[]);
2911 }
2912
2913 /// The signal which gets emitted to activate a URI.
2914 /// Applications may connect to it to override the default behaviour,
2915 /// which is to call [`show_uri_on_window()`][crate::show_uri_on_window()].
2916 /// ## `uri`
2917 /// the URI that is activated
2918 ///
2919 /// # Returns
2920 ///
2921 /// [`true`] if the link has been activated
2922 #[doc(alias = "activate-link")]
2923 fn connect_activate_link<F: Fn(&Self, &str) -> glib::Propagation + 'static>(
2924 &self,
2925 f: F,
2926 ) -> SignalHandlerId {
2927 unsafe extern "C" fn activate_link_trampoline<
2928 P: IsA<Label>,
2929 F: Fn(&P, &str) -> glib::Propagation + 'static,
2930 >(
2931 this: *mut ffi::GtkLabel,
2932 uri: *mut libc::c_char,
2933 f: glib::ffi::gpointer,
2934 ) -> glib::ffi::gboolean {
2935 let f: &F = &*(f as *const F);
2936 f(
2937 Label::from_glib_borrow(this).unsafe_cast_ref(),
2938 &glib::GString::from_glib_borrow(uri),
2939 )
2940 .into_glib()
2941 }
2942 unsafe {
2943 let f: Box_<F> = Box_::new(f);
2944 connect_raw(
2945 self.as_ptr() as *mut _,
2946 b"activate-link\0".as_ptr() as *const _,
2947 Some(transmute::<_, unsafe extern "C" fn()>(
2948 activate_link_trampoline::<Self, F> as *const (),
2949 )),
2950 Box_::into_raw(f),
2951 )
2952 }
2953 }
2954
2955 /// The ::copy-clipboard signal is a
2956 /// [keybinding signal][GtkBindingSignal]
2957 /// which gets emitted to copy the selection to the clipboard.
2958 ///
2959 /// The default binding for this signal is Ctrl-c.
2960 #[doc(alias = "copy-clipboard")]
2961 fn connect_copy_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2962 unsafe extern "C" fn copy_clipboard_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
2963 this: *mut ffi::GtkLabel,
2964 f: glib::ffi::gpointer,
2965 ) {
2966 let f: &F = &*(f as *const F);
2967 f(Label::from_glib_borrow(this).unsafe_cast_ref())
2968 }
2969 unsafe {
2970 let f: Box_<F> = Box_::new(f);
2971 connect_raw(
2972 self.as_ptr() as *mut _,
2973 b"copy-clipboard\0".as_ptr() as *const _,
2974 Some(transmute::<_, unsafe extern "C" fn()>(
2975 copy_clipboard_trampoline::<Self, F> as *const (),
2976 )),
2977 Box_::into_raw(f),
2978 )
2979 }
2980 }
2981
2982 fn emit_copy_clipboard(&self) {
2983 self.emit_by_name::<()>("copy-clipboard", &[]);
2984 }
2985
2986 /// The ::move-cursor signal is a
2987 /// [keybinding signal][GtkBindingSignal]
2988 /// which gets emitted when the user initiates a cursor movement.
2989 /// If the cursor is not visible in `entry`, this signal causes
2990 /// the viewport to be moved instead.
2991 ///
2992 /// Applications should not connect to it, but may emit it with
2993 /// `g_signal_emit_by_name()` if they need to control the cursor
2994 /// programmatically.
2995 ///
2996 /// The default bindings for this signal come in two variants,
2997 /// the variant with the Shift modifier extends the selection,
2998 /// the variant without the Shift modifer does not.
2999 /// There are too many key combinations to list them all here.
3000 /// - Arrow keys move by individual characters/lines
3001 /// - Ctrl-arrow key combinations move by words/paragraphs
3002 /// - Home/End keys move to the ends of the buffer
3003 /// ## `step`
3004 /// the granularity of the move, as a [`MovementStep`][crate::MovementStep]
3005 /// ## `count`
3006 /// the number of `step` units to move
3007 /// ## `extend_selection`
3008 /// [`true`] if the move should extend the selection
3009 #[doc(alias = "move-cursor")]
3010 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
3011 &self,
3012 f: F,
3013 ) -> SignalHandlerId {
3014 unsafe extern "C" fn move_cursor_trampoline<
3015 P: IsA<Label>,
3016 F: Fn(&P, MovementStep, i32, bool) + 'static,
3017 >(
3018 this: *mut ffi::GtkLabel,
3019 step: ffi::GtkMovementStep,
3020 count: libc::c_int,
3021 extend_selection: glib::ffi::gboolean,
3022 f: glib::ffi::gpointer,
3023 ) {
3024 let f: &F = &*(f as *const F);
3025 f(
3026 Label::from_glib_borrow(this).unsafe_cast_ref(),
3027 from_glib(step),
3028 count,
3029 from_glib(extend_selection),
3030 )
3031 }
3032 unsafe {
3033 let f: Box_<F> = Box_::new(f);
3034 connect_raw(
3035 self.as_ptr() as *mut _,
3036 b"move-cursor\0".as_ptr() as *const _,
3037 Some(transmute::<_, unsafe extern "C" fn()>(
3038 move_cursor_trampoline::<Self, F> as *const (),
3039 )),
3040 Box_::into_raw(f),
3041 )
3042 }
3043 }
3044
3045 fn emit_move_cursor(&self, step: MovementStep, count: i32, extend_selection: bool) {
3046 self.emit_by_name::<()>("move-cursor", &[&step, &count, &extend_selection]);
3047 }
3048
3049 /// The ::populate-popup signal gets emitted before showing the
3050 /// context menu of the label. Note that only selectable labels
3051 /// have context menus.
3052 ///
3053 /// If you need to add items to the context menu, connect
3054 /// to this signal and append your menuitems to the `menu`.
3055 /// ## `menu`
3056 /// the menu that is being populated
3057 #[doc(alias = "populate-popup")]
3058 fn connect_populate_popup<F: Fn(&Self, &Menu) + 'static>(&self, f: F) -> SignalHandlerId {
3059 unsafe extern "C" fn populate_popup_trampoline<
3060 P: IsA<Label>,
3061 F: Fn(&P, &Menu) + 'static,
3062 >(
3063 this: *mut ffi::GtkLabel,
3064 menu: *mut ffi::GtkMenu,
3065 f: glib::ffi::gpointer,
3066 ) {
3067 let f: &F = &*(f as *const F);
3068 f(
3069 Label::from_glib_borrow(this).unsafe_cast_ref(),
3070 &from_glib_borrow(menu),
3071 )
3072 }
3073 unsafe {
3074 let f: Box_<F> = Box_::new(f);
3075 connect_raw(
3076 self.as_ptr() as *mut _,
3077 b"populate-popup\0".as_ptr() as *const _,
3078 Some(transmute::<_, unsafe extern "C" fn()>(
3079 populate_popup_trampoline::<Self, F> as *const (),
3080 )),
3081 Box_::into_raw(f),
3082 )
3083 }
3084 }
3085
3086 #[doc(alias = "angle")]
3087 fn connect_angle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3088 unsafe extern "C" fn notify_angle_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3089 this: *mut ffi::GtkLabel,
3090 _param_spec: glib::ffi::gpointer,
3091 f: glib::ffi::gpointer,
3092 ) {
3093 let f: &F = &*(f as *const F);
3094 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3095 }
3096 unsafe {
3097 let f: Box_<F> = Box_::new(f);
3098 connect_raw(
3099 self.as_ptr() as *mut _,
3100 b"notify::angle\0".as_ptr() as *const _,
3101 Some(transmute::<_, unsafe extern "C" fn()>(
3102 notify_angle_trampoline::<Self, F> as *const (),
3103 )),
3104 Box_::into_raw(f),
3105 )
3106 }
3107 }
3108
3109 #[doc(alias = "attributes")]
3110 fn connect_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3111 unsafe extern "C" fn notify_attributes_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3112 this: *mut ffi::GtkLabel,
3113 _param_spec: glib::ffi::gpointer,
3114 f: glib::ffi::gpointer,
3115 ) {
3116 let f: &F = &*(f as *const F);
3117 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3118 }
3119 unsafe {
3120 let f: Box_<F> = Box_::new(f);
3121 connect_raw(
3122 self.as_ptr() as *mut _,
3123 b"notify::attributes\0".as_ptr() as *const _,
3124 Some(transmute::<_, unsafe extern "C" fn()>(
3125 notify_attributes_trampoline::<Self, F> as *const (),
3126 )),
3127 Box_::into_raw(f),
3128 )
3129 }
3130 }
3131
3132 #[doc(alias = "cursor-position")]
3133 fn connect_cursor_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3134 unsafe extern "C" fn notify_cursor_position_trampoline<
3135 P: IsA<Label>,
3136 F: Fn(&P) + 'static,
3137 >(
3138 this: *mut ffi::GtkLabel,
3139 _param_spec: glib::ffi::gpointer,
3140 f: glib::ffi::gpointer,
3141 ) {
3142 let f: &F = &*(f as *const F);
3143 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3144 }
3145 unsafe {
3146 let f: Box_<F> = Box_::new(f);
3147 connect_raw(
3148 self.as_ptr() as *mut _,
3149 b"notify::cursor-position\0".as_ptr() as *const _,
3150 Some(transmute::<_, unsafe extern "C" fn()>(
3151 notify_cursor_position_trampoline::<Self, F> as *const (),
3152 )),
3153 Box_::into_raw(f),
3154 )
3155 }
3156 }
3157
3158 #[doc(alias = "ellipsize")]
3159 fn connect_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3160 unsafe extern "C" fn notify_ellipsize_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3161 this: *mut ffi::GtkLabel,
3162 _param_spec: glib::ffi::gpointer,
3163 f: glib::ffi::gpointer,
3164 ) {
3165 let f: &F = &*(f as *const F);
3166 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3167 }
3168 unsafe {
3169 let f: Box_<F> = Box_::new(f);
3170 connect_raw(
3171 self.as_ptr() as *mut _,
3172 b"notify::ellipsize\0".as_ptr() as *const _,
3173 Some(transmute::<_, unsafe extern "C" fn()>(
3174 notify_ellipsize_trampoline::<Self, F> as *const (),
3175 )),
3176 Box_::into_raw(f),
3177 )
3178 }
3179 }
3180
3181 #[doc(alias = "justify")]
3182 fn connect_justify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3183 unsafe extern "C" fn notify_justify_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3184 this: *mut ffi::GtkLabel,
3185 _param_spec: glib::ffi::gpointer,
3186 f: glib::ffi::gpointer,
3187 ) {
3188 let f: &F = &*(f as *const F);
3189 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3190 }
3191 unsafe {
3192 let f: Box_<F> = Box_::new(f);
3193 connect_raw(
3194 self.as_ptr() as *mut _,
3195 b"notify::justify\0".as_ptr() as *const _,
3196 Some(transmute::<_, unsafe extern "C" fn()>(
3197 notify_justify_trampoline::<Self, F> as *const (),
3198 )),
3199 Box_::into_raw(f),
3200 )
3201 }
3202 }
3203
3204 #[doc(alias = "label")]
3205 fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3206 unsafe extern "C" fn notify_label_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3207 this: *mut ffi::GtkLabel,
3208 _param_spec: glib::ffi::gpointer,
3209 f: glib::ffi::gpointer,
3210 ) {
3211 let f: &F = &*(f as *const F);
3212 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3213 }
3214 unsafe {
3215 let f: Box_<F> = Box_::new(f);
3216 connect_raw(
3217 self.as_ptr() as *mut _,
3218 b"notify::label\0".as_ptr() as *const _,
3219 Some(transmute::<_, unsafe extern "C" fn()>(
3220 notify_label_trampoline::<Self, F> as *const (),
3221 )),
3222 Box_::into_raw(f),
3223 )
3224 }
3225 }
3226
3227 #[doc(alias = "lines")]
3228 fn connect_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3229 unsafe extern "C" fn notify_lines_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3230 this: *mut ffi::GtkLabel,
3231 _param_spec: glib::ffi::gpointer,
3232 f: glib::ffi::gpointer,
3233 ) {
3234 let f: &F = &*(f as *const F);
3235 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3236 }
3237 unsafe {
3238 let f: Box_<F> = Box_::new(f);
3239 connect_raw(
3240 self.as_ptr() as *mut _,
3241 b"notify::lines\0".as_ptr() as *const _,
3242 Some(transmute::<_, unsafe extern "C" fn()>(
3243 notify_lines_trampoline::<Self, F> as *const (),
3244 )),
3245 Box_::into_raw(f),
3246 )
3247 }
3248 }
3249
3250 #[doc(alias = "max-width-chars")]
3251 fn connect_max_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3252 unsafe extern "C" fn notify_max_width_chars_trampoline<
3253 P: IsA<Label>,
3254 F: Fn(&P) + 'static,
3255 >(
3256 this: *mut ffi::GtkLabel,
3257 _param_spec: glib::ffi::gpointer,
3258 f: glib::ffi::gpointer,
3259 ) {
3260 let f: &F = &*(f as *const F);
3261 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3262 }
3263 unsafe {
3264 let f: Box_<F> = Box_::new(f);
3265 connect_raw(
3266 self.as_ptr() as *mut _,
3267 b"notify::max-width-chars\0".as_ptr() as *const _,
3268 Some(transmute::<_, unsafe extern "C" fn()>(
3269 notify_max_width_chars_trampoline::<Self, F> as *const (),
3270 )),
3271 Box_::into_raw(f),
3272 )
3273 }
3274 }
3275
3276 #[doc(alias = "mnemonic-keyval")]
3277 fn connect_mnemonic_keyval_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3278 unsafe extern "C" fn notify_mnemonic_keyval_trampoline<
3279 P: IsA<Label>,
3280 F: Fn(&P) + 'static,
3281 >(
3282 this: *mut ffi::GtkLabel,
3283 _param_spec: glib::ffi::gpointer,
3284 f: glib::ffi::gpointer,
3285 ) {
3286 let f: &F = &*(f as *const F);
3287 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3288 }
3289 unsafe {
3290 let f: Box_<F> = Box_::new(f);
3291 connect_raw(
3292 self.as_ptr() as *mut _,
3293 b"notify::mnemonic-keyval\0".as_ptr() as *const _,
3294 Some(transmute::<_, unsafe extern "C" fn()>(
3295 notify_mnemonic_keyval_trampoline::<Self, F> as *const (),
3296 )),
3297 Box_::into_raw(f),
3298 )
3299 }
3300 }
3301
3302 #[doc(alias = "mnemonic-widget")]
3303 fn connect_mnemonic_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3304 unsafe extern "C" fn notify_mnemonic_widget_trampoline<
3305 P: IsA<Label>,
3306 F: Fn(&P) + 'static,
3307 >(
3308 this: *mut ffi::GtkLabel,
3309 _param_spec: glib::ffi::gpointer,
3310 f: glib::ffi::gpointer,
3311 ) {
3312 let f: &F = &*(f as *const F);
3313 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3314 }
3315 unsafe {
3316 let f: Box_<F> = Box_::new(f);
3317 connect_raw(
3318 self.as_ptr() as *mut _,
3319 b"notify::mnemonic-widget\0".as_ptr() as *const _,
3320 Some(transmute::<_, unsafe extern "C" fn()>(
3321 notify_mnemonic_widget_trampoline::<Self, F> as *const (),
3322 )),
3323 Box_::into_raw(f),
3324 )
3325 }
3326 }
3327
3328 #[doc(alias = "pattern")]
3329 fn connect_pattern_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3330 unsafe extern "C" fn notify_pattern_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3331 this: *mut ffi::GtkLabel,
3332 _param_spec: glib::ffi::gpointer,
3333 f: glib::ffi::gpointer,
3334 ) {
3335 let f: &F = &*(f as *const F);
3336 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3337 }
3338 unsafe {
3339 let f: Box_<F> = Box_::new(f);
3340 connect_raw(
3341 self.as_ptr() as *mut _,
3342 b"notify::pattern\0".as_ptr() as *const _,
3343 Some(transmute::<_, unsafe extern "C" fn()>(
3344 notify_pattern_trampoline::<Self, F> as *const (),
3345 )),
3346 Box_::into_raw(f),
3347 )
3348 }
3349 }
3350
3351 #[doc(alias = "selectable")]
3352 fn connect_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3353 unsafe extern "C" fn notify_selectable_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3354 this: *mut ffi::GtkLabel,
3355 _param_spec: glib::ffi::gpointer,
3356 f: glib::ffi::gpointer,
3357 ) {
3358 let f: &F = &*(f as *const F);
3359 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3360 }
3361 unsafe {
3362 let f: Box_<F> = Box_::new(f);
3363 connect_raw(
3364 self.as_ptr() as *mut _,
3365 b"notify::selectable\0".as_ptr() as *const _,
3366 Some(transmute::<_, unsafe extern "C" fn()>(
3367 notify_selectable_trampoline::<Self, F> as *const (),
3368 )),
3369 Box_::into_raw(f),
3370 )
3371 }
3372 }
3373
3374 #[doc(alias = "selection-bound")]
3375 fn connect_selection_bound_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3376 unsafe extern "C" fn notify_selection_bound_trampoline<
3377 P: IsA<Label>,
3378 F: Fn(&P) + 'static,
3379 >(
3380 this: *mut ffi::GtkLabel,
3381 _param_spec: glib::ffi::gpointer,
3382 f: glib::ffi::gpointer,
3383 ) {
3384 let f: &F = &*(f as *const F);
3385 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3386 }
3387 unsafe {
3388 let f: Box_<F> = Box_::new(f);
3389 connect_raw(
3390 self.as_ptr() as *mut _,
3391 b"notify::selection-bound\0".as_ptr() as *const _,
3392 Some(transmute::<_, unsafe extern "C" fn()>(
3393 notify_selection_bound_trampoline::<Self, F> as *const (),
3394 )),
3395 Box_::into_raw(f),
3396 )
3397 }
3398 }
3399
3400 #[doc(alias = "single-line-mode")]
3401 fn connect_single_line_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3402 unsafe extern "C" fn notify_single_line_mode_trampoline<
3403 P: IsA<Label>,
3404 F: Fn(&P) + 'static,
3405 >(
3406 this: *mut ffi::GtkLabel,
3407 _param_spec: glib::ffi::gpointer,
3408 f: glib::ffi::gpointer,
3409 ) {
3410 let f: &F = &*(f as *const F);
3411 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3412 }
3413 unsafe {
3414 let f: Box_<F> = Box_::new(f);
3415 connect_raw(
3416 self.as_ptr() as *mut _,
3417 b"notify::single-line-mode\0".as_ptr() as *const _,
3418 Some(transmute::<_, unsafe extern "C" fn()>(
3419 notify_single_line_mode_trampoline::<Self, F> as *const (),
3420 )),
3421 Box_::into_raw(f),
3422 )
3423 }
3424 }
3425
3426 #[doc(alias = "track-visited-links")]
3427 fn connect_track_visited_links_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3428 unsafe extern "C" fn notify_track_visited_links_trampoline<
3429 P: IsA<Label>,
3430 F: Fn(&P) + 'static,
3431 >(
3432 this: *mut ffi::GtkLabel,
3433 _param_spec: glib::ffi::gpointer,
3434 f: glib::ffi::gpointer,
3435 ) {
3436 let f: &F = &*(f as *const F);
3437 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3438 }
3439 unsafe {
3440 let f: Box_<F> = Box_::new(f);
3441 connect_raw(
3442 self.as_ptr() as *mut _,
3443 b"notify::track-visited-links\0".as_ptr() as *const _,
3444 Some(transmute::<_, unsafe extern "C" fn()>(
3445 notify_track_visited_links_trampoline::<Self, F> as *const (),
3446 )),
3447 Box_::into_raw(f),
3448 )
3449 }
3450 }
3451
3452 #[doc(alias = "use-markup")]
3453 fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3454 unsafe extern "C" fn notify_use_markup_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3455 this: *mut ffi::GtkLabel,
3456 _param_spec: glib::ffi::gpointer,
3457 f: glib::ffi::gpointer,
3458 ) {
3459 let f: &F = &*(f as *const F);
3460 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3461 }
3462 unsafe {
3463 let f: Box_<F> = Box_::new(f);
3464 connect_raw(
3465 self.as_ptr() as *mut _,
3466 b"notify::use-markup\0".as_ptr() as *const _,
3467 Some(transmute::<_, unsafe extern "C" fn()>(
3468 notify_use_markup_trampoline::<Self, F> as *const (),
3469 )),
3470 Box_::into_raw(f),
3471 )
3472 }
3473 }
3474
3475 #[doc(alias = "use-underline")]
3476 fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3477 unsafe extern "C" fn notify_use_underline_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3478 this: *mut ffi::GtkLabel,
3479 _param_spec: glib::ffi::gpointer,
3480 f: glib::ffi::gpointer,
3481 ) {
3482 let f: &F = &*(f as *const F);
3483 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3484 }
3485 unsafe {
3486 let f: Box_<F> = Box_::new(f);
3487 connect_raw(
3488 self.as_ptr() as *mut _,
3489 b"notify::use-underline\0".as_ptr() as *const _,
3490 Some(transmute::<_, unsafe extern "C" fn()>(
3491 notify_use_underline_trampoline::<Self, F> as *const (),
3492 )),
3493 Box_::into_raw(f),
3494 )
3495 }
3496 }
3497
3498 #[doc(alias = "width-chars")]
3499 fn connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3500 unsafe extern "C" fn notify_width_chars_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3501 this: *mut ffi::GtkLabel,
3502 _param_spec: glib::ffi::gpointer,
3503 f: glib::ffi::gpointer,
3504 ) {
3505 let f: &F = &*(f as *const F);
3506 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3507 }
3508 unsafe {
3509 let f: Box_<F> = Box_::new(f);
3510 connect_raw(
3511 self.as_ptr() as *mut _,
3512 b"notify::width-chars\0".as_ptr() as *const _,
3513 Some(transmute::<_, unsafe extern "C" fn()>(
3514 notify_width_chars_trampoline::<Self, F> as *const (),
3515 )),
3516 Box_::into_raw(f),
3517 )
3518 }
3519 }
3520
3521 #[doc(alias = "wrap")]
3522 fn connect_wrap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3523 unsafe extern "C" fn notify_wrap_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3524 this: *mut ffi::GtkLabel,
3525 _param_spec: glib::ffi::gpointer,
3526 f: glib::ffi::gpointer,
3527 ) {
3528 let f: &F = &*(f as *const F);
3529 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3530 }
3531 unsafe {
3532 let f: Box_<F> = Box_::new(f);
3533 connect_raw(
3534 self.as_ptr() as *mut _,
3535 b"notify::wrap\0".as_ptr() as *const _,
3536 Some(transmute::<_, unsafe extern "C" fn()>(
3537 notify_wrap_trampoline::<Self, F> as *const (),
3538 )),
3539 Box_::into_raw(f),
3540 )
3541 }
3542 }
3543
3544 #[doc(alias = "wrap-mode")]
3545 fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3546 unsafe extern "C" fn notify_wrap_mode_trampoline<P: IsA<Label>, F: Fn(&P) + 'static>(
3547 this: *mut ffi::GtkLabel,
3548 _param_spec: glib::ffi::gpointer,
3549 f: glib::ffi::gpointer,
3550 ) {
3551 let f: &F = &*(f as *const F);
3552 f(Label::from_glib_borrow(this).unsafe_cast_ref())
3553 }
3554 unsafe {
3555 let f: Box_<F> = Box_::new(f);
3556 connect_raw(
3557 self.as_ptr() as *mut _,
3558 b"notify::wrap-mode\0".as_ptr() as *const _,
3559 Some(transmute::<_, unsafe extern "C" fn()>(
3560 notify_wrap_mode_trampoline::<Self, F> as *const (),
3561 )),
3562 Box_::into_raw(f),
3563 )
3564 }
3565 }
3566}
3567
3568impl<O: IsA<Label>> LabelExt for O {}
3569
3570impl fmt::Display for Label {
3571 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3572 f.write_str("Label")
3573 }
3574}