[go: up one dir, main page]

gtk4/auto/
constraint_layout.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::{ffi, Buildable, Constraint, ConstraintGuide, LayoutManager};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    #[doc(alias = "GtkConstraintLayout")]
10    pub struct ConstraintLayout(Object<ffi::GtkConstraintLayout, ffi::GtkConstraintLayoutClass>) @extends LayoutManager, @implements Buildable;
11
12    match fn {
13        type_ => || ffi::gtk_constraint_layout_get_type(),
14    }
15}
16
17impl ConstraintLayout {
18    #[doc(alias = "gtk_constraint_layout_new")]
19    pub fn new() -> ConstraintLayout {
20        assert_initialized_main_thread!();
21        unsafe { LayoutManager::from_glib_full(ffi::gtk_constraint_layout_new()).unsafe_cast() }
22    }
23
24    #[doc(alias = "gtk_constraint_layout_add_constraint")]
25    pub fn add_constraint(&self, constraint: Constraint) {
26        unsafe {
27            ffi::gtk_constraint_layout_add_constraint(
28                self.to_glib_none().0,
29                constraint.into_glib_ptr(),
30            );
31        }
32    }
33
34    #[doc(alias = "gtk_constraint_layout_add_guide")]
35    pub fn add_guide(&self, guide: ConstraintGuide) {
36        unsafe {
37            ffi::gtk_constraint_layout_add_guide(self.to_glib_none().0, guide.into_glib_ptr());
38        }
39    }
40
41    #[doc(alias = "gtk_constraint_layout_observe_constraints")]
42    pub fn observe_constraints(&self) -> gio::ListModel {
43        unsafe {
44            from_glib_full(ffi::gtk_constraint_layout_observe_constraints(
45                self.to_glib_none().0,
46            ))
47        }
48    }
49
50    #[doc(alias = "gtk_constraint_layout_observe_guides")]
51    pub fn observe_guides(&self) -> gio::ListModel {
52        unsafe {
53            from_glib_full(ffi::gtk_constraint_layout_observe_guides(
54                self.to_glib_none().0,
55            ))
56        }
57    }
58
59    #[doc(alias = "gtk_constraint_layout_remove_all_constraints")]
60    pub fn remove_all_constraints(&self) {
61        unsafe {
62            ffi::gtk_constraint_layout_remove_all_constraints(self.to_glib_none().0);
63        }
64    }
65
66    #[doc(alias = "gtk_constraint_layout_remove_constraint")]
67    pub fn remove_constraint(&self, constraint: &Constraint) {
68        unsafe {
69            ffi::gtk_constraint_layout_remove_constraint(
70                self.to_glib_none().0,
71                constraint.to_glib_none().0,
72            );
73        }
74    }
75
76    #[doc(alias = "gtk_constraint_layout_remove_guide")]
77    pub fn remove_guide(&self, guide: &ConstraintGuide) {
78        unsafe {
79            ffi::gtk_constraint_layout_remove_guide(self.to_glib_none().0, guide.to_glib_none().0);
80        }
81    }
82}
83
84impl Default for ConstraintLayout {
85    fn default() -> Self {
86        Self::new()
87    }
88}