Skip to main content

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