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