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