atk/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 glib::translate::*;
6
7glib::wrapper! {
8 /// A given range or subrange, to be used with [`Value`][crate::Value]
9 ///
10 /// [`Range`][crate::Range] are used on [`Value`][crate::Value], in order to represent the full
11 /// range of a given component (for example an slider or a range
12 /// control), or to define each individual subrange this full range is
13 /// splitted if available. See [`Value`][crate::Value] documentation for further
14 /// details.
15 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
16 pub struct Range(Boxed<ffi::AtkRange>);
17
18 match fn {
19 copy => |ptr| ffi::atk_range_copy(mut_override(ptr)),
20 free => |ptr| ffi::atk_range_free(ptr),
21 type_ => || ffi::atk_range_get_type(),
22 }
23}
24
25impl Range {
26 /// Creates a new [`Range`][crate::Range].
27 /// ## `lower_limit`
28 /// inferior limit for this range
29 /// ## `upper_limit`
30 /// superior limit for this range
31 /// ## `description`
32 /// human readable description of this range.
33 ///
34 /// # Returns
35 ///
36 /// a new [`Range`][crate::Range]
37 #[doc(alias = "atk_range_new")]
38 pub fn new(lower_limit: f64, upper_limit: f64, description: &str) -> Range {
39 assert_initialized_main_thread!();
40 unsafe {
41 from_glib_full(ffi::atk_range_new(
42 lower_limit,
43 upper_limit,
44 description.to_glib_none().0,
45 ))
46 }
47 }
48
49 /// Returns the human readable description of `self`
50 ///
51 /// # Returns
52 ///
53 /// the human-readable description of `self`
54 #[doc(alias = "atk_range_get_description")]
55 #[doc(alias = "get_description")]
56 pub fn description(&mut self) -> Option<glib::GString> {
57 unsafe { from_glib_none(ffi::atk_range_get_description(self.to_glib_none_mut().0)) }
58 }
59
60 /// Returns the lower limit of `self`
61 ///
62 /// # Returns
63 ///
64 /// the lower limit of `self`
65 #[doc(alias = "atk_range_get_lower_limit")]
66 #[doc(alias = "get_lower_limit")]
67 pub fn lower_limit(&mut self) -> f64 {
68 unsafe { ffi::atk_range_get_lower_limit(self.to_glib_none_mut().0) }
69 }
70
71 /// Returns the upper limit of `self`
72 ///
73 /// # Returns
74 ///
75 /// the upper limit of `self`
76 #[doc(alias = "atk_range_get_upper_limit")]
77 #[doc(alias = "get_upper_limit")]
78 pub fn upper_limit(&mut self) -> f64 {
79 unsafe { ffi::atk_range_get_upper_limit(self.to_glib_none_mut().0) }
80 }
81}