Skip to main content

gtk/auto/
scale.rs

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