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