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