gtk/auto/font_button.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5#[cfg(feature = "v3_24")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
7use crate::FontChooserLevel;
8use crate::{
9 Actionable, Align, Bin, Buildable, Button, Container, FontChooser, PositionType, ReliefStyle,
10 ResizeMode, Widget, ffi,
11};
12use glib::{
13 object::ObjectType as _,
14 prelude::*,
15 signal::{SignalHandlerId, connect_raw},
16 translate::*,
17};
18use std::boxed::Box as Box_;
19
20glib::wrapper! {
21 /// The [`FontButton`][crate::FontButton] is a button which displays the currently selected
22 /// font an allows to open a font chooser dialog to change the font.
23 /// It is suitable widget for selecting a font in a preference dialog.
24 ///
25 /// # CSS nodes
26 ///
27 /// GtkFontButton has a single CSS node with name button and style class .font.
28 ///
29 /// ## Properties
30 ///
31 ///
32 /// #### `font-name`
33 /// The name of the currently selected font.
34 ///
35 /// Readable | Writable
36 ///
37 ///
38 /// #### `show-size`
39 /// If this property is set to [`true`], the selected font size will be shown
40 /// in the label. For a more WYSIWYG way to show the selected size, see the
41 /// ::use-size property.
42 ///
43 /// Readable | Writable
44 ///
45 ///
46 /// #### `show-style`
47 /// If this property is set to [`true`], the name of the selected font style
48 /// will be shown in the label. For a more WYSIWYG way to show the selected
49 /// style, see the ::use-font property.
50 ///
51 /// Readable | Writable
52 ///
53 ///
54 /// #### `title`
55 /// The title of the font chooser dialog.
56 ///
57 /// Readable | Writable
58 ///
59 ///
60 /// #### `use-font`
61 /// If this property is set to [`true`], the label will be drawn
62 /// in the selected font.
63 ///
64 /// Readable | Writable
65 ///
66 ///
67 /// #### `use-size`
68 /// If this property is set to [`true`], the label will be drawn
69 /// with the selected font size.
70 ///
71 /// Readable | Writable
72 /// <details><summary><h4>Button</h4></summary>
73 ///
74 ///
75 /// #### `always-show-image`
76 /// If [`true`], the button will ignore the [`gtk-button-images`][struct@crate::Settings#gtk-button-images]
77 /// setting and always show the image, if available.
78 ///
79 /// Use this property if the button would be useless or hard to use
80 /// without the image.
81 ///
82 /// Readable | Writable | Construct
83 ///
84 ///
85 /// #### `image`
86 /// The child widget to appear next to the button text.
87 ///
88 /// Readable | Writable
89 ///
90 ///
91 /// #### `image-position`
92 /// The position of the image relative to the text inside the button.
93 ///
94 /// Readable | Writable
95 ///
96 ///
97 /// #### `label`
98 /// Readable | Writable | Construct
99 ///
100 ///
101 /// #### `relief`
102 /// Readable | Writable
103 ///
104 ///
105 /// #### `use-stock`
106 /// Readable | Writable | Construct
107 ///
108 ///
109 /// #### `use-underline`
110 /// Readable | Writable | Construct
111 ///
112 ///
113 /// #### `xalign`
114 /// If the child of the button is a [`Misc`][crate::Misc] or `GtkAlignment`, this property
115 /// can be used to control its horizontal alignment. 0.0 is left aligned,
116 /// 1.0 is right aligned.
117 ///
118 /// Readable | Writable
119 ///
120 ///
121 /// #### `yalign`
122 /// If the child of the button is a [`Misc`][crate::Misc] or `GtkAlignment`, this property
123 /// can be used to control its vertical alignment. 0.0 is top aligned,
124 /// 1.0 is bottom aligned.
125 ///
126 /// Readable | Writable
127 /// </details>
128 /// <details><summary><h4>Container</h4></summary>
129 ///
130 ///
131 /// #### `border-width`
132 /// Readable | Writable
133 ///
134 ///
135 /// #### `child`
136 /// Writable
137 ///
138 ///
139 /// #### `resize-mode`
140 /// Readable | Writable
141 /// </details>
142 /// <details><summary><h4>Widget</h4></summary>
143 ///
144 ///
145 /// #### `app-paintable`
146 /// Readable | Writable
147 ///
148 ///
149 /// #### `can-default`
150 /// Readable | Writable
151 ///
152 ///
153 /// #### `can-focus`
154 /// Readable | Writable
155 ///
156 ///
157 /// #### `composite-child`
158 /// Readable
159 ///
160 ///
161 /// #### `double-buffered`
162 /// Whether the widget is double buffered.
163 ///
164 /// Readable | Writable
165 ///
166 ///
167 /// #### `events`
168 /// Readable | Writable
169 ///
170 ///
171 /// #### `expand`
172 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
173 ///
174 /// Readable | Writable
175 ///
176 ///
177 /// #### `focus-on-click`
178 /// Whether the widget should grab focus when it is clicked with the mouse.
179 ///
180 /// This property is only relevant for widgets that can take focus.
181 ///
182 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
183 /// GtkComboBox) implemented this property individually.
184 ///
185 /// Readable | Writable
186 ///
187 ///
188 /// #### `halign`
189 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
190 ///
191 /// Readable | Writable
192 ///
193 ///
194 /// #### `has-default`
195 /// Readable | Writable
196 ///
197 ///
198 /// #### `has-focus`
199 /// Readable | Writable
200 ///
201 ///
202 /// #### `has-tooltip`
203 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
204 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
205 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
206 /// whether it will provide a tooltip or not.
207 ///
208 /// Note that setting this property to [`true`] for the first time will change
209 /// the event masks of the GdkWindows of this widget to include leave-notify
210 /// and motion-notify events. This cannot and will not be undone when the
211 /// property is set to [`false`] again.
212 ///
213 /// Readable | Writable
214 ///
215 ///
216 /// #### `height-request`
217 /// Readable | Writable
218 ///
219 ///
220 /// #### `hexpand`
221 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
222 ///
223 /// Readable | Writable
224 ///
225 ///
226 /// #### `hexpand-set`
227 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
228 ///
229 /// Readable | Writable
230 ///
231 ///
232 /// #### `is-focus`
233 /// Readable | Writable
234 ///
235 ///
236 /// #### `margin`
237 /// Sets all four sides' margin at once. If read, returns max
238 /// margin on any side.
239 ///
240 /// Readable | Writable
241 ///
242 ///
243 /// #### `margin-bottom`
244 /// Margin on bottom side of widget.
245 ///
246 /// This property adds margin outside of the widget's normal size
247 /// request, the margin will be added in addition to the size from
248 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
249 ///
250 /// Readable | Writable
251 ///
252 ///
253 /// #### `margin-end`
254 /// Margin on end of widget, horizontally. This property supports
255 /// left-to-right and right-to-left text directions.
256 ///
257 /// This property adds margin outside of the widget's normal size
258 /// request, the margin will be added in addition to the size from
259 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
260 ///
261 /// Readable | Writable
262 ///
263 ///
264 /// #### `margin-left`
265 /// Margin on left side of widget.
266 ///
267 /// This property adds margin outside of the widget's normal size
268 /// request, the margin will be added in addition to the size from
269 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
270 ///
271 /// Readable | Writable
272 ///
273 ///
274 /// #### `margin-right`
275 /// Margin on right side of widget.
276 ///
277 /// This property adds margin outside of the widget's normal size
278 /// request, the margin will be added in addition to the size from
279 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
280 ///
281 /// Readable | Writable
282 ///
283 ///
284 /// #### `margin-start`
285 /// Margin on start of widget, horizontally. This property supports
286 /// left-to-right and right-to-left text directions.
287 ///
288 /// This property adds margin outside of the widget's normal size
289 /// request, the margin will be added in addition to the size from
290 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
291 ///
292 /// Readable | Writable
293 ///
294 ///
295 /// #### `margin-top`
296 /// Margin on top side of widget.
297 ///
298 /// This property adds margin outside of the widget's normal size
299 /// request, the margin will be added in addition to the size from
300 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
301 ///
302 /// Readable | Writable
303 ///
304 ///
305 /// #### `name`
306 /// Readable | Writable
307 ///
308 ///
309 /// #### `no-show-all`
310 /// Readable | Writable
311 ///
312 ///
313 /// #### `opacity`
314 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
315 /// more details about window opacity.
316 ///
317 /// Before 3.8 this was only available in GtkWindow
318 ///
319 /// Readable | Writable
320 ///
321 ///
322 /// #### `parent`
323 /// Readable | Writable
324 ///
325 ///
326 /// #### `receives-default`
327 /// Readable | Writable
328 ///
329 ///
330 /// #### `scale-factor`
331 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
332 /// more details about widget scaling.
333 ///
334 /// Readable
335 ///
336 ///
337 /// #### `sensitive`
338 /// Readable | Writable
339 ///
340 ///
341 /// #### `style`
342 /// The style of the widget, which contains information about how it will look (colors, etc).
343 ///
344 /// Readable | Writable
345 ///
346 ///
347 /// #### `tooltip-markup`
348 /// Sets the text of tooltip to be the given string, which is marked up
349 /// with the [Pango text markup language][PangoMarkupFormat].
350 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
351 ///
352 /// This is a convenience property which will take care of getting the
353 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
354 /// will automatically be set to [`true`] and there will be taken care of
355 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
356 ///
357 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
358 /// are set, the last one wins.
359 ///
360 /// Readable | Writable
361 ///
362 ///
363 /// #### `tooltip-text`
364 /// Sets the text of tooltip to be the given string.
365 ///
366 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
367 ///
368 /// This is a convenience property which will take care of getting the
369 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
370 /// will automatically be set to [`true`] and there will be taken care of
371 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
372 ///
373 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
374 /// are set, the last one wins.
375 ///
376 /// Readable | Writable
377 ///
378 ///
379 /// #### `valign`
380 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
381 ///
382 /// Readable | Writable
383 ///
384 ///
385 /// #### `vexpand`
386 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
387 ///
388 /// Readable | Writable
389 ///
390 ///
391 /// #### `vexpand-set`
392 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
393 ///
394 /// Readable | Writable
395 ///
396 ///
397 /// #### `visible`
398 /// Readable | Writable
399 ///
400 ///
401 /// #### `width-request`
402 /// Readable | Writable
403 ///
404 ///
405 /// #### `window`
406 /// The widget's window if it is realized, [`None`] otherwise.
407 ///
408 /// Readable
409 /// </details>
410 /// <details><summary><h4>Actionable</h4></summary>
411 ///
412 ///
413 /// #### `action-name`
414 /// Readable | Writable
415 ///
416 ///
417 /// #### `action-target`
418 /// Readable | Writable
419 /// </details>
420 /// <details><summary><h4>Activatable</h4></summary>
421 ///
422 ///
423 /// #### `related-action`
424 /// call `gtk_activatable_do_set_related_action()` when it changes.
425 ///
426 /// Readable | Writable
427 ///
428 ///
429 /// #### `use-action-appearance`
430 /// widget when it changes.
431 ///
432 /// Readable | Writable
433 /// </details>
434 /// <details><summary><h4>FontChooser</h4></summary>
435 ///
436 ///
437 /// #### `font`
438 /// The font description as a string, e.g. "Sans Italic 12".
439 ///
440 /// Readable | Writable
441 ///
442 ///
443 /// #### `font-desc`
444 /// The font description as a [`pango::FontDescription`][crate::pango::FontDescription].
445 ///
446 /// Readable | Writable
447 ///
448 ///
449 /// #### `font-features`
450 /// The selected font features, in a format that is compatible with
451 /// CSS and with Pango attributes.
452 ///
453 /// Readable
454 ///
455 ///
456 /// #### `language`
457 /// The language for which the [`font-features`][struct@crate::FontChooser#font-features] were
458 /// selected, in a format that is compatible with CSS and with Pango
459 /// attributes.
460 ///
461 /// Readable | Writable
462 ///
463 ///
464 /// #### `level`
465 /// The level of granularity to offer for selecting fonts.
466 ///
467 /// Readable | Writable
468 ///
469 ///
470 /// #### `preview-text`
471 /// The string with which to preview the font.
472 ///
473 /// Readable | Writable
474 ///
475 ///
476 /// #### `show-preview-entry`
477 /// Whether to show an entry to change the preview text.
478 ///
479 /// Readable | Writable
480 /// </details>
481 ///
482 /// ## Signals
483 ///
484 ///
485 /// #### `font-set`
486 /// The ::font-set signal is emitted when the user selects a font.
487 /// When handling this signal, use [`FontChooserExt::font()`][crate::prelude::FontChooserExt::font()]
488 /// to find out which font was just selected.
489 ///
490 /// Note that this signal is only emitted when the user
491 /// changes the font. If you need to react to programmatic font changes
492 /// as well, use the notify::font signal.
493 ///
494 ///
495 /// <details><summary><h4>Button</h4></summary>
496 ///
497 ///
498 /// #### `activate`
499 /// The ::activate signal on GtkButton is an action signal and
500 /// emitting it causes the button to animate press then release.
501 /// Applications should never connect to this signal, but use the
502 /// [`clicked`][struct@crate::Button#clicked] signal.
503 ///
504 /// Action
505 ///
506 ///
507 /// #### `clicked`
508 /// Emitted when the button has been activated (pressed and released).
509 ///
510 /// Action
511 ///
512 ///
513 /// #### `enter`
514 /// Emitted when the pointer enters the button.
515 ///
516 ///
517 ///
518 ///
519 /// #### `leave`
520 /// Emitted when the pointer leaves the button.
521 ///
522 ///
523 ///
524 ///
525 /// #### `pressed`
526 /// Emitted when the button is pressed.
527 ///
528 ///
529 ///
530 ///
531 /// #### `released`
532 /// Emitted when the button is released.
533 ///
534 ///
535 /// </details>
536 /// <details><summary><h4>Container</h4></summary>
537 ///
538 ///
539 /// #### `add`
540 ///
541 ///
542 ///
543 /// #### `check-resize`
544 ///
545 ///
546 ///
547 /// #### `remove`
548 ///
549 ///
550 ///
551 /// #### `set-focus-child`
552 ///
553 /// </details>
554 /// <details><summary><h4>Widget</h4></summary>
555 ///
556 ///
557 /// #### `accel-closures-changed`
558 ///
559 ///
560 ///
561 /// #### `button-press-event`
562 /// The ::button-press-event signal will be emitted when a button
563 /// (typically from a mouse) is pressed.
564 ///
565 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
566 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
567 ///
568 /// This signal will be sent to the grab widget if there is one.
569 ///
570 ///
571 ///
572 ///
573 /// #### `button-release-event`
574 /// The ::button-release-event signal will be emitted when a button
575 /// (typically from a mouse) is released.
576 ///
577 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
578 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
579 ///
580 /// This signal will be sent to the grab widget if there is one.
581 ///
582 ///
583 ///
584 ///
585 /// #### `can-activate-accel`
586 /// Determines whether an accelerator that activates the signal
587 /// identified by `signal_id` can currently be activated.
588 /// This signal is present to allow applications and derived
589 /// widgets to override the default [`Widget`][crate::Widget] handling
590 /// for determining whether an accelerator can be activated.
591 ///
592 ///
593 ///
594 ///
595 /// #### `child-notify`
596 /// The ::child-notify signal is emitted for each
597 /// [child property][child-properties] that has
598 /// changed on an object. The signal's detail holds the property name.
599 ///
600 /// Detailed
601 ///
602 ///
603 /// #### `composited-changed`
604 /// The ::composited-changed signal is emitted when the composited
605 /// status of `widgets` screen changes.
606 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
607 ///
608 /// Action
609 ///
610 ///
611 /// #### `configure-event`
612 /// The ::configure-event signal will be emitted when the size, position or
613 /// stacking of the `widget`'s window has changed.
614 ///
615 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
616 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
617 /// automatically for all new windows.
618 ///
619 ///
620 ///
621 ///
622 /// #### `damage-event`
623 /// Emitted when a redirected window belonging to `widget` gets drawn into.
624 /// The region/area members of the event shows what area of the redirected
625 /// drawable was drawn into.
626 ///
627 ///
628 ///
629 ///
630 /// #### `delete-event`
631 /// The ::delete-event signal is emitted if a user requests that
632 /// a toplevel window is closed. The default handler for this signal
633 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
634 /// this signal will cause the window to be hidden instead, so that
635 /// it can later be shown again without reconstructing it.
636 ///
637 ///
638 ///
639 ///
640 /// #### `destroy`
641 /// Signals that all holders of a reference to the widget should release
642 /// the reference that they hold. May result in finalization of the widget
643 /// if all references are released.
644 ///
645 /// This signal is not suitable for saving widget state.
646 ///
647 ///
648 ///
649 ///
650 /// #### `destroy-event`
651 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
652 /// You rarely get this signal, because most widgets disconnect themselves
653 /// from their window before they destroy it, so no widget owns the
654 /// window at destroy time.
655 ///
656 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
657 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
658 /// automatically for all new windows.
659 ///
660 ///
661 ///
662 ///
663 /// #### `direction-changed`
664 /// The ::direction-changed signal is emitted when the text direction
665 /// of a widget changes.
666 ///
667 ///
668 ///
669 ///
670 /// #### `drag-begin`
671 /// The ::drag-begin signal is emitted on the drag source when a drag is
672 /// started. A typical reason to connect to this signal is to set up a
673 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
674 ///
675 /// Note that some widgets set up a drag icon in the default handler of
676 /// this signal, so you may have to use `g_signal_connect_after()` to
677 /// override what the default handler did.
678 ///
679 ///
680 ///
681 ///
682 /// #### `drag-data-delete`
683 /// The ::drag-data-delete signal is emitted on the drag source when a drag
684 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
685 /// handler is responsible for deleting the data that has been dropped. What
686 /// "delete" means depends on the context of the drag operation.
687 ///
688 ///
689 ///
690 ///
691 /// #### `drag-data-get`
692 /// The ::drag-data-get signal is emitted on the drag source when the drop
693 /// site requests the data which is dragged. It is the responsibility of
694 /// the signal handler to fill `data` with the data in the format which
695 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
696 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
697 ///
698 ///
699 ///
700 ///
701 /// #### `drag-data-received`
702 /// format == 8))
703 /// {
704 /// GdkDragAction action;
705 ///
706 /// // handle data here
707 ///
708 /// action = gdk_drag_context_get_selected_action (context);
709 /// if (action == GDK_ACTION_ASK)
710 /// {
711 /// GtkWidget *dialog;
712 /// gint response;
713 ///
714 /// dialog = gtk_message_dialog_new (NULL,
715 /// GTK_DIALOG_MODAL |
716 /// GTK_DIALOG_DESTROY_WITH_PARENT,
717 /// GTK_MESSAGE_INFO,
718 /// GTK_BUTTONS_YES_NO,
719 /// "Move the data ?\n");
720 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
721 /// gtk_widget_destroy (dialog);
722 ///
723 /// if (response == GTK_RESPONSE_YES)
724 /// action = GDK_ACTION_MOVE;
725 /// else
726 /// action = GDK_ACTION_COPY;
727 /// }
728 ///
729 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
730 /// }
731 /// else
732 /// gtk_drag_finish (context, FALSE, FALSE, time);
733 /// }
734 /// ]|
735 ///
736 ///
737 ///
738 ///
739 /// #### `drag-drop`
740 /// The ::drag-drop signal is emitted on the drop site when the user drops
741 /// the data onto the widget. The signal handler must determine whether
742 /// the cursor position is in a drop zone or not. If it is not in a drop
743 /// zone, it returns [`false`] and no further processing is necessary.
744 /// Otherwise, the handler returns [`true`]. In this case, the handler must
745 /// ensure that `gtk_drag_finish()` is called to let the source know that
746 /// the drop is done. The call to `gtk_drag_finish()` can be done either
747 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
748 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
749 /// or more of the supported targets.
750 ///
751 ///
752 ///
753 ///
754 /// #### `drag-end`
755 /// The ::drag-end signal is emitted on the drag source when a drag is
756 /// finished. A typical reason to connect to this signal is to undo
757 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
758 ///
759 ///
760 ///
761 ///
762 /// #### `drag-failed`
763 /// The ::drag-failed signal is emitted on the drag source when a drag has
764 /// failed. The signal handler may hook custom code to handle a failed DnD
765 /// operation based on the type of error, it returns [`true`] is the failure has
766 /// been already handled (not showing the default "drag operation failed"
767 /// animation), otherwise it returns [`false`].
768 ///
769 ///
770 ///
771 ///
772 /// #### `drag-leave`
773 /// The ::drag-leave signal is emitted on the drop site when the cursor
774 /// leaves the widget. A typical reason to connect to this signal is to
775 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
776 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
777 ///
778 ///
779 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
780 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
781 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
782 ///
783 ///
784 ///
785 ///
786 /// #### `drag-motion`
787 /// suggested_action,
788 /// time);
789 /// }
790 /// else
791 /// {
792 /// // accept the drop
793 /// }
794 /// }
795 /// ]|
796 ///
797 ///
798 ///
799 ///
800 /// #### `draw`
801 /// This signal is emitted when a widget is supposed to render itself.
802 /// The `widget`'s top left corner must be painted at the origin of
803 /// the passed in context and be sized to the values returned by
804 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
805 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
806 ///
807 /// Signal handlers connected to this signal can modify the cairo
808 /// context passed as `cr` in any way they like and don't need to
809 /// restore it. The signal emission takes care of calling `cairo_save()`
810 /// before and `cairo_restore()` after invoking the handler.
811 ///
812 /// The signal handler will get a `cr` with a clip region already set to the
813 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
814 /// widgets that want to avoid redrawing themselves completely can get the full
815 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
816 /// get a finer-grained representation of the dirty region with
817 /// `cairo_copy_clip_rectangle_list()`.
818 ///
819 ///
820 ///
821 ///
822 /// #### `enter-notify-event`
823 /// The ::enter-notify-event will be emitted when the pointer enters
824 /// the `widget`'s window.
825 ///
826 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
827 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
828 ///
829 /// This signal will be sent to the grab widget if there is one.
830 ///
831 ///
832 ///
833 ///
834 /// #### `event`
835 /// The GTK+ main loop will emit three signals for each GDK event delivered
836 /// to a widget: one generic ::event signal, another, more specific,
837 /// signal that matches the type of event delivered (e.g.
838 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
839 /// [`event-after`][struct@crate::Widget#event-after] signal.
840 ///
841 ///
842 ///
843 ///
844 /// #### `event-after`
845 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
846 /// the second more specific signal, ::event-after will be emitted
847 /// regardless of the previous two signals handlers return values.
848 ///
849 ///
850 ///
851 ///
852 /// #### `focus`
853 ///
854 ///
855 ///
856 /// #### `focus-in-event`
857 /// The ::focus-in-event signal will be emitted when the keyboard focus
858 /// enters the `widget`'s window.
859 ///
860 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
861 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
862 ///
863 ///
864 ///
865 ///
866 /// #### `focus-out-event`
867 /// The ::focus-out-event signal will be emitted when the keyboard focus
868 /// leaves the `widget`'s window.
869 ///
870 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
871 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
872 ///
873 ///
874 ///
875 ///
876 /// #### `grab-broken-event`
877 /// Emitted when a pointer or keyboard grab on a window belonging
878 /// to `widget` gets broken.
879 ///
880 /// On X11, this happens when the grab window becomes unviewable
881 /// (i.e. it or one of its ancestors is unmapped), or if the same
882 /// application grabs the pointer or keyboard again.
883 ///
884 ///
885 ///
886 ///
887 /// #### `grab-focus`
888 /// Action
889 ///
890 ///
891 /// #### `grab-notify`
892 /// The ::grab-notify signal is emitted when a widget becomes
893 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
894 /// another widget, or when it becomes unshadowed due to a grab
895 /// being removed.
896 ///
897 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
898 /// grab widget in the grab stack of its window group is not
899 /// its ancestor.
900 ///
901 ///
902 ///
903 ///
904 /// #### `hide`
905 /// The ::hide signal is emitted when `widget` is hidden, for example with
906 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
907 ///
908 ///
909 ///
910 ///
911 /// #### `hierarchy-changed`
912 /// The ::hierarchy-changed signal is emitted when the
913 /// anchored state of a widget changes. A widget is
914 /// “anchored” when its toplevel
915 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
916 /// a widget changes from un-anchored to anchored or vice-versa.
917 ///
918 ///
919 ///
920 ///
921 /// #### `key-press-event`
922 /// The ::key-press-event signal is emitted when a key is pressed. The signal
923 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
924 ///
925 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
926 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
927 ///
928 /// This signal will be sent to the grab widget if there is one.
929 ///
930 ///
931 ///
932 ///
933 /// #### `key-release-event`
934 /// The ::key-release-event signal is emitted when a key is released.
935 ///
936 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
937 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
938 ///
939 /// This signal will be sent to the grab widget if there is one.
940 ///
941 ///
942 ///
943 ///
944 /// #### `keynav-failed`
945 /// Gets emitted if keyboard navigation fails.
946 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
947 ///
948 ///
949 ///
950 ///
951 /// #### `leave-notify-event`
952 /// The ::leave-notify-event will be emitted when the pointer leaves
953 /// the `widget`'s window.
954 ///
955 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
956 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
957 ///
958 /// This signal will be sent to the grab widget if there is one.
959 ///
960 ///
961 ///
962 ///
963 /// #### `map`
964 /// The ::map signal is emitted when `widget` is going to be mapped, that is
965 /// when the widget is visible (which is controlled with
966 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
967 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
968 /// be emitted.
969 ///
970 /// The ::map signal can be used to determine whether a widget will be drawn,
971 /// for instance it can resume an animation that was stopped during the
972 /// emission of [`unmap`][struct@crate::Widget#unmap].
973 ///
974 ///
975 ///
976 ///
977 /// #### `map-event`
978 /// The ::map-event signal will be emitted when the `widget`'s window is
979 /// mapped. A window is mapped when it becomes visible on the screen.
980 ///
981 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
982 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
983 /// automatically for all new windows.
984 ///
985 ///
986 ///
987 ///
988 /// #### `mnemonic-activate`
989 /// The default handler for this signal activates `widget` if `group_cycling`
990 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
991 ///
992 ///
993 ///
994 ///
995 /// #### `motion-notify-event`
996 /// The ::motion-notify-event signal is emitted when the pointer moves
997 /// over the widget's [`gdk::Window`][crate::gdk::Window].
998 ///
999 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1000 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1001 ///
1002 /// This signal will be sent to the grab widget if there is one.
1003 ///
1004 ///
1005 ///
1006 ///
1007 /// #### `move-focus`
1008 /// Action
1009 ///
1010 ///
1011 /// #### `parent-set`
1012 /// The ::parent-set signal is emitted when a new parent
1013 /// has been set on a widget.
1014 ///
1015 ///
1016 ///
1017 ///
1018 /// #### `popup-menu`
1019 /// This signal gets emitted whenever a widget should pop up a context
1020 /// menu. This usually happens through the standard key binding mechanism;
1021 /// by pressing a certain key while a widget is focused, the user can cause
1022 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1023 /// a menu with clipboard commands. See the
1024 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1025 /// for an example of how to use this signal.
1026 ///
1027 /// Action
1028 ///
1029 ///
1030 /// #### `property-notify-event`
1031 /// The ::property-notify-event signal will be emitted when a property on
1032 /// the `widget`'s window has been changed or deleted.
1033 ///
1034 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1035 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1036 ///
1037 ///
1038 ///
1039 ///
1040 /// #### `proximity-in-event`
1041 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1042 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1043 ///
1044 /// This signal will be sent to the grab widget if there is one.
1045 ///
1046 ///
1047 ///
1048 ///
1049 /// #### `proximity-out-event`
1050 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1051 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1052 ///
1053 /// This signal will be sent to the grab widget if there is one.
1054 ///
1055 ///
1056 ///
1057 ///
1058 /// #### `query-tooltip`
1059 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1060 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1061 /// focus in keyboard mode.
1062 ///
1063 /// Using the given coordinates, the signal handler should determine
1064 /// whether a tooltip should be shown for `widget`. If this is the case
1065 /// [`true`] should be returned, [`false`] otherwise. Note that if
1066 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1067 /// should not be used.
1068 ///
1069 /// The signal handler is free to manipulate `tooltip` with the therefore
1070 /// destined function calls.
1071 ///
1072 ///
1073 ///
1074 ///
1075 /// #### `realize`
1076 /// The ::realize signal is emitted when `widget` is associated with a
1077 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1078 /// widget has been mapped (that is, it is going to be drawn).
1079 ///
1080 ///
1081 ///
1082 ///
1083 /// #### `screen-changed`
1084 /// The ::screen-changed signal gets emitted when the
1085 /// screen of a widget has changed.
1086 ///
1087 ///
1088 ///
1089 ///
1090 /// #### `scroll-event`
1091 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1092 /// range is pressed. Wheel mice are usually configured to generate
1093 /// button press events for buttons 4 and 5 when the wheel is turned.
1094 ///
1095 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1096 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1097 ///
1098 /// This signal will be sent to the grab widget if there is one.
1099 ///
1100 ///
1101 ///
1102 ///
1103 /// #### `selection-clear-event`
1104 /// The ::selection-clear-event signal will be emitted when the
1105 /// the `widget`'s window has lost ownership of a selection.
1106 ///
1107 ///
1108 ///
1109 ///
1110 /// #### `selection-get`
1111 ///
1112 ///
1113 ///
1114 /// #### `selection-notify-event`
1115 ///
1116 ///
1117 ///
1118 /// #### `selection-received`
1119 ///
1120 ///
1121 ///
1122 /// #### `selection-request-event`
1123 /// The ::selection-request-event signal will be emitted when
1124 /// another client requests ownership of the selection owned by
1125 /// the `widget`'s window.
1126 ///
1127 ///
1128 ///
1129 ///
1130 /// #### `show`
1131 /// The ::show signal is emitted when `widget` is shown, for example with
1132 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1133 ///
1134 ///
1135 ///
1136 ///
1137 /// #### `show-help`
1138 /// Action
1139 ///
1140 ///
1141 /// #### `size-allocate`
1142 ///
1143 ///
1144 ///
1145 /// #### `state-changed`
1146 /// The ::state-changed signal is emitted when the widget state changes.
1147 /// See `gtk_widget_get_state()`.
1148 ///
1149 ///
1150 ///
1151 ///
1152 /// #### `state-flags-changed`
1153 /// The ::state-flags-changed signal is emitted when the widget state
1154 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1155 ///
1156 ///
1157 ///
1158 ///
1159 /// #### `style-set`
1160 /// The ::style-set signal is emitted when a new style has been set
1161 /// on a widget. Note that style-modifying functions like
1162 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1163 ///
1164 /// Note that this signal is emitted for changes to the deprecated
1165 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1166 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1167 ///
1168 ///
1169 ///
1170 ///
1171 /// #### `style-updated`
1172 /// The ::style-updated signal is a convenience signal that is emitted when the
1173 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1174 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1175 ///
1176 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1177 /// cause this signal to be emitted.
1178 ///
1179 ///
1180 ///
1181 ///
1182 /// #### `touch-event`
1183 ///
1184 ///
1185 ///
1186 /// #### `unmap`
1187 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1188 /// means that either it or any of its parents up to the toplevel widget have
1189 /// been set as hidden.
1190 ///
1191 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1192 /// used to, for example, stop an animation on the widget.
1193 ///
1194 ///
1195 ///
1196 ///
1197 /// #### `unmap-event`
1198 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1199 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1200 ///
1201 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1202 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1203 /// automatically for all new windows.
1204 ///
1205 ///
1206 ///
1207 ///
1208 /// #### `unrealize`
1209 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1210 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1211 /// called or the widget has been unmapped (that is, it is going to be
1212 /// hidden).
1213 ///
1214 ///
1215 ///
1216 ///
1217 /// #### `visibility-notify-event`
1218 /// The ::visibility-notify-event will be emitted when the `widget`'s
1219 /// window is obscured or unobscured.
1220 ///
1221 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1222 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1223 ///
1224 ///
1225 ///
1226 ///
1227 /// #### `window-state-event`
1228 /// The ::window-state-event will be emitted when the state of the
1229 /// toplevel window associated to the `widget` changes.
1230 ///
1231 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1232 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1233 /// this mask automatically for all new windows.
1234 ///
1235 ///
1236 /// </details>
1237 /// <details><summary><h4>FontChooser</h4></summary>
1238 ///
1239 ///
1240 /// #### `font-activated`
1241 /// Emitted when a font is activated.
1242 /// This usually happens when the user double clicks an item,
1243 /// or an item is selected and the user presses one of the keys
1244 /// Space, Shift+Space, Return or Enter.
1245 ///
1246 ///
1247 /// </details>
1248 ///
1249 /// # Implements
1250 ///
1251 /// [`FontButtonExt`][trait@crate::prelude::FontButtonExt], [`ButtonExt`][trait@crate::prelude::ButtonExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ActionableExt`][trait@crate::prelude::ActionableExt], [`FontChooserExt`][trait@crate::prelude::FontChooserExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1252 #[doc(alias = "GtkFontButton")]
1253 pub struct FontButton(Object<ffi::GtkFontButton, ffi::GtkFontButtonClass>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable, FontChooser;
1254
1255 match fn {
1256 type_ => || ffi::gtk_font_button_get_type(),
1257 }
1258}
1259
1260impl FontButton {
1261 pub const NONE: Option<&'static FontButton> = None;
1262
1263 /// Creates a new font picker widget.
1264 ///
1265 /// # Returns
1266 ///
1267 /// a new font picker widget.
1268 #[doc(alias = "gtk_font_button_new")]
1269 pub fn new() -> FontButton {
1270 assert_initialized_main_thread!();
1271 unsafe { Widget::from_glib_none(ffi::gtk_font_button_new()).unsafe_cast() }
1272 }
1273
1274 /// Creates a new font picker widget.
1275 /// ## `fontname`
1276 /// Name of font to display in font chooser dialog
1277 ///
1278 /// # Returns
1279 ///
1280 /// a new font picker widget.
1281 #[doc(alias = "gtk_font_button_new_with_font")]
1282 #[doc(alias = "new_with_font")]
1283 pub fn with_font(fontname: &str) -> FontButton {
1284 assert_initialized_main_thread!();
1285 unsafe {
1286 Widget::from_glib_none(ffi::gtk_font_button_new_with_font(
1287 fontname.to_glib_none().0,
1288 ))
1289 .unsafe_cast()
1290 }
1291 }
1292
1293 // rustdoc-stripper-ignore-next
1294 /// Creates a new builder-pattern struct instance to construct [`FontButton`] objects.
1295 ///
1296 /// This method returns an instance of [`FontButtonBuilder`](crate::builders::FontButtonBuilder) which can be used to create [`FontButton`] objects.
1297 pub fn builder() -> FontButtonBuilder {
1298 FontButtonBuilder::new()
1299 }
1300}
1301
1302impl Default for FontButton {
1303 fn default() -> Self {
1304 Self::new()
1305 }
1306}
1307
1308// rustdoc-stripper-ignore-next
1309/// A [builder-pattern] type to construct [`FontButton`] objects.
1310///
1311/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1312#[must_use = "The builder must be built to be used"]
1313pub struct FontButtonBuilder {
1314 builder: glib::object::ObjectBuilder<'static, FontButton>,
1315}
1316
1317impl FontButtonBuilder {
1318 fn new() -> Self {
1319 Self {
1320 builder: glib::object::Object::builder(),
1321 }
1322 }
1323
1324 /// If this property is set to [`true`], the selected font size will be shown
1325 /// in the label. For a more WYSIWYG way to show the selected size, see the
1326 /// ::use-size property.
1327 pub fn show_size(self, show_size: bool) -> Self {
1328 Self {
1329 builder: self.builder.property("show-size", show_size),
1330 }
1331 }
1332
1333 /// If this property is set to [`true`], the name of the selected font style
1334 /// will be shown in the label. For a more WYSIWYG way to show the selected
1335 /// style, see the ::use-font property.
1336 pub fn show_style(self, show_style: bool) -> Self {
1337 Self {
1338 builder: self.builder.property("show-style", show_style),
1339 }
1340 }
1341
1342 /// The title of the font chooser dialog.
1343 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1344 Self {
1345 builder: self.builder.property("title", title.into()),
1346 }
1347 }
1348
1349 /// If this property is set to [`true`], the label will be drawn
1350 /// in the selected font.
1351 pub fn use_font(self, use_font: bool) -> Self {
1352 Self {
1353 builder: self.builder.property("use-font", use_font),
1354 }
1355 }
1356
1357 /// If this property is set to [`true`], the label will be drawn
1358 /// with the selected font size.
1359 pub fn use_size(self, use_size: bool) -> Self {
1360 Self {
1361 builder: self.builder.property("use-size", use_size),
1362 }
1363 }
1364
1365 /// If [`true`], the button will ignore the [`gtk-button-images`][struct@crate::Settings#gtk-button-images]
1366 /// setting and always show the image, if available.
1367 ///
1368 /// Use this property if the button would be useless or hard to use
1369 /// without the image.
1370 pub fn always_show_image(self, always_show_image: bool) -> Self {
1371 Self {
1372 builder: self
1373 .builder
1374 .property("always-show-image", always_show_image),
1375 }
1376 }
1377
1378 /// The child widget to appear next to the button text.
1379 pub fn image(self, image: &impl IsA<Widget>) -> Self {
1380 Self {
1381 builder: self.builder.property("image", image.clone().upcast()),
1382 }
1383 }
1384
1385 /// The position of the image relative to the text inside the button.
1386 pub fn image_position(self, image_position: PositionType) -> Self {
1387 Self {
1388 builder: self.builder.property("image-position", image_position),
1389 }
1390 }
1391
1392 pub fn label(self, label: impl Into<glib::GString>) -> Self {
1393 Self {
1394 builder: self.builder.property("label", label.into()),
1395 }
1396 }
1397
1398 pub fn relief(self, relief: ReliefStyle) -> Self {
1399 Self {
1400 builder: self.builder.property("relief", relief),
1401 }
1402 }
1403
1404 pub fn use_underline(self, use_underline: bool) -> Self {
1405 Self {
1406 builder: self.builder.property("use-underline", use_underline),
1407 }
1408 }
1409
1410 pub fn border_width(self, border_width: u32) -> Self {
1411 Self {
1412 builder: self.builder.property("border-width", border_width),
1413 }
1414 }
1415
1416 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1417 Self {
1418 builder: self.builder.property("child", child.clone().upcast()),
1419 }
1420 }
1421
1422 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1423 Self {
1424 builder: self.builder.property("resize-mode", resize_mode),
1425 }
1426 }
1427
1428 pub fn app_paintable(self, app_paintable: bool) -> Self {
1429 Self {
1430 builder: self.builder.property("app-paintable", app_paintable),
1431 }
1432 }
1433
1434 pub fn can_default(self, can_default: bool) -> Self {
1435 Self {
1436 builder: self.builder.property("can-default", can_default),
1437 }
1438 }
1439
1440 pub fn can_focus(self, can_focus: bool) -> Self {
1441 Self {
1442 builder: self.builder.property("can-focus", can_focus),
1443 }
1444 }
1445
1446 pub fn events(self, events: gdk::EventMask) -> Self {
1447 Self {
1448 builder: self.builder.property("events", events),
1449 }
1450 }
1451
1452 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1453 pub fn expand(self, expand: bool) -> Self {
1454 Self {
1455 builder: self.builder.property("expand", expand),
1456 }
1457 }
1458
1459 /// Whether the widget should grab focus when it is clicked with the mouse.
1460 ///
1461 /// This property is only relevant for widgets that can take focus.
1462 ///
1463 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1464 /// GtkComboBox) implemented this property individually.
1465 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1466 Self {
1467 builder: self.builder.property("focus-on-click", focus_on_click),
1468 }
1469 }
1470
1471 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1472 pub fn halign(self, halign: Align) -> Self {
1473 Self {
1474 builder: self.builder.property("halign", halign),
1475 }
1476 }
1477
1478 pub fn has_default(self, has_default: bool) -> Self {
1479 Self {
1480 builder: self.builder.property("has-default", has_default),
1481 }
1482 }
1483
1484 pub fn has_focus(self, has_focus: bool) -> Self {
1485 Self {
1486 builder: self.builder.property("has-focus", has_focus),
1487 }
1488 }
1489
1490 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1491 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1492 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1493 /// whether it will provide a tooltip or not.
1494 ///
1495 /// Note that setting this property to [`true`] for the first time will change
1496 /// the event masks of the GdkWindows of this widget to include leave-notify
1497 /// and motion-notify events. This cannot and will not be undone when the
1498 /// property is set to [`false`] again.
1499 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1500 Self {
1501 builder: self.builder.property("has-tooltip", has_tooltip),
1502 }
1503 }
1504
1505 pub fn height_request(self, height_request: i32) -> Self {
1506 Self {
1507 builder: self.builder.property("height-request", height_request),
1508 }
1509 }
1510
1511 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1512 pub fn hexpand(self, hexpand: bool) -> Self {
1513 Self {
1514 builder: self.builder.property("hexpand", hexpand),
1515 }
1516 }
1517
1518 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1519 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1520 Self {
1521 builder: self.builder.property("hexpand-set", hexpand_set),
1522 }
1523 }
1524
1525 pub fn is_focus(self, is_focus: bool) -> Self {
1526 Self {
1527 builder: self.builder.property("is-focus", is_focus),
1528 }
1529 }
1530
1531 /// Sets all four sides' margin at once. If read, returns max
1532 /// margin on any side.
1533 pub fn margin(self, margin: i32) -> Self {
1534 Self {
1535 builder: self.builder.property("margin", margin),
1536 }
1537 }
1538
1539 /// Margin on bottom side of widget.
1540 ///
1541 /// This property adds margin outside of the widget's normal size
1542 /// request, the margin will be added in addition to the size from
1543 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1544 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1545 Self {
1546 builder: self.builder.property("margin-bottom", margin_bottom),
1547 }
1548 }
1549
1550 /// Margin on end of widget, horizontally. This property supports
1551 /// left-to-right and right-to-left text directions.
1552 ///
1553 /// This property adds margin outside of the widget's normal size
1554 /// request, the margin will be added in addition to the size from
1555 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1556 pub fn margin_end(self, margin_end: i32) -> Self {
1557 Self {
1558 builder: self.builder.property("margin-end", margin_end),
1559 }
1560 }
1561
1562 /// Margin on start of widget, horizontally. This property supports
1563 /// left-to-right and right-to-left text directions.
1564 ///
1565 /// This property adds margin outside of the widget's normal size
1566 /// request, the margin will be added in addition to the size from
1567 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1568 pub fn margin_start(self, margin_start: i32) -> Self {
1569 Self {
1570 builder: self.builder.property("margin-start", margin_start),
1571 }
1572 }
1573
1574 /// Margin on top side of widget.
1575 ///
1576 /// This property adds margin outside of the widget's normal size
1577 /// request, the margin will be added in addition to the size from
1578 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1579 pub fn margin_top(self, margin_top: i32) -> Self {
1580 Self {
1581 builder: self.builder.property("margin-top", margin_top),
1582 }
1583 }
1584
1585 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1586 Self {
1587 builder: self.builder.property("name", name.into()),
1588 }
1589 }
1590
1591 pub fn no_show_all(self, no_show_all: bool) -> Self {
1592 Self {
1593 builder: self.builder.property("no-show-all", no_show_all),
1594 }
1595 }
1596
1597 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1598 /// more details about window opacity.
1599 ///
1600 /// Before 3.8 this was only available in GtkWindow
1601 pub fn opacity(self, opacity: f64) -> Self {
1602 Self {
1603 builder: self.builder.property("opacity", opacity),
1604 }
1605 }
1606
1607 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1608 Self {
1609 builder: self.builder.property("parent", parent.clone().upcast()),
1610 }
1611 }
1612
1613 pub fn receives_default(self, receives_default: bool) -> Self {
1614 Self {
1615 builder: self.builder.property("receives-default", receives_default),
1616 }
1617 }
1618
1619 pub fn sensitive(self, sensitive: bool) -> Self {
1620 Self {
1621 builder: self.builder.property("sensitive", sensitive),
1622 }
1623 }
1624
1625 /// Sets the text of tooltip to be the given string, which is marked up
1626 /// with the [Pango text markup language][PangoMarkupFormat].
1627 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1628 ///
1629 /// This is a convenience property which will take care of getting the
1630 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1631 /// will automatically be set to [`true`] and there will be taken care of
1632 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1633 ///
1634 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1635 /// are set, the last one wins.
1636 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1637 Self {
1638 builder: self
1639 .builder
1640 .property("tooltip-markup", tooltip_markup.into()),
1641 }
1642 }
1643
1644 /// Sets the text of tooltip to be the given string.
1645 ///
1646 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1647 ///
1648 /// This is a convenience property which will take care of getting the
1649 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1650 /// will automatically be set to [`true`] and there will be taken care of
1651 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1652 ///
1653 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1654 /// are set, the last one wins.
1655 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1656 Self {
1657 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1658 }
1659 }
1660
1661 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1662 pub fn valign(self, valign: Align) -> Self {
1663 Self {
1664 builder: self.builder.property("valign", valign),
1665 }
1666 }
1667
1668 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1669 pub fn vexpand(self, vexpand: bool) -> Self {
1670 Self {
1671 builder: self.builder.property("vexpand", vexpand),
1672 }
1673 }
1674
1675 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1676 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1677 Self {
1678 builder: self.builder.property("vexpand-set", vexpand_set),
1679 }
1680 }
1681
1682 pub fn visible(self, visible: bool) -> Self {
1683 Self {
1684 builder: self.builder.property("visible", visible),
1685 }
1686 }
1687
1688 pub fn width_request(self, width_request: i32) -> Self {
1689 Self {
1690 builder: self.builder.property("width-request", width_request),
1691 }
1692 }
1693
1694 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1695 Self {
1696 builder: self.builder.property("action-name", action_name.into()),
1697 }
1698 }
1699
1700 pub fn action_target(self, action_target: &glib::Variant) -> Self {
1701 Self {
1702 builder: self
1703 .builder
1704 .property("action-target", action_target.clone()),
1705 }
1706 }
1707
1708 /// The font description as a string, e.g. "Sans Italic 12".
1709 pub fn font(self, font: impl Into<glib::GString>) -> Self {
1710 Self {
1711 builder: self.builder.property("font", font.into()),
1712 }
1713 }
1714
1715 /// The font description as a [`pango::FontDescription`][crate::pango::FontDescription].
1716 pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
1717 Self {
1718 builder: self.builder.property("font-desc", font_desc),
1719 }
1720 }
1721
1722 /// The language for which the [`font-features`][struct@crate::FontChooser#font-features] were
1723 /// selected, in a format that is compatible with CSS and with Pango
1724 /// attributes.
1725 #[cfg(feature = "v3_24")]
1726 #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
1727 pub fn language(self, language: impl Into<glib::GString>) -> Self {
1728 Self {
1729 builder: self.builder.property("language", language.into()),
1730 }
1731 }
1732
1733 /// The level of granularity to offer for selecting fonts.
1734 #[cfg(feature = "v3_24")]
1735 #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
1736 pub fn level(self, level: FontChooserLevel) -> Self {
1737 Self {
1738 builder: self.builder.property("level", level),
1739 }
1740 }
1741
1742 /// The string with which to preview the font.
1743 pub fn preview_text(self, preview_text: impl Into<glib::GString>) -> Self {
1744 Self {
1745 builder: self.builder.property("preview-text", preview_text.into()),
1746 }
1747 }
1748
1749 /// Whether to show an entry to change the preview text.
1750 pub fn show_preview_entry(self, show_preview_entry: bool) -> Self {
1751 Self {
1752 builder: self
1753 .builder
1754 .property("show-preview-entry", show_preview_entry),
1755 }
1756 }
1757
1758 // rustdoc-stripper-ignore-next
1759 /// Build the [`FontButton`].
1760 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1761 pub fn build(self) -> FontButton {
1762 assert_initialized_main_thread!();
1763 self.builder.build()
1764 }
1765}
1766
1767/// Trait containing all [`struct@FontButton`] methods.
1768///
1769/// # Implementors
1770///
1771/// [`FontButton`][struct@crate::FontButton]
1772pub trait FontButtonExt: IsA<FontButton> + 'static {
1773 /// Returns whether the font size will be shown in the label.
1774 ///
1775 /// # Returns
1776 ///
1777 /// whether the font size will be shown in the label.
1778 #[doc(alias = "gtk_font_button_get_show_size")]
1779 #[doc(alias = "get_show_size")]
1780 #[doc(alias = "show-size")]
1781 fn shows_size(&self) -> bool {
1782 unsafe {
1783 from_glib(ffi::gtk_font_button_get_show_size(
1784 self.as_ref().to_glib_none().0,
1785 ))
1786 }
1787 }
1788
1789 /// Returns whether the name of the font style will be shown in the label.
1790 ///
1791 /// # Returns
1792 ///
1793 /// whether the font style will be shown in the label.
1794 #[doc(alias = "gtk_font_button_get_show_style")]
1795 #[doc(alias = "get_show_style")]
1796 #[doc(alias = "show-style")]
1797 fn shows_style(&self) -> bool {
1798 unsafe {
1799 from_glib(ffi::gtk_font_button_get_show_style(
1800 self.as_ref().to_glib_none().0,
1801 ))
1802 }
1803 }
1804
1805 /// Retrieves the title of the font chooser dialog.
1806 ///
1807 /// # Returns
1808 ///
1809 /// an internal copy of the title string which must not be freed.
1810 #[doc(alias = "gtk_font_button_get_title")]
1811 #[doc(alias = "get_title")]
1812 fn title(&self) -> Option<glib::GString> {
1813 unsafe {
1814 from_glib_none(ffi::gtk_font_button_get_title(
1815 self.as_ref().to_glib_none().0,
1816 ))
1817 }
1818 }
1819
1820 /// Returns whether the selected font is used in the label.
1821 ///
1822 /// # Returns
1823 ///
1824 /// whether the selected font is used in the label.
1825 #[doc(alias = "gtk_font_button_get_use_font")]
1826 #[doc(alias = "get_use_font")]
1827 #[doc(alias = "use-font")]
1828 fn uses_font(&self) -> bool {
1829 unsafe {
1830 from_glib(ffi::gtk_font_button_get_use_font(
1831 self.as_ref().to_glib_none().0,
1832 ))
1833 }
1834 }
1835
1836 /// Returns whether the selected size is used in the label.
1837 ///
1838 /// # Returns
1839 ///
1840 /// whether the selected size is used in the label.
1841 #[doc(alias = "gtk_font_button_get_use_size")]
1842 #[doc(alias = "get_use_size")]
1843 #[doc(alias = "use-size")]
1844 fn uses_size(&self) -> bool {
1845 unsafe {
1846 from_glib(ffi::gtk_font_button_get_use_size(
1847 self.as_ref().to_glib_none().0,
1848 ))
1849 }
1850 }
1851
1852 /// If `show_size` is [`true`], the font size will be displayed along with the name of the selected font.
1853 /// ## `show_size`
1854 /// [`true`] if font size should be displayed in dialog.
1855 #[doc(alias = "gtk_font_button_set_show_size")]
1856 #[doc(alias = "show-size")]
1857 fn set_show_size(&self, show_size: bool) {
1858 unsafe {
1859 ffi::gtk_font_button_set_show_size(
1860 self.as_ref().to_glib_none().0,
1861 show_size.into_glib(),
1862 );
1863 }
1864 }
1865
1866 /// If `show_style` is [`true`], the font style will be displayed along with name of the selected font.
1867 /// ## `show_style`
1868 /// [`true`] if font style should be displayed in label.
1869 #[doc(alias = "gtk_font_button_set_show_style")]
1870 #[doc(alias = "show-style")]
1871 fn set_show_style(&self, show_style: bool) {
1872 unsafe {
1873 ffi::gtk_font_button_set_show_style(
1874 self.as_ref().to_glib_none().0,
1875 show_style.into_glib(),
1876 );
1877 }
1878 }
1879
1880 /// Sets the title for the font chooser dialog.
1881 /// ## `title`
1882 /// a string containing the font chooser dialog title
1883 #[doc(alias = "gtk_font_button_set_title")]
1884 #[doc(alias = "title")]
1885 fn set_title(&self, title: &str) {
1886 unsafe {
1887 ffi::gtk_font_button_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
1888 }
1889 }
1890
1891 /// If `use_font` is [`true`], the font name will be written using the selected font.
1892 /// ## `use_font`
1893 /// If [`true`], font name will be written using font chosen.
1894 #[doc(alias = "gtk_font_button_set_use_font")]
1895 #[doc(alias = "use-font")]
1896 fn set_use_font(&self, use_font: bool) {
1897 unsafe {
1898 ffi::gtk_font_button_set_use_font(self.as_ref().to_glib_none().0, use_font.into_glib());
1899 }
1900 }
1901
1902 /// If `use_size` is [`true`], the font name will be written using the selected size.
1903 /// ## `use_size`
1904 /// If [`true`], font name will be written using the selected size.
1905 #[doc(alias = "gtk_font_button_set_use_size")]
1906 #[doc(alias = "use-size")]
1907 fn set_use_size(&self, use_size: bool) {
1908 unsafe {
1909 ffi::gtk_font_button_set_use_size(self.as_ref().to_glib_none().0, use_size.into_glib());
1910 }
1911 }
1912
1913 /// The ::font-set signal is emitted when the user selects a font.
1914 /// When handling this signal, use [`FontChooserExt::font()`][crate::prelude::FontChooserExt::font()]
1915 /// to find out which font was just selected.
1916 ///
1917 /// Note that this signal is only emitted when the user
1918 /// changes the font. If you need to react to programmatic font changes
1919 /// as well, use the notify::font signal.
1920 #[doc(alias = "font-set")]
1921 fn connect_font_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1922 unsafe extern "C" fn font_set_trampoline<P: IsA<FontButton>, F: Fn(&P) + 'static>(
1923 this: *mut ffi::GtkFontButton,
1924 f: glib::ffi::gpointer,
1925 ) {
1926 unsafe {
1927 let f: &F = &*(f as *const F);
1928 f(FontButton::from_glib_borrow(this).unsafe_cast_ref())
1929 }
1930 }
1931 unsafe {
1932 let f: Box_<F> = Box_::new(f);
1933 connect_raw(
1934 self.as_ptr() as *mut _,
1935 c"font-set".as_ptr(),
1936 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1937 font_set_trampoline::<Self, F> as *const (),
1938 )),
1939 Box_::into_raw(f),
1940 )
1941 }
1942 }
1943
1944 #[doc(alias = "show-size")]
1945 fn connect_show_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1946 unsafe extern "C" fn notify_show_size_trampoline<
1947 P: IsA<FontButton>,
1948 F: Fn(&P) + 'static,
1949 >(
1950 this: *mut ffi::GtkFontButton,
1951 _param_spec: glib::ffi::gpointer,
1952 f: glib::ffi::gpointer,
1953 ) {
1954 unsafe {
1955 let f: &F = &*(f as *const F);
1956 f(FontButton::from_glib_borrow(this).unsafe_cast_ref())
1957 }
1958 }
1959 unsafe {
1960 let f: Box_<F> = Box_::new(f);
1961 connect_raw(
1962 self.as_ptr() as *mut _,
1963 c"notify::show-size".as_ptr(),
1964 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1965 notify_show_size_trampoline::<Self, F> as *const (),
1966 )),
1967 Box_::into_raw(f),
1968 )
1969 }
1970 }
1971
1972 #[doc(alias = "show-style")]
1973 fn connect_show_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1974 unsafe extern "C" fn notify_show_style_trampoline<
1975 P: IsA<FontButton>,
1976 F: Fn(&P) + 'static,
1977 >(
1978 this: *mut ffi::GtkFontButton,
1979 _param_spec: glib::ffi::gpointer,
1980 f: glib::ffi::gpointer,
1981 ) {
1982 unsafe {
1983 let f: &F = &*(f as *const F);
1984 f(FontButton::from_glib_borrow(this).unsafe_cast_ref())
1985 }
1986 }
1987 unsafe {
1988 let f: Box_<F> = Box_::new(f);
1989 connect_raw(
1990 self.as_ptr() as *mut _,
1991 c"notify::show-style".as_ptr(),
1992 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1993 notify_show_style_trampoline::<Self, F> as *const (),
1994 )),
1995 Box_::into_raw(f),
1996 )
1997 }
1998 }
1999
2000 #[doc(alias = "title")]
2001 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2002 unsafe extern "C" fn notify_title_trampoline<P: IsA<FontButton>, F: Fn(&P) + 'static>(
2003 this: *mut ffi::GtkFontButton,
2004 _param_spec: glib::ffi::gpointer,
2005 f: glib::ffi::gpointer,
2006 ) {
2007 unsafe {
2008 let f: &F = &*(f as *const F);
2009 f(FontButton::from_glib_borrow(this).unsafe_cast_ref())
2010 }
2011 }
2012 unsafe {
2013 let f: Box_<F> = Box_::new(f);
2014 connect_raw(
2015 self.as_ptr() as *mut _,
2016 c"notify::title".as_ptr(),
2017 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2018 notify_title_trampoline::<Self, F> as *const (),
2019 )),
2020 Box_::into_raw(f),
2021 )
2022 }
2023 }
2024
2025 #[doc(alias = "use-font")]
2026 fn connect_use_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2027 unsafe extern "C" fn notify_use_font_trampoline<P: IsA<FontButton>, F: Fn(&P) + 'static>(
2028 this: *mut ffi::GtkFontButton,
2029 _param_spec: glib::ffi::gpointer,
2030 f: glib::ffi::gpointer,
2031 ) {
2032 unsafe {
2033 let f: &F = &*(f as *const F);
2034 f(FontButton::from_glib_borrow(this).unsafe_cast_ref())
2035 }
2036 }
2037 unsafe {
2038 let f: Box_<F> = Box_::new(f);
2039 connect_raw(
2040 self.as_ptr() as *mut _,
2041 c"notify::use-font".as_ptr(),
2042 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2043 notify_use_font_trampoline::<Self, F> as *const (),
2044 )),
2045 Box_::into_raw(f),
2046 )
2047 }
2048 }
2049
2050 #[doc(alias = "use-size")]
2051 fn connect_use_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2052 unsafe extern "C" fn notify_use_size_trampoline<P: IsA<FontButton>, F: Fn(&P) + 'static>(
2053 this: *mut ffi::GtkFontButton,
2054 _param_spec: glib::ffi::gpointer,
2055 f: glib::ffi::gpointer,
2056 ) {
2057 unsafe {
2058 let f: &F = &*(f as *const F);
2059 f(FontButton::from_glib_borrow(this).unsafe_cast_ref())
2060 }
2061 }
2062 unsafe {
2063 let f: Box_<F> = Box_::new(f);
2064 connect_raw(
2065 self.as_ptr() as *mut _,
2066 c"notify::use-size".as_ptr(),
2067 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2068 notify_use_size_trampoline::<Self, F> as *const (),
2069 )),
2070 Box_::into_raw(f),
2071 )
2072 }
2073 }
2074}
2075
2076impl<O: IsA<FontButton>> FontButtonExt for O {}