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