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