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