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