Skip to main content

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