libadwaita/auto/
layout_slot.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::ffi;
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    #[doc(alias = "AdwLayoutSlot")]
11    pub struct LayoutSlot(Object<ffi::AdwLayoutSlot, ffi::AdwLayoutSlotClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
12
13    match fn {
14        type_ => || ffi::adw_layout_slot_get_type(),
15    }
16}
17
18impl LayoutSlot {
19    #[doc(alias = "adw_layout_slot_new")]
20    pub fn new(id: &str) -> LayoutSlot {
21        assert_initialized_main_thread!();
22        unsafe {
23            gtk::Widget::from_glib_none(ffi::adw_layout_slot_new(id.to_glib_none().0)).unsafe_cast()
24        }
25    }
26
27    // rustdoc-stripper-ignore-next
28    /// Creates a new builder-pattern struct instance to construct [`LayoutSlot`] objects.
29    ///
30    /// This method returns an instance of [`LayoutSlotBuilder`](crate::builders::LayoutSlotBuilder) which can be used to create [`LayoutSlot`] objects.
31    pub fn builder() -> LayoutSlotBuilder {
32        LayoutSlotBuilder::new()
33    }
34
35    #[doc(alias = "adw_layout_slot_get_slot_id")]
36    #[doc(alias = "get_slot_id")]
37    #[doc(alias = "id")]
38    pub fn slot_id(&self) -> glib::GString {
39        unsafe { from_glib_none(ffi::adw_layout_slot_get_slot_id(self.to_glib_none().0)) }
40    }
41}
42
43#[cfg(feature = "v1_6")]
44#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
45impl Default for LayoutSlot {
46    fn default() -> Self {
47        glib::object::Object::new::<Self>()
48    }
49}
50
51// rustdoc-stripper-ignore-next
52/// A [builder-pattern] type to construct [`LayoutSlot`] objects.
53///
54/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
55#[must_use = "The builder must be built to be used"]
56pub struct LayoutSlotBuilder {
57    builder: glib::object::ObjectBuilder<'static, LayoutSlot>,
58}
59
60impl LayoutSlotBuilder {
61    fn new() -> Self {
62        Self {
63            builder: glib::object::Object::builder(),
64        }
65    }
66
67    #[cfg(feature = "v1_6")]
68    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
69    pub fn id(self, id: impl Into<glib::GString>) -> Self {
70        Self {
71            builder: self.builder.property("id", id.into()),
72        }
73    }
74
75    pub fn can_focus(self, can_focus: bool) -> Self {
76        Self {
77            builder: self.builder.property("can-focus", can_focus),
78        }
79    }
80
81    pub fn can_target(self, can_target: bool) -> Self {
82        Self {
83            builder: self.builder.property("can-target", can_target),
84        }
85    }
86
87    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
88        Self {
89            builder: self.builder.property("css-classes", css_classes.into()),
90        }
91    }
92
93    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
94        Self {
95            builder: self.builder.property("css-name", css_name.into()),
96        }
97    }
98
99    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
100        Self {
101            builder: self.builder.property("cursor", cursor.clone()),
102        }
103    }
104
105    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
106        Self {
107            builder: self.builder.property("focus-on-click", focus_on_click),
108        }
109    }
110
111    pub fn focusable(self, focusable: bool) -> Self {
112        Self {
113            builder: self.builder.property("focusable", focusable),
114        }
115    }
116
117    pub fn halign(self, halign: gtk::Align) -> Self {
118        Self {
119            builder: self.builder.property("halign", halign),
120        }
121    }
122
123    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
124        Self {
125            builder: self.builder.property("has-tooltip", has_tooltip),
126        }
127    }
128
129    pub fn height_request(self, height_request: i32) -> Self {
130        Self {
131            builder: self.builder.property("height-request", height_request),
132        }
133    }
134
135    pub fn hexpand(self, hexpand: bool) -> Self {
136        Self {
137            builder: self.builder.property("hexpand", hexpand),
138        }
139    }
140
141    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
142        Self {
143            builder: self.builder.property("hexpand-set", hexpand_set),
144        }
145    }
146
147    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
148        Self {
149            builder: self
150                .builder
151                .property("layout-manager", layout_manager.clone().upcast()),
152        }
153    }
154
155    #[cfg(feature = "gtk_v4_18")]
156    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
157    pub fn limit_events(self, limit_events: bool) -> Self {
158        Self {
159            builder: self.builder.property("limit-events", limit_events),
160        }
161    }
162
163    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
164        Self {
165            builder: self.builder.property("margin-bottom", margin_bottom),
166        }
167    }
168
169    pub fn margin_end(self, margin_end: i32) -> Self {
170        Self {
171            builder: self.builder.property("margin-end", margin_end),
172        }
173    }
174
175    pub fn margin_start(self, margin_start: i32) -> Self {
176        Self {
177            builder: self.builder.property("margin-start", margin_start),
178        }
179    }
180
181    pub fn margin_top(self, margin_top: i32) -> Self {
182        Self {
183            builder: self.builder.property("margin-top", margin_top),
184        }
185    }
186
187    pub fn name(self, name: impl Into<glib::GString>) -> Self {
188        Self {
189            builder: self.builder.property("name", name.into()),
190        }
191    }
192
193    pub fn opacity(self, opacity: f64) -> Self {
194        Self {
195            builder: self.builder.property("opacity", opacity),
196        }
197    }
198
199    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
200        Self {
201            builder: self.builder.property("overflow", overflow),
202        }
203    }
204
205    pub fn receives_default(self, receives_default: bool) -> Self {
206        Self {
207            builder: self.builder.property("receives-default", receives_default),
208        }
209    }
210
211    pub fn sensitive(self, sensitive: bool) -> Self {
212        Self {
213            builder: self.builder.property("sensitive", sensitive),
214        }
215    }
216
217    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
218        Self {
219            builder: self
220                .builder
221                .property("tooltip-markup", tooltip_markup.into()),
222        }
223    }
224
225    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
226        Self {
227            builder: self.builder.property("tooltip-text", tooltip_text.into()),
228        }
229    }
230
231    pub fn valign(self, valign: gtk::Align) -> Self {
232        Self {
233            builder: self.builder.property("valign", valign),
234        }
235    }
236
237    pub fn vexpand(self, vexpand: bool) -> Self {
238        Self {
239            builder: self.builder.property("vexpand", vexpand),
240        }
241    }
242
243    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
244        Self {
245            builder: self.builder.property("vexpand-set", vexpand_set),
246        }
247    }
248
249    pub fn visible(self, visible: bool) -> Self {
250        Self {
251            builder: self.builder.property("visible", visible),
252        }
253    }
254
255    pub fn width_request(self, width_request: i32) -> Self {
256        Self {
257            builder: self.builder.property("width-request", width_request),
258        }
259    }
260
261    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
262        Self {
263            builder: self.builder.property("accessible-role", accessible_role),
264        }
265    }
266
267    // rustdoc-stripper-ignore-next
268    /// Build the [`LayoutSlot`].
269    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
270    pub fn build(self) -> LayoutSlot {
271        assert_initialized_main_thread!();
272        self.builder.build()
273    }
274}