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