Skip to main content

gtk/auto/
accel_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, Label, Misc, 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 [`AccelLabel`][crate::AccelLabel] widget is a subclass of [`Label`][crate::Label] that also displays an
15    /// accelerator key on the right of the label text, e.g. “Ctrl+S”.
16    /// It is commonly used in menus to show the keyboard short-cuts for commands.
17    ///
18    /// The accelerator key to display is typically not set explicitly (although it
19    /// can be, with [`AccelLabelExt::set_accel()`][crate::prelude::AccelLabelExt::set_accel()]). Instead, the [`AccelLabel`][crate::AccelLabel] displays
20    /// the accelerators which have been added to a particular widget. This widget is
21    /// set by calling [`AccelLabelExt::set_accel_widget()`][crate::prelude::AccelLabelExt::set_accel_widget()].
22    ///
23    /// For example, a [`MenuItem`][crate::MenuItem] widget may have an accelerator added to emit
24    /// the “activate” signal when the “Ctrl+S” key combination is pressed.
25    /// A [`AccelLabel`][crate::AccelLabel] is created and added to the [`MenuItem`][crate::MenuItem], and
26    /// [`AccelLabelExt::set_accel_widget()`][crate::prelude::AccelLabelExt::set_accel_widget()] is called with the [`MenuItem`][crate::MenuItem] as the
27    /// second argument. The [`AccelLabel`][crate::AccelLabel] will now display “Ctrl+S” after its label.
28    ///
29    /// Note that creating a [`MenuItem`][crate::MenuItem] with [`MenuItem::with_label()`][crate::MenuItem::with_label()] (or
30    /// one of the similar functions for [`CheckMenuItem`][crate::CheckMenuItem] and [`RadioMenuItem`][crate::RadioMenuItem])
31    /// automatically adds a [`AccelLabel`][crate::AccelLabel] to the [`MenuItem`][crate::MenuItem] and calls
32    /// [`AccelLabelExt::set_accel_widget()`][crate::prelude::AccelLabelExt::set_accel_widget()] to set it up for you.
33    ///
34    /// A [`AccelLabel`][crate::AccelLabel] will only display accelerators which have [`AccelFlags::VISIBLE`][crate::AccelFlags::VISIBLE]
35    /// set (see [`AccelFlags`][crate::AccelFlags]).
36    /// A [`AccelLabel`][crate::AccelLabel] can display multiple accelerators and even signal names,
37    /// though it is almost always used to display just one accelerator key.
38    ///
39    /// ## Creating a simple menu item with an accelerator key.
40    ///
41    ///
42    ///
43    /// **⚠️ The following code is in C ⚠️**
44    ///
45    /// ```C
46    ///   GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
47    ///   GtkWidget *menu = gtk_menu_new ();
48    ///   GtkWidget *save_item;
49    ///   GtkAccelGroup *accel_group;
50    ///
51    ///   // Create a GtkAccelGroup and add it to the window.
52    ///   accel_group = gtk_accel_group_new ();
53    ///   gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
54    ///
55    ///   // Create the menu item using the convenience function.
56    ///   save_item = gtk_menu_item_new_with_label ("Save");
57    ///   gtk_widget_show (save_item);
58    ///   gtk_container_add (GTK_CONTAINER (menu), save_item);
59    ///
60    ///   // Now add the accelerator to the GtkMenuItem. Note that since we
61    ///   // called gtk_menu_item_new_with_label() to create the GtkMenuItem
62    ///   // the GtkAccelLabel is automatically set up to display the
63    ///   // GtkMenuItem accelerators. We just need to make sure we use
64    ///   // GTK_ACCEL_VISIBLE here.
65    ///   gtk_widget_add_accelerator (save_item, "activate", accel_group,
66    ///                               GDK_KEY_s, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
67    /// ```
68    ///
69    /// # CSS nodes
70    ///
71    ///
72    ///
73    /// **⚠️ The following code is in plain ⚠️**
74    ///
75    /// ```plain
76    /// label
77    /// ╰── accelerator
78    /// ```
79    ///
80    /// Like [`Label`][crate::Label], GtkAccelLabel has a main CSS node with the name label.
81    /// It adds a subnode with name accelerator.
82    ///
83    /// ## Properties
84    ///
85    ///
86    /// #### `accel-closure`
87    ///  Readable | Writeable
88    ///
89    ///
90    /// #### `accel-widget`
91    ///  Readable | Writeable
92    /// <details><summary><h4>Label</h4></summary>
93    ///
94    ///
95    /// #### `angle`
96    ///  The angle that the baseline of the label makes with the horizontal,
97    /// in degrees, measured counterclockwise. An angle of 90 reads from
98    /// from bottom to top, an angle of 270, from top to bottom. Ignored
99    /// if the label is selectable.
100    ///
101    /// Readable | Writeable
102    ///
103    ///
104    /// #### `attributes`
105    ///  Readable | Writeable
106    ///
107    ///
108    /// #### `cursor-position`
109    ///  Readable
110    ///
111    ///
112    /// #### `ellipsize`
113    ///  The preferred place to ellipsize the string, if the label does
114    /// not have enough room to display the entire string, specified as a
115    /// [`pango::EllipsizeMode`][crate::pango::EllipsizeMode].
116    ///
117    /// Note that setting this property to a value other than
118    /// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] has the side-effect that the label requests
119    /// only enough space to display the ellipsis "...". In particular, this
120    /// means that ellipsizing labels do not work well in notebook tabs, unless
121    /// the [`Notebook`][crate::Notebook] tab-expand child property is set to [`true`]. Other ways
122    /// to set a label's width are [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] and
123    /// [`LabelExt::set_width_chars()`][crate::prelude::LabelExt::set_width_chars()].
124    ///
125    /// Readable | Writeable
126    ///
127    ///
128    /// #### `justify`
129    ///  Readable | Writeable
130    ///
131    ///
132    /// #### `label`
133    ///  The contents of the label.
134    ///
135    /// If the string contains [Pango XML markup][PangoMarkupFormat], you will
136    /// have to set the [`use-markup`][struct@crate::Label#use-markup] property to [`true`] in order for the
137    /// label to display the markup attributes. See also [`LabelExt::set_markup()`][crate::prelude::LabelExt::set_markup()]
138    /// for a convenience function that sets both this property and the
139    /// [`use-markup`][struct@crate::Label#use-markup] property at the same time.
140    ///
141    /// If the string contains underlines acting as mnemonics, you will have to
142    /// set the [`use-underline`][struct@crate::Label#use-underline] property to [`true`] in order for the label
143    /// to display them.
144    ///
145    /// Readable | Writeable
146    ///
147    ///
148    /// #### `lines`
149    ///  The number of lines to which an ellipsized, wrapping label
150    /// should be limited. This property has no effect if the
151    /// label is not wrapping or ellipsized. Set this property to
152    /// -1 if you don't want to limit the number of lines.
153    ///
154    /// Readable | Writeable
155    ///
156    ///
157    /// #### `max-width-chars`
158    ///  The desired maximum width of the label, in characters. If this property
159    /// is set to -1, the width will be calculated automatically.
160    ///
161    /// See the section on [text layout][label-text-layout]
162    /// for details of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
163    /// determine the width of ellipsized and wrapped labels.
164    ///
165    /// Readable | Writeable
166    ///
167    ///
168    /// #### `mnemonic-keyval`
169    ///  Readable
170    ///
171    ///
172    /// #### `mnemonic-widget`
173    ///  Readable | Writeable
174    ///
175    ///
176    /// #### `pattern`
177    ///  Writeable
178    ///
179    ///
180    /// #### `selectable`
181    ///  Readable | Writeable
182    ///
183    ///
184    /// #### `selection-bound`
185    ///  Readable
186    ///
187    ///
188    /// #### `single-line-mode`
189    ///  Whether the label is in single line mode. In single line mode,
190    /// the height of the label does not depend on the actual text, it
191    /// is always set to ascent + descent of the font. This can be an
192    /// advantage in situations where resizing the label because of text
193    /// changes would be distracting, e.g. in a statusbar.
194    ///
195    /// Readable | Writeable
196    ///
197    ///
198    /// #### `track-visited-links`
199    ///  Set this property to [`true`] to make the label track which links
200    /// have been visited. It will then apply the [`StateFlags::VISITED`][crate::StateFlags::VISITED]
201    /// when rendering this link, in addition to [`StateFlags::LINK`][crate::StateFlags::LINK].
202    ///
203    /// Readable | Writeable
204    ///
205    ///
206    /// #### `use-markup`
207    ///  Readable | Writeable
208    ///
209    ///
210    /// #### `use-underline`
211    ///  Readable | Writeable
212    ///
213    ///
214    /// #### `width-chars`
215    ///  The desired width of the label, in characters. If this property is set to
216    /// -1, the width will be calculated automatically.
217    ///
218    /// See the section on [text layout][label-text-layout]
219    /// for details of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
220    /// determine the width of ellipsized and wrapped labels.
221    ///
222    /// Readable | Writeable
223    ///
224    ///
225    /// #### `wrap`
226    ///  Readable | Writeable
227    ///
228    ///
229    /// #### `wrap-mode`
230    ///  If line wrapping is on (see the [`wrap`][struct@crate::Label#wrap] property) this controls
231    /// how the line wrapping is done. The default is [`pango::WrapMode::Word`][crate::pango::WrapMode::Word], which
232    /// means wrap on word boundaries.
233    ///
234    /// Readable | Writeable
235    ///
236    ///
237    /// #### `xalign`
238    ///  The xalign property determines the horizontal aligment of the label text
239    /// inside the labels size allocation. Compare this to [`halign`][struct@crate::Widget#halign],
240    /// which determines how the labels size allocation is positioned in the
241    /// space available for the label.
242    ///
243    /// Readable | Writeable
244    ///
245    ///
246    /// #### `yalign`
247    ///  The yalign property determines the vertical aligment of the label text
248    /// inside the labels size allocation. Compare this to [`valign`][struct@crate::Widget#valign],
249    /// which determines how the labels size allocation is positioned in the
250    /// space available for the label.
251    ///
252    /// Readable | Writeable
253    /// </details>
254    /// <details><summary><h4>Misc</h4></summary>
255    ///
256    ///
257    /// #### `xalign`
258    ///  The horizontal alignment. A value of 0.0 means left alignment (or right
259    /// on RTL locales); a value of 1.0 means right alignment (or left on RTL
260    /// locales).
261    ///
262    /// Readable | Writeable
263    ///
264    ///
265    /// #### `xpad`
266    ///  The amount of space to add on the left and right of the widget, in
267    /// pixels.
268    ///
269    /// Readable | Writeable
270    ///
271    ///
272    /// #### `yalign`
273    ///  The vertical alignment. A value of 0.0 means top alignment;
274    /// a value of 1.0 means bottom alignment.
275    ///
276    /// Readable | Writeable
277    ///
278    ///
279    /// #### `ypad`
280    ///  The amount of space to add on the top and bottom of the widget, in
281    /// pixels.
282    ///
283    /// Readable | Writeable
284    /// </details>
285    /// <details><summary><h4>Widget</h4></summary>
286    ///
287    ///
288    /// #### `app-paintable`
289    ///  Readable | Writeable
290    ///
291    ///
292    /// #### `can-default`
293    ///  Readable | Writeable
294    ///
295    ///
296    /// #### `can-focus`
297    ///  Readable | Writeable
298    ///
299    ///
300    /// #### `composite-child`
301    ///  Readable
302    ///
303    ///
304    /// #### `double-buffered`
305    ///  Whether the widget is double buffered.
306    ///
307    /// Readable | Writeable
308    ///
309    ///
310    /// #### `events`
311    ///  Readable | Writeable
312    ///
313    ///
314    /// #### `expand`
315    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
316    ///
317    /// Readable | Writeable
318    ///
319    ///
320    /// #### `focus-on-click`
321    ///  Whether the widget should grab focus when it is clicked with the mouse.
322    ///
323    /// This property is only relevant for widgets that can take focus.
324    ///
325    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
326    /// GtkComboBox) implemented this property individually.
327    ///
328    /// Readable | Writeable
329    ///
330    ///
331    /// #### `halign`
332    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
333    ///
334    /// Readable | Writeable
335    ///
336    ///
337    /// #### `has-default`
338    ///  Readable | Writeable
339    ///
340    ///
341    /// #### `has-focus`
342    ///  Readable | Writeable
343    ///
344    ///
345    /// #### `has-tooltip`
346    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
347    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
348    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
349    /// whether it will provide a tooltip or not.
350    ///
351    /// Note that setting this property to [`true`] for the first time will change
352    /// the event masks of the GdkWindows of this widget to include leave-notify
353    /// and motion-notify events. This cannot and will not be undone when the
354    /// property is set to [`false`] again.
355    ///
356    /// Readable | Writeable
357    ///
358    ///
359    /// #### `height-request`
360    ///  Readable | Writeable
361    ///
362    ///
363    /// #### `hexpand`
364    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
365    ///
366    /// Readable | Writeable
367    ///
368    ///
369    /// #### `hexpand-set`
370    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
371    ///
372    /// Readable | Writeable
373    ///
374    ///
375    /// #### `is-focus`
376    ///  Readable | Writeable
377    ///
378    ///
379    /// #### `margin`
380    ///  Sets all four sides' margin at once. If read, returns max
381    /// margin on any side.
382    ///
383    /// Readable | Writeable
384    ///
385    ///
386    /// #### `margin-bottom`
387    ///  Margin on bottom side of widget.
388    ///
389    /// This property adds margin outside of the widget's normal size
390    /// request, the margin will be added in addition to the size from
391    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
392    ///
393    /// Readable | Writeable
394    ///
395    ///
396    /// #### `margin-end`
397    ///  Margin on end of widget, horizontally. This property supports
398    /// left-to-right and right-to-left text directions.
399    ///
400    /// This property adds margin outside of the widget's normal size
401    /// request, the margin will be added in addition to the size from
402    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
403    ///
404    /// Readable | Writeable
405    ///
406    ///
407    /// #### `margin-left`
408    ///  Margin on left side of widget.
409    ///
410    /// This property adds margin outside of the widget's normal size
411    /// request, the margin will be added in addition to the size from
412    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
413    ///
414    /// Readable | Writeable
415    ///
416    ///
417    /// #### `margin-right`
418    ///  Margin on right side of widget.
419    ///
420    /// This property adds margin outside of the widget's normal size
421    /// request, the margin will be added in addition to the size from
422    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
423    ///
424    /// Readable | Writeable
425    ///
426    ///
427    /// #### `margin-start`
428    ///  Margin on start of widget, horizontally. This property supports
429    /// left-to-right and right-to-left text directions.
430    ///
431    /// This property adds margin outside of the widget's normal size
432    /// request, the margin will be added in addition to the size from
433    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
434    ///
435    /// Readable | Writeable
436    ///
437    ///
438    /// #### `margin-top`
439    ///  Margin on top side of widget.
440    ///
441    /// This property adds margin outside of the widget's normal size
442    /// request, the margin will be added in addition to the size from
443    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
444    ///
445    /// Readable | Writeable
446    ///
447    ///
448    /// #### `name`
449    ///  Readable | Writeable
450    ///
451    ///
452    /// #### `no-show-all`
453    ///  Readable | Writeable
454    ///
455    ///
456    /// #### `opacity`
457    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
458    /// more details about window opacity.
459    ///
460    /// Before 3.8 this was only available in GtkWindow
461    ///
462    /// Readable | Writeable
463    ///
464    ///
465    /// #### `parent`
466    ///  Readable | Writeable
467    ///
468    ///
469    /// #### `receives-default`
470    ///  Readable | Writeable
471    ///
472    ///
473    /// #### `scale-factor`
474    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
475    /// more details about widget scaling.
476    ///
477    /// Readable
478    ///
479    ///
480    /// #### `sensitive`
481    ///  Readable | Writeable
482    ///
483    ///
484    /// #### `style`
485    ///  The style of the widget, which contains information about how it will look (colors, etc).
486    ///
487    /// Readable | Writeable
488    ///
489    ///
490    /// #### `tooltip-markup`
491    ///  Sets the text of tooltip to be the given string, which is marked up
492    /// with the [Pango text markup language][PangoMarkupFormat].
493    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
494    ///
495    /// This is a convenience property which will take care of getting the
496    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
497    /// will automatically be set to [`true`] and there will be taken care of
498    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
499    ///
500    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
501    /// are set, the last one wins.
502    ///
503    /// Readable | Writeable
504    ///
505    ///
506    /// #### `tooltip-text`
507    ///  Sets the text of tooltip to be the given string.
508    ///
509    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
510    ///
511    /// This is a convenience property which will take care of getting the
512    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
513    /// will automatically be set to [`true`] and there will be taken care of
514    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
515    ///
516    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
517    /// are set, the last one wins.
518    ///
519    /// Readable | Writeable
520    ///
521    ///
522    /// #### `valign`
523    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
524    ///
525    /// Readable | Writeable
526    ///
527    ///
528    /// #### `vexpand`
529    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
530    ///
531    /// Readable | Writeable
532    ///
533    ///
534    /// #### `vexpand-set`
535    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
536    ///
537    /// Readable | Writeable
538    ///
539    ///
540    /// #### `visible`
541    ///  Readable | Writeable
542    ///
543    ///
544    /// #### `width-request`
545    ///  Readable | Writeable
546    ///
547    ///
548    /// #### `window`
549    ///  The widget's window if it is realized, [`None`] otherwise.
550    ///
551    /// Readable
552    /// </details>
553    ///
554    /// # Implements
555    ///
556    /// [`AccelLabelExt`][trait@crate::prelude::AccelLabelExt], [`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]
557    #[doc(alias = "GtkAccelLabel")]
558    pub struct AccelLabel(Object<ffi::GtkAccelLabel, ffi::GtkAccelLabelClass>) @extends Label, Misc, Widget, @implements Buildable;
559
560    match fn {
561        type_ => || ffi::gtk_accel_label_get_type(),
562    }
563}
564
565impl AccelLabel {
566    pub const NONE: Option<&'static AccelLabel> = None;
567
568    /// Creates a new [`AccelLabel`][crate::AccelLabel].
569    /// ## `string`
570    /// the label string. Must be non-[`None`].
571    ///
572    /// # Returns
573    ///
574    /// a new [`AccelLabel`][crate::AccelLabel].
575    #[doc(alias = "gtk_accel_label_new")]
576    pub fn new(string: &str) -> AccelLabel {
577        assert_initialized_main_thread!();
578        unsafe {
579            Widget::from_glib_none(ffi::gtk_accel_label_new(string.to_glib_none().0)).unsafe_cast()
580        }
581    }
582
583    // rustdoc-stripper-ignore-next
584    /// Creates a new builder-pattern struct instance to construct [`AccelLabel`] objects.
585    ///
586    /// This method returns an instance of [`AccelLabelBuilder`](crate::builders::AccelLabelBuilder) which can be used to create [`AccelLabel`] objects.
587    pub fn builder() -> AccelLabelBuilder {
588        AccelLabelBuilder::new()
589    }
590}
591
592impl Default for AccelLabel {
593    fn default() -> Self {
594        glib::object::Object::new::<Self>()
595    }
596}
597
598// rustdoc-stripper-ignore-next
599/// A [builder-pattern] type to construct [`AccelLabel`] objects.
600///
601/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
602#[must_use = "The builder must be built to be used"]
603pub struct AccelLabelBuilder {
604    builder: glib::object::ObjectBuilder<'static, AccelLabel>,
605}
606
607impl AccelLabelBuilder {
608    fn new() -> Self {
609        Self {
610            builder: glib::object::Object::builder(),
611        }
612    }
613
614    pub fn accel_closure(self, accel_closure: &glib::Closure) -> Self {
615        Self {
616            builder: self
617                .builder
618                .property("accel-closure", accel_closure.clone()),
619        }
620    }
621
622    pub fn accel_widget(self, accel_widget: &impl IsA<Widget>) -> Self {
623        Self {
624            builder: self
625                .builder
626                .property("accel-widget", accel_widget.clone().upcast()),
627        }
628    }
629
630    /// The angle that the baseline of the label makes with the horizontal,
631    /// in degrees, measured counterclockwise. An angle of 90 reads from
632    /// from bottom to top, an angle of 270, from top to bottom. Ignored
633    /// if the label is selectable.
634    pub fn angle(self, angle: f64) -> Self {
635        Self {
636            builder: self.builder.property("angle", angle),
637        }
638    }
639
640    pub fn attributes(self, attributes: &pango::AttrList) -> Self {
641        Self {
642            builder: self.builder.property("attributes", attributes.clone()),
643        }
644    }
645
646    /// The preferred place to ellipsize the string, if the label does
647    /// not have enough room to display the entire string, specified as a
648    /// [`pango::EllipsizeMode`][crate::pango::EllipsizeMode].
649    ///
650    /// Note that setting this property to a value other than
651    /// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] has the side-effect that the label requests
652    /// only enough space to display the ellipsis "...". In particular, this
653    /// means that ellipsizing labels do not work well in notebook tabs, unless
654    /// the [`Notebook`][crate::Notebook] tab-expand child property is set to [`true`]. Other ways
655    /// to set a label's width are [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] and
656    /// [`LabelExt::set_width_chars()`][crate::prelude::LabelExt::set_width_chars()].
657    pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
658        Self {
659            builder: self.builder.property("ellipsize", ellipsize),
660        }
661    }
662
663    pub fn justify(self, justify: Justification) -> Self {
664        Self {
665            builder: self.builder.property("justify", justify),
666        }
667    }
668
669    /// The contents of the label.
670    ///
671    /// If the string contains [Pango XML markup][PangoMarkupFormat], you will
672    /// have to set the [`use-markup`][struct@crate::Label#use-markup] property to [`true`] in order for the
673    /// label to display the markup attributes. See also [`LabelExt::set_markup()`][crate::prelude::LabelExt::set_markup()]
674    /// for a convenience function that sets both this property and the
675    /// [`use-markup`][struct@crate::Label#use-markup] property at the same time.
676    ///
677    /// If the string contains underlines acting as mnemonics, you will have to
678    /// set the [`use-underline`][struct@crate::Label#use-underline] property to [`true`] in order for the label
679    /// to display them.
680    pub fn label(self, label: impl Into<glib::GString>) -> Self {
681        Self {
682            builder: self.builder.property("label", label.into()),
683        }
684    }
685
686    /// The number of lines to which an ellipsized, wrapping label
687    /// should be limited. This property has no effect if the
688    /// label is not wrapping or ellipsized. Set this property to
689    /// -1 if you don't want to limit the number of lines.
690    pub fn lines(self, lines: i32) -> Self {
691        Self {
692            builder: self.builder.property("lines", lines),
693        }
694    }
695
696    /// The desired maximum width of the label, in characters. If this property
697    /// is set to -1, the width will be calculated automatically.
698    ///
699    /// See the section on [text layout][label-text-layout]
700    /// for details of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
701    /// determine the width of ellipsized and wrapped labels.
702    pub fn max_width_chars(self, max_width_chars: i32) -> Self {
703        Self {
704            builder: self.builder.property("max-width-chars", max_width_chars),
705        }
706    }
707
708    pub fn mnemonic_widget(self, mnemonic_widget: &impl IsA<Widget>) -> Self {
709        Self {
710            builder: self
711                .builder
712                .property("mnemonic-widget", mnemonic_widget.clone().upcast()),
713        }
714    }
715
716    pub fn pattern(self, pattern: impl Into<glib::GString>) -> Self {
717        Self {
718            builder: self.builder.property("pattern", pattern.into()),
719        }
720    }
721
722    pub fn selectable(self, selectable: bool) -> Self {
723        Self {
724            builder: self.builder.property("selectable", selectable),
725        }
726    }
727
728    /// Whether the label is in single line mode. In single line mode,
729    /// the height of the label does not depend on the actual text, it
730    /// is always set to ascent + descent of the font. This can be an
731    /// advantage in situations where resizing the label because of text
732    /// changes would be distracting, e.g. in a statusbar.
733    pub fn single_line_mode(self, single_line_mode: bool) -> Self {
734        Self {
735            builder: self.builder.property("single-line-mode", single_line_mode),
736        }
737    }
738
739    /// Set this property to [`true`] to make the label track which links
740    /// have been visited. It will then apply the [`StateFlags::VISITED`][crate::StateFlags::VISITED]
741    /// when rendering this link, in addition to [`StateFlags::LINK`][crate::StateFlags::LINK].
742    pub fn track_visited_links(self, track_visited_links: bool) -> Self {
743        Self {
744            builder: self
745                .builder
746                .property("track-visited-links", track_visited_links),
747        }
748    }
749
750    pub fn use_markup(self, use_markup: bool) -> Self {
751        Self {
752            builder: self.builder.property("use-markup", use_markup),
753        }
754    }
755
756    pub fn use_underline(self, use_underline: bool) -> Self {
757        Self {
758            builder: self.builder.property("use-underline", use_underline),
759        }
760    }
761
762    /// The desired width of the label, in characters. If this property is set to
763    /// -1, the width will be calculated automatically.
764    ///
765    /// See the section on [text layout][label-text-layout]
766    /// for details of how [`width-chars`][struct@crate::Label#width-chars] and [`max-width-chars`][struct@crate::Label#max-width-chars]
767    /// determine the width of ellipsized and wrapped labels.
768    pub fn width_chars(self, width_chars: i32) -> Self {
769        Self {
770            builder: self.builder.property("width-chars", width_chars),
771        }
772    }
773
774    pub fn wrap(self, wrap: bool) -> Self {
775        Self {
776            builder: self.builder.property("wrap", wrap),
777        }
778    }
779
780    /// If line wrapping is on (see the [`wrap`][struct@crate::Label#wrap] property) this controls
781    /// how the line wrapping is done. The default is [`pango::WrapMode::Word`][crate::pango::WrapMode::Word], which
782    /// means wrap on word boundaries.
783    pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
784        Self {
785            builder: self.builder.property("wrap-mode", wrap_mode),
786        }
787    }
788
789    /// The xalign property determines the horizontal aligment of the label text
790    /// inside the labels size allocation. Compare this to [`halign`][struct@crate::Widget#halign],
791    /// which determines how the labels size allocation is positioned in the
792    /// space available for the label.
793    pub fn xalign(self, xalign: f32) -> Self {
794        Self {
795            builder: self.builder.property("xalign", xalign),
796        }
797    }
798
799    /// The yalign property determines the vertical aligment of the label text
800    /// inside the labels size allocation. Compare this to [`valign`][struct@crate::Widget#valign],
801    /// which determines how the labels size allocation is positioned in the
802    /// space available for the label.
803    pub fn yalign(self, yalign: f32) -> Self {
804        Self {
805            builder: self.builder.property("yalign", yalign),
806        }
807    }
808
809    pub fn app_paintable(self, app_paintable: bool) -> Self {
810        Self {
811            builder: self.builder.property("app-paintable", app_paintable),
812        }
813    }
814
815    pub fn can_default(self, can_default: bool) -> Self {
816        Self {
817            builder: self.builder.property("can-default", can_default),
818        }
819    }
820
821    pub fn can_focus(self, can_focus: bool) -> Self {
822        Self {
823            builder: self.builder.property("can-focus", can_focus),
824        }
825    }
826
827    pub fn events(self, events: gdk::EventMask) -> Self {
828        Self {
829            builder: self.builder.property("events", events),
830        }
831    }
832
833    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
834    pub fn expand(self, expand: bool) -> Self {
835        Self {
836            builder: self.builder.property("expand", expand),
837        }
838    }
839
840    /// Whether the widget should grab focus when it is clicked with the mouse.
841    ///
842    /// This property is only relevant for widgets that can take focus.
843    ///
844    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
845    /// GtkComboBox) implemented this property individually.
846    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
847        Self {
848            builder: self.builder.property("focus-on-click", focus_on_click),
849        }
850    }
851
852    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
853    pub fn halign(self, halign: Align) -> Self {
854        Self {
855            builder: self.builder.property("halign", halign),
856        }
857    }
858
859    pub fn has_default(self, has_default: bool) -> Self {
860        Self {
861            builder: self.builder.property("has-default", has_default),
862        }
863    }
864
865    pub fn has_focus(self, has_focus: bool) -> Self {
866        Self {
867            builder: self.builder.property("has-focus", has_focus),
868        }
869    }
870
871    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
872    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
873    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
874    /// whether it will provide a tooltip or not.
875    ///
876    /// Note that setting this property to [`true`] for the first time will change
877    /// the event masks of the GdkWindows of this widget to include leave-notify
878    /// and motion-notify events. This cannot and will not be undone when the
879    /// property is set to [`false`] again.
880    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
881        Self {
882            builder: self.builder.property("has-tooltip", has_tooltip),
883        }
884    }
885
886    pub fn height_request(self, height_request: i32) -> Self {
887        Self {
888            builder: self.builder.property("height-request", height_request),
889        }
890    }
891
892    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
893    pub fn hexpand(self, hexpand: bool) -> Self {
894        Self {
895            builder: self.builder.property("hexpand", hexpand),
896        }
897    }
898
899    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
900    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
901        Self {
902            builder: self.builder.property("hexpand-set", hexpand_set),
903        }
904    }
905
906    pub fn is_focus(self, is_focus: bool) -> Self {
907        Self {
908            builder: self.builder.property("is-focus", is_focus),
909        }
910    }
911
912    /// Sets all four sides' margin at once. If read, returns max
913    /// margin on any side.
914    pub fn margin(self, margin: i32) -> Self {
915        Self {
916            builder: self.builder.property("margin", margin),
917        }
918    }
919
920    /// Margin on bottom side of widget.
921    ///
922    /// This property adds margin outside of the widget's normal size
923    /// request, the margin will be added in addition to the size from
924    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
925    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
926        Self {
927            builder: self.builder.property("margin-bottom", margin_bottom),
928        }
929    }
930
931    /// Margin on end of widget, horizontally. This property supports
932    /// left-to-right and right-to-left text directions.
933    ///
934    /// This property adds margin outside of the widget's normal size
935    /// request, the margin will be added in addition to the size from
936    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
937    pub fn margin_end(self, margin_end: i32) -> Self {
938        Self {
939            builder: self.builder.property("margin-end", margin_end),
940        }
941    }
942
943    /// Margin on start of widget, horizontally. This property supports
944    /// left-to-right and right-to-left text directions.
945    ///
946    /// This property adds margin outside of the widget's normal size
947    /// request, the margin will be added in addition to the size from
948    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
949    pub fn margin_start(self, margin_start: i32) -> Self {
950        Self {
951            builder: self.builder.property("margin-start", margin_start),
952        }
953    }
954
955    /// Margin on top side of widget.
956    ///
957    /// This property adds margin outside of the widget's normal size
958    /// request, the margin will be added in addition to the size from
959    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
960    pub fn margin_top(self, margin_top: i32) -> Self {
961        Self {
962            builder: self.builder.property("margin-top", margin_top),
963        }
964    }
965
966    pub fn name(self, name: impl Into<glib::GString>) -> Self {
967        Self {
968            builder: self.builder.property("name", name.into()),
969        }
970    }
971
972    pub fn no_show_all(self, no_show_all: bool) -> Self {
973        Self {
974            builder: self.builder.property("no-show-all", no_show_all),
975        }
976    }
977
978    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
979    /// more details about window opacity.
980    ///
981    /// Before 3.8 this was only available in GtkWindow
982    pub fn opacity(self, opacity: f64) -> Self {
983        Self {
984            builder: self.builder.property("opacity", opacity),
985        }
986    }
987
988    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
989        Self {
990            builder: self.builder.property("parent", parent.clone().upcast()),
991        }
992    }
993
994    pub fn receives_default(self, receives_default: bool) -> Self {
995        Self {
996            builder: self.builder.property("receives-default", receives_default),
997        }
998    }
999
1000    pub fn sensitive(self, sensitive: bool) -> Self {
1001        Self {
1002            builder: self.builder.property("sensitive", sensitive),
1003        }
1004    }
1005
1006    /// Sets the text of tooltip to be the given string, which is marked up
1007    /// with the [Pango text markup language][PangoMarkupFormat].
1008    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1009    ///
1010    /// This is a convenience property which will take care of getting the
1011    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1012    /// will automatically be set to [`true`] and there will be taken care of
1013    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1014    ///
1015    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1016    /// are set, the last one wins.
1017    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1018        Self {
1019            builder: self
1020                .builder
1021                .property("tooltip-markup", tooltip_markup.into()),
1022        }
1023    }
1024
1025    /// Sets the text of tooltip to be the given string.
1026    ///
1027    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1028    ///
1029    /// This is a convenience property which will take care of getting the
1030    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1031    /// will automatically be set to [`true`] and there will be taken care of
1032    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1033    ///
1034    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1035    /// are set, the last one wins.
1036    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1037        Self {
1038            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1039        }
1040    }
1041
1042    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1043    pub fn valign(self, valign: Align) -> Self {
1044        Self {
1045            builder: self.builder.property("valign", valign),
1046        }
1047    }
1048
1049    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1050    pub fn vexpand(self, vexpand: bool) -> Self {
1051        Self {
1052            builder: self.builder.property("vexpand", vexpand),
1053        }
1054    }
1055
1056    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1057    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1058        Self {
1059            builder: self.builder.property("vexpand-set", vexpand_set),
1060        }
1061    }
1062
1063    pub fn visible(self, visible: bool) -> Self {
1064        Self {
1065            builder: self.builder.property("visible", visible),
1066        }
1067    }
1068
1069    pub fn width_request(self, width_request: i32) -> Self {
1070        Self {
1071            builder: self.builder.property("width-request", width_request),
1072        }
1073    }
1074
1075    // rustdoc-stripper-ignore-next
1076    /// Build the [`AccelLabel`].
1077    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1078    pub fn build(self) -> AccelLabel {
1079        self.builder.build()
1080    }
1081}
1082
1083mod sealed {
1084    pub trait Sealed {}
1085    impl<T: super::IsA<super::AccelLabel>> Sealed for T {}
1086}
1087
1088/// Trait containing all [`struct@AccelLabel`] methods.
1089///
1090/// # Implementors
1091///
1092/// [`AccelLabel`][struct@crate::AccelLabel]
1093pub trait AccelLabelExt: IsA<AccelLabel> + sealed::Sealed + 'static {
1094    /// Gets the keyval and modifier mask set with
1095    /// [`set_accel()`][Self::set_accel()].
1096    ///
1097    /// # Returns
1098    ///
1099    ///
1100    /// ## `accelerator_key`
1101    /// return location for the keyval
1102    ///
1103    /// ## `accelerator_mods`
1104    /// return location for the modifier mask
1105    #[doc(alias = "gtk_accel_label_get_accel")]
1106    #[doc(alias = "get_accel")]
1107    fn accel(&self) -> (u32, gdk::ModifierType) {
1108        unsafe {
1109            let mut accelerator_key = mem::MaybeUninit::uninit();
1110            let mut accelerator_mods = mem::MaybeUninit::uninit();
1111            ffi::gtk_accel_label_get_accel(
1112                self.as_ref().to_glib_none().0,
1113                accelerator_key.as_mut_ptr(),
1114                accelerator_mods.as_mut_ptr(),
1115            );
1116            (
1117                accelerator_key.assume_init(),
1118                from_glib(accelerator_mods.assume_init()),
1119            )
1120        }
1121    }
1122
1123    /// Fetches the widget monitored by this accelerator label. See
1124    /// [`set_accel_widget()`][Self::set_accel_widget()].
1125    ///
1126    /// # Returns
1127    ///
1128    /// the object monitored by the accelerator label, or [`None`].
1129    #[doc(alias = "gtk_accel_label_get_accel_widget")]
1130    #[doc(alias = "get_accel_widget")]
1131    fn accel_widget(&self) -> Option<Widget> {
1132        unsafe {
1133            from_glib_none(ffi::gtk_accel_label_get_accel_widget(
1134                self.as_ref().to_glib_none().0,
1135            ))
1136        }
1137    }
1138
1139    /// Returns the width needed to display the accelerator key(s).
1140    /// This is used by menus to align all of the [`MenuItem`][crate::MenuItem] widgets, and shouldn't
1141    /// be needed by applications.
1142    ///
1143    /// # Returns
1144    ///
1145    /// the width needed to display the accelerator key(s).
1146    #[doc(alias = "gtk_accel_label_get_accel_width")]
1147    #[doc(alias = "get_accel_width")]
1148    fn accel_width(&self) -> u32 {
1149        unsafe { ffi::gtk_accel_label_get_accel_width(self.as_ref().to_glib_none().0) }
1150    }
1151
1152    /// Recreates the string representing the accelerator keys.
1153    /// This should not be needed since the string is automatically updated whenever
1154    /// accelerators are added or removed from the associated widget.
1155    ///
1156    /// # Returns
1157    ///
1158    /// always returns [`false`].
1159    #[doc(alias = "gtk_accel_label_refetch")]
1160    fn refetch(&self) -> bool {
1161        unsafe { from_glib(ffi::gtk_accel_label_refetch(self.as_ref().to_glib_none().0)) }
1162    }
1163
1164    /// Manually sets a keyval and modifier mask as the accelerator rendered
1165    /// by `self`.
1166    ///
1167    /// If a keyval and modifier are explicitly set then these values are
1168    /// used regardless of any associated accel closure or widget.
1169    ///
1170    /// Providing an `accelerator_key` of 0 removes the manual setting.
1171    /// ## `accelerator_key`
1172    /// a keyval, or 0
1173    /// ## `accelerator_mods`
1174    /// the modifier mask for the accel
1175    #[doc(alias = "gtk_accel_label_set_accel")]
1176    fn set_accel(&self, accelerator_key: u32, accelerator_mods: gdk::ModifierType) {
1177        unsafe {
1178            ffi::gtk_accel_label_set_accel(
1179                self.as_ref().to_glib_none().0,
1180                accelerator_key,
1181                accelerator_mods.into_glib(),
1182            );
1183        }
1184    }
1185
1186    /// Sets the closure to be monitored by this accelerator label. The closure
1187    /// must be connected to an accelerator group; see [`AccelGroupExtManual::connect_accel_group()`][crate::prelude::AccelGroupExtManual::connect_accel_group()].
1188    /// Passing [`None`] for `accel_closure` will dissociate `self` from its
1189    /// current closure, if any.
1190    /// ## `accel_closure`
1191    /// the closure to monitor for accelerator changes,
1192    /// or [`None`]
1193    #[doc(alias = "gtk_accel_label_set_accel_closure")]
1194    fn set_accel_closure(&self, accel_closure: Option<&glib::Closure>) {
1195        unsafe {
1196            ffi::gtk_accel_label_set_accel_closure(
1197                self.as_ref().to_glib_none().0,
1198                accel_closure.to_glib_none().0,
1199            );
1200        }
1201    }
1202
1203    /// Sets the widget to be monitored by this accelerator label. Passing [`None`] for
1204    /// `accel_widget` will dissociate `self` from its current widget, if any.
1205    /// ## `accel_widget`
1206    /// the widget to be monitored, or [`None`]
1207    #[doc(alias = "gtk_accel_label_set_accel_widget")]
1208    fn set_accel_widget(&self, accel_widget: Option<&impl IsA<Widget>>) {
1209        unsafe {
1210            ffi::gtk_accel_label_set_accel_widget(
1211                self.as_ref().to_glib_none().0,
1212                accel_widget.map(|p| p.as_ref()).to_glib_none().0,
1213            );
1214        }
1215    }
1216
1217    #[doc(alias = "accel-closure")]
1218    fn accel_closure(&self) -> Option<glib::Closure> {
1219        ObjectExt::property(self.as_ref(), "accel-closure")
1220    }
1221
1222    #[doc(alias = "accel-closure")]
1223    fn connect_accel_closure_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1224        unsafe extern "C" fn notify_accel_closure_trampoline<
1225            P: IsA<AccelLabel>,
1226            F: Fn(&P) + 'static,
1227        >(
1228            this: *mut ffi::GtkAccelLabel,
1229            _param_spec: glib::ffi::gpointer,
1230            f: glib::ffi::gpointer,
1231        ) {
1232            let f: &F = &*(f as *const F);
1233            f(AccelLabel::from_glib_borrow(this).unsafe_cast_ref())
1234        }
1235        unsafe {
1236            let f: Box_<F> = Box_::new(f);
1237            connect_raw(
1238                self.as_ptr() as *mut _,
1239                b"notify::accel-closure\0".as_ptr() as *const _,
1240                Some(transmute::<_, unsafe extern "C" fn()>(
1241                    notify_accel_closure_trampoline::<Self, F> as *const (),
1242                )),
1243                Box_::into_raw(f),
1244            )
1245        }
1246    }
1247
1248    #[doc(alias = "accel-widget")]
1249    fn connect_accel_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1250        unsafe extern "C" fn notify_accel_widget_trampoline<
1251            P: IsA<AccelLabel>,
1252            F: Fn(&P) + 'static,
1253        >(
1254            this: *mut ffi::GtkAccelLabel,
1255            _param_spec: glib::ffi::gpointer,
1256            f: glib::ffi::gpointer,
1257        ) {
1258            let f: &F = &*(f as *const F);
1259            f(AccelLabel::from_glib_borrow(this).unsafe_cast_ref())
1260        }
1261        unsafe {
1262            let f: Box_<F> = Box_::new(f);
1263            connect_raw(
1264                self.as_ptr() as *mut _,
1265                b"notify::accel-widget\0".as_ptr() as *const _,
1266                Some(transmute::<_, unsafe extern "C" fn()>(
1267                    notify_accel_widget_trampoline::<Self, F> as *const (),
1268                )),
1269                Box_::into_raw(f),
1270            )
1271        }
1272    }
1273}
1274
1275impl<O: IsA<AccelLabel>> AccelLabelExt for O {}
1276
1277impl fmt::Display for AccelLabel {
1278    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1279        f.write_str("AccelLabel")
1280    }
1281}