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