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