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