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