gtk4/
constraint_guide.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use std::mem::MaybeUninit;
4
5use glib::translate::*;
6
7use crate::{ffi, ConstraintGuide};
8
9impl ConstraintGuide {
10    /// Gets the maximum size of @self.
11    ///
12    /// # Returns
13    ///
14    ///
15    /// ## `width`
16    /// return location for the maximum width
17    ///
18    /// ## `height`
19    /// return location for the maximum height
20    #[doc(alias = "gtk_constraint_guide_get_max_size")]
21    #[doc(alias = "get_max_size")]
22    pub fn max_size(&self) -> (i32, i32) {
23        unsafe {
24            let mut width = MaybeUninit::uninit();
25            let mut height = MaybeUninit::uninit();
26            ffi::gtk_constraint_guide_get_max_size(
27                self.to_glib_none().0,
28                width.as_mut_ptr(),
29                height.as_mut_ptr(),
30            );
31            (width.assume_init(), height.assume_init())
32        }
33    }
34
35    /// Gets the minimum size of @self.
36    ///
37    /// # Returns
38    ///
39    ///
40    /// ## `width`
41    /// return location for the minimum width
42    ///
43    /// ## `height`
44    /// return location for the minimum height
45    #[doc(alias = "gtk_constraint_guide_get_min_size")]
46    #[doc(alias = "get_min_size")]
47    pub fn min_size(&self) -> (i32, i32) {
48        unsafe {
49            let mut width = MaybeUninit::uninit();
50            let mut height = MaybeUninit::uninit();
51            ffi::gtk_constraint_guide_get_min_size(
52                self.to_glib_none().0,
53                width.as_mut_ptr(),
54                height.as_mut_ptr(),
55            );
56            (width.assume_init(), height.assume_init())
57        }
58    }
59
60    /// Gets the natural size of @self.
61    ///
62    /// # Returns
63    ///
64    ///
65    /// ## `width`
66    /// return location for the natural width
67    ///
68    /// ## `height`
69    /// return location for the natural height
70    #[doc(alias = "gtk_constraint_guide_get_nat_size")]
71    #[doc(alias = "get_nat_size")]
72    pub fn nat_size(&self) -> (i32, i32) {
73        unsafe {
74            let mut width = MaybeUninit::uninit();
75            let mut height = MaybeUninit::uninit();
76            ffi::gtk_constraint_guide_get_nat_size(
77                self.to_glib_none().0,
78                width.as_mut_ptr(),
79                height.as_mut_ptr(),
80            );
81            (width.assume_init(), height.assume_init())
82        }
83    }
84}