libpanel/auto/
frame_tab_bar.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, FrameHeader};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "PanelFrameTabBar")]
16    pub struct FrameTabBar(Object<ffi::PanelFrameTabBar, ffi::PanelFrameTabBarClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, FrameHeader;
17
18    match fn {
19        type_ => || ffi::panel_frame_tab_bar_get_type(),
20    }
21}
22
23impl FrameTabBar {
24    #[doc(alias = "panel_frame_tab_bar_new")]
25    pub fn new() -> FrameTabBar {
26        assert_initialized_main_thread!();
27        unsafe { gtk::Widget::from_glib_none(ffi::panel_frame_tab_bar_new()).unsafe_cast() }
28    }
29
30    // rustdoc-stripper-ignore-next
31    /// Creates a new builder-pattern struct instance to construct [`FrameTabBar`] objects.
32    ///
33    /// This method returns an instance of [`FrameTabBarBuilder`](crate::builders::FrameTabBarBuilder) which can be used to create [`FrameTabBar`] objects.
34    pub fn builder() -> FrameTabBarBuilder {
35        FrameTabBarBuilder::new()
36    }
37
38    #[doc(alias = "panel_frame_tab_bar_get_autohide")]
39    #[doc(alias = "get_autohide")]
40    #[doc(alias = "autohide")]
41    pub fn is_autohide(&self) -> bool {
42        unsafe { from_glib(ffi::panel_frame_tab_bar_get_autohide(self.to_glib_none().0)) }
43    }
44
45    #[doc(alias = "panel_frame_tab_bar_get_expand_tabs")]
46    #[doc(alias = "get_expand_tabs")]
47    #[doc(alias = "expand-tabs")]
48    pub fn expands_tabs(&self) -> bool {
49        unsafe {
50            from_glib(ffi::panel_frame_tab_bar_get_expand_tabs(
51                self.to_glib_none().0,
52            ))
53        }
54    }
55
56    #[doc(alias = "panel_frame_tab_bar_get_inverted")]
57    #[doc(alias = "get_inverted")]
58    #[doc(alias = "inverted")]
59    pub fn is_inverted(&self) -> bool {
60        unsafe { from_glib(ffi::panel_frame_tab_bar_get_inverted(self.to_glib_none().0)) }
61    }
62
63    #[doc(alias = "panel_frame_tab_bar_set_autohide")]
64    #[doc(alias = "autohide")]
65    pub fn set_autohide(&self, autohide: bool) {
66        unsafe {
67            ffi::panel_frame_tab_bar_set_autohide(self.to_glib_none().0, autohide.into_glib());
68        }
69    }
70
71    #[doc(alias = "panel_frame_tab_bar_set_expand_tabs")]
72    #[doc(alias = "expand-tabs")]
73    pub fn set_expand_tabs(&self, expand_tabs: bool) {
74        unsafe {
75            ffi::panel_frame_tab_bar_set_expand_tabs(
76                self.to_glib_none().0,
77                expand_tabs.into_glib(),
78            );
79        }
80    }
81
82    #[doc(alias = "panel_frame_tab_bar_set_inverted")]
83    #[doc(alias = "inverted")]
84    pub fn set_inverted(&self, inverted: bool) {
85        unsafe {
86            ffi::panel_frame_tab_bar_set_inverted(self.to_glib_none().0, inverted.into_glib());
87        }
88    }
89
90    #[doc(alias = "autohide")]
91    pub fn connect_autohide_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
92        unsafe extern "C" fn notify_autohide_trampoline<F: Fn(&FrameTabBar) + 'static>(
93            this: *mut ffi::PanelFrameTabBar,
94            _param_spec: glib::ffi::gpointer,
95            f: glib::ffi::gpointer,
96        ) {
97            let f: &F = &*(f as *const F);
98            f(&from_glib_borrow(this))
99        }
100        unsafe {
101            let f: Box_<F> = Box_::new(f);
102            connect_raw(
103                self.as_ptr() as *mut _,
104                c"notify::autohide".as_ptr() as *const _,
105                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
106                    notify_autohide_trampoline::<F> as *const (),
107                )),
108                Box_::into_raw(f),
109            )
110        }
111    }
112
113    #[doc(alias = "expand-tabs")]
114    pub fn connect_expand_tabs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
115        unsafe extern "C" fn notify_expand_tabs_trampoline<F: Fn(&FrameTabBar) + 'static>(
116            this: *mut ffi::PanelFrameTabBar,
117            _param_spec: glib::ffi::gpointer,
118            f: glib::ffi::gpointer,
119        ) {
120            let f: &F = &*(f as *const F);
121            f(&from_glib_borrow(this))
122        }
123        unsafe {
124            let f: Box_<F> = Box_::new(f);
125            connect_raw(
126                self.as_ptr() as *mut _,
127                c"notify::expand-tabs".as_ptr() as *const _,
128                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
129                    notify_expand_tabs_trampoline::<F> as *const (),
130                )),
131                Box_::into_raw(f),
132            )
133        }
134    }
135
136    #[doc(alias = "inverted")]
137    pub fn connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
138        unsafe extern "C" fn notify_inverted_trampoline<F: Fn(&FrameTabBar) + 'static>(
139            this: *mut ffi::PanelFrameTabBar,
140            _param_spec: glib::ffi::gpointer,
141            f: glib::ffi::gpointer,
142        ) {
143            let f: &F = &*(f as *const F);
144            f(&from_glib_borrow(this))
145        }
146        unsafe {
147            let f: Box_<F> = Box_::new(f);
148            connect_raw(
149                self.as_ptr() as *mut _,
150                c"notify::inverted".as_ptr() as *const _,
151                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
152                    notify_inverted_trampoline::<F> as *const (),
153                )),
154                Box_::into_raw(f),
155            )
156        }
157    }
158}
159
160impl Default for FrameTabBar {
161    fn default() -> Self {
162        Self::new()
163    }
164}
165
166// rustdoc-stripper-ignore-next
167/// A [builder-pattern] type to construct [`FrameTabBar`] objects.
168///
169/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
170#[must_use = "The builder must be built to be used"]
171pub struct FrameTabBarBuilder {
172    builder: glib::object::ObjectBuilder<'static, FrameTabBar>,
173}
174
175impl FrameTabBarBuilder {
176    fn new() -> Self {
177        Self {
178            builder: glib::object::Object::builder(),
179        }
180    }
181
182    pub fn autohide(self, autohide: bool) -> Self {
183        Self {
184            builder: self.builder.property("autohide", autohide),
185        }
186    }
187
188    pub fn expand_tabs(self, expand_tabs: bool) -> Self {
189        Self {
190            builder: self.builder.property("expand-tabs", expand_tabs),
191        }
192    }
193
194    pub fn inverted(self, inverted: bool) -> Self {
195        Self {
196            builder: self.builder.property("inverted", inverted),
197        }
198    }
199
200    pub fn can_focus(self, can_focus: bool) -> Self {
201        Self {
202            builder: self.builder.property("can-focus", can_focus),
203        }
204    }
205
206    pub fn can_target(self, can_target: bool) -> Self {
207        Self {
208            builder: self.builder.property("can-target", can_target),
209        }
210    }
211
212    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
213        Self {
214            builder: self.builder.property("css-classes", css_classes.into()),
215        }
216    }
217
218    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
219        Self {
220            builder: self.builder.property("css-name", css_name.into()),
221        }
222    }
223
224    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
225        Self {
226            builder: self.builder.property("cursor", cursor.clone()),
227        }
228    }
229
230    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
231        Self {
232            builder: self.builder.property("focus-on-click", focus_on_click),
233        }
234    }
235
236    pub fn focusable(self, focusable: bool) -> Self {
237        Self {
238            builder: self.builder.property("focusable", focusable),
239        }
240    }
241
242    pub fn halign(self, halign: gtk::Align) -> Self {
243        Self {
244            builder: self.builder.property("halign", halign),
245        }
246    }
247
248    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
249        Self {
250            builder: self.builder.property("has-tooltip", has_tooltip),
251        }
252    }
253
254    pub fn height_request(self, height_request: i32) -> Self {
255        Self {
256            builder: self.builder.property("height-request", height_request),
257        }
258    }
259
260    pub fn hexpand(self, hexpand: bool) -> Self {
261        Self {
262            builder: self.builder.property("hexpand", hexpand),
263        }
264    }
265
266    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
267        Self {
268            builder: self.builder.property("hexpand-set", hexpand_set),
269        }
270    }
271
272    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
273        Self {
274            builder: self
275                .builder
276                .property("layout-manager", layout_manager.clone().upcast()),
277        }
278    }
279
280    #[cfg(feature = "gtk_v4_18")]
281    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
282    pub fn limit_events(self, limit_events: bool) -> Self {
283        Self {
284            builder: self.builder.property("limit-events", limit_events),
285        }
286    }
287
288    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
289        Self {
290            builder: self.builder.property("margin-bottom", margin_bottom),
291        }
292    }
293
294    pub fn margin_end(self, margin_end: i32) -> Self {
295        Self {
296            builder: self.builder.property("margin-end", margin_end),
297        }
298    }
299
300    pub fn margin_start(self, margin_start: i32) -> Self {
301        Self {
302            builder: self.builder.property("margin-start", margin_start),
303        }
304    }
305
306    pub fn margin_top(self, margin_top: i32) -> Self {
307        Self {
308            builder: self.builder.property("margin-top", margin_top),
309        }
310    }
311
312    pub fn name(self, name: impl Into<glib::GString>) -> Self {
313        Self {
314            builder: self.builder.property("name", name.into()),
315        }
316    }
317
318    pub fn opacity(self, opacity: f64) -> Self {
319        Self {
320            builder: self.builder.property("opacity", opacity),
321        }
322    }
323
324    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
325        Self {
326            builder: self.builder.property("overflow", overflow),
327        }
328    }
329
330    pub fn receives_default(self, receives_default: bool) -> Self {
331        Self {
332            builder: self.builder.property("receives-default", receives_default),
333        }
334    }
335
336    pub fn sensitive(self, sensitive: bool) -> Self {
337        Self {
338            builder: self.builder.property("sensitive", sensitive),
339        }
340    }
341
342    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
343        Self {
344            builder: self
345                .builder
346                .property("tooltip-markup", tooltip_markup.into()),
347        }
348    }
349
350    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
351        Self {
352            builder: self.builder.property("tooltip-text", tooltip_text.into()),
353        }
354    }
355
356    pub fn valign(self, valign: gtk::Align) -> Self {
357        Self {
358            builder: self.builder.property("valign", valign),
359        }
360    }
361
362    pub fn vexpand(self, vexpand: bool) -> Self {
363        Self {
364            builder: self.builder.property("vexpand", vexpand),
365        }
366    }
367
368    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
369        Self {
370            builder: self.builder.property("vexpand-set", vexpand_set),
371        }
372    }
373
374    pub fn visible(self, visible: bool) -> Self {
375        Self {
376            builder: self.builder.property("visible", visible),
377        }
378    }
379
380    pub fn width_request(self, width_request: i32) -> Self {
381        Self {
382            builder: self.builder.property("width-request", width_request),
383        }
384    }
385
386    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
387        Self {
388            builder: self.builder.property("accessible-role", accessible_role),
389        }
390    }
391
392    pub fn frame(self, frame: &impl IsA<Frame>) -> Self {
393        Self {
394            builder: self.builder.property("frame", frame.clone().upcast()),
395        }
396    }
397
398    // rustdoc-stripper-ignore-next
399    /// Build the [`FrameTabBar`].
400    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
401    pub fn build(self) -> FrameTabBar {
402        assert_initialized_main_thread!();
403        self.builder.build()
404    }
405}