gtk4/auto/
font_chooser_dialog.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4#![allow(deprecated)]
5
6#[cfg(feature = "v4_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
8use crate::WindowGravity;
9use crate::{
10    ffi, Accessible, AccessibleRole, Align, Application, Buildable, ConstraintTarget, Dialog,
11    FontChooser, FontChooserLevel, LayoutManager, Native, Overflow, Root, ShortcutManager, Widget,
12    Window,
13};
14use glib::{prelude::*, translate::*};
15
16glib::wrapper! {
17    #[doc(alias = "GtkFontChooserDialog")]
18    pub struct FontChooserDialog(Object<ffi::GtkFontChooserDialog>) @extends Dialog, Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager, FontChooser;
19
20    match fn {
21        type_ => || ffi::gtk_font_chooser_dialog_get_type(),
22    }
23}
24
25impl FontChooserDialog {
26    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
27    #[allow(deprecated)]
28    #[doc(alias = "gtk_font_chooser_dialog_new")]
29    pub fn new(title: Option<&str>, parent: Option<&impl IsA<Window>>) -> FontChooserDialog {
30        assert_initialized_main_thread!();
31        unsafe {
32            Widget::from_glib_none(ffi::gtk_font_chooser_dialog_new(
33                title.to_glib_none().0,
34                parent.map(|p| p.as_ref()).to_glib_none().0,
35            ))
36            .unsafe_cast()
37        }
38    }
39
40    // rustdoc-stripper-ignore-next
41    /// Creates a new builder-pattern struct instance to construct [`FontChooserDialog`] objects.
42    ///
43    /// This method returns an instance of [`FontChooserDialogBuilder`](crate::builders::FontChooserDialogBuilder) which can be used to create [`FontChooserDialog`] objects.
44    pub fn builder() -> FontChooserDialogBuilder {
45        FontChooserDialogBuilder::new()
46    }
47}
48
49impl Default for FontChooserDialog {
50    fn default() -> Self {
51        glib::object::Object::new::<Self>()
52    }
53}
54
55// rustdoc-stripper-ignore-next
56/// A [builder-pattern] type to construct [`FontChooserDialog`] objects.
57///
58/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
59#[must_use = "The builder must be built to be used"]
60pub struct FontChooserDialogBuilder {
61    builder: glib::object::ObjectBuilder<'static, FontChooserDialog>,
62}
63
64impl FontChooserDialogBuilder {
65    fn new() -> Self {
66        Self {
67            builder: glib::object::Object::builder(),
68        }
69    }
70
71    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
72    pub fn use_header_bar(self, use_header_bar: i32) -> Self {
73        Self {
74            builder: self.builder.property("use-header-bar", use_header_bar),
75        }
76    }
77
78    pub fn application(self, application: &impl IsA<Application>) -> Self {
79        Self {
80            builder: self
81                .builder
82                .property("application", application.clone().upcast()),
83        }
84    }
85
86    pub fn child(self, child: &impl IsA<Widget>) -> Self {
87        Self {
88            builder: self.builder.property("child", child.clone().upcast()),
89        }
90    }
91
92    pub fn decorated(self, decorated: bool) -> Self {
93        Self {
94            builder: self.builder.property("decorated", decorated),
95        }
96    }
97
98    pub fn default_height(self, default_height: i32) -> Self {
99        Self {
100            builder: self.builder.property("default-height", default_height),
101        }
102    }
103
104    pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
105        Self {
106            builder: self
107                .builder
108                .property("default-widget", default_widget.clone().upcast()),
109        }
110    }
111
112    pub fn default_width(self, default_width: i32) -> Self {
113        Self {
114            builder: self.builder.property("default-width", default_width),
115        }
116    }
117
118    pub fn deletable(self, deletable: bool) -> Self {
119        Self {
120            builder: self.builder.property("deletable", deletable),
121        }
122    }
123
124    pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
125        Self {
126            builder: self
127                .builder
128                .property("destroy-with-parent", destroy_with_parent),
129        }
130    }
131
132    pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
133        Self {
134            builder: self.builder.property("display", display.clone().upcast()),
135        }
136    }
137
138    pub fn focus_visible(self, focus_visible: bool) -> Self {
139        Self {
140            builder: self.builder.property("focus-visible", focus_visible),
141        }
142    }
143
144    pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
145        Self {
146            builder: self
147                .builder
148                .property("focus-widget", focus_widget.clone().upcast()),
149        }
150    }
151
152    pub fn fullscreened(self, fullscreened: bool) -> Self {
153        Self {
154            builder: self.builder.property("fullscreened", fullscreened),
155        }
156    }
157
158    #[cfg(feature = "v4_20")]
159    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
160    pub fn gravity(self, gravity: WindowGravity) -> Self {
161        Self {
162            builder: self.builder.property("gravity", gravity),
163        }
164    }
165
166    #[cfg(feature = "v4_2")]
167    #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
168    pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
169        Self {
170            builder: self
171                .builder
172                .property("handle-menubar-accel", handle_menubar_accel),
173        }
174    }
175
176    pub fn hide_on_close(self, hide_on_close: bool) -> Self {
177        Self {
178            builder: self.builder.property("hide-on-close", hide_on_close),
179        }
180    }
181
182    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
183        Self {
184            builder: self.builder.property("icon-name", icon_name.into()),
185        }
186    }
187
188    pub fn maximized(self, maximized: bool) -> Self {
189        Self {
190            builder: self.builder.property("maximized", maximized),
191        }
192    }
193
194    pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
195        Self {
196            builder: self
197                .builder
198                .property("mnemonics-visible", mnemonics_visible),
199        }
200    }
201
202    pub fn modal(self, modal: bool) -> Self {
203        Self {
204            builder: self.builder.property("modal", modal),
205        }
206    }
207
208    pub fn resizable(self, resizable: bool) -> Self {
209        Self {
210            builder: self.builder.property("resizable", resizable),
211        }
212    }
213
214    pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
215        Self {
216            builder: self.builder.property("startup-id", startup_id.into()),
217        }
218    }
219
220    pub fn title(self, title: impl Into<glib::GString>) -> Self {
221        Self {
222            builder: self.builder.property("title", title.into()),
223        }
224    }
225
226    #[cfg(feature = "v4_6")]
227    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
228    pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
229        Self {
230            builder: self.builder.property("titlebar", titlebar.clone().upcast()),
231        }
232    }
233
234    pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
235        Self {
236            builder: self
237                .builder
238                .property("transient-for", transient_for.clone().upcast()),
239        }
240    }
241
242    pub fn can_focus(self, can_focus: bool) -> Self {
243        Self {
244            builder: self.builder.property("can-focus", can_focus),
245        }
246    }
247
248    pub fn can_target(self, can_target: bool) -> Self {
249        Self {
250            builder: self.builder.property("can-target", can_target),
251        }
252    }
253
254    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
255        Self {
256            builder: self.builder.property("css-classes", css_classes.into()),
257        }
258    }
259
260    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
261        Self {
262            builder: self.builder.property("css-name", css_name.into()),
263        }
264    }
265
266    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
267        Self {
268            builder: self.builder.property("cursor", cursor.clone()),
269        }
270    }
271
272    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
273        Self {
274            builder: self.builder.property("focus-on-click", focus_on_click),
275        }
276    }
277
278    pub fn focusable(self, focusable: bool) -> Self {
279        Self {
280            builder: self.builder.property("focusable", focusable),
281        }
282    }
283
284    pub fn halign(self, halign: Align) -> Self {
285        Self {
286            builder: self.builder.property("halign", halign),
287        }
288    }
289
290    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
291        Self {
292            builder: self.builder.property("has-tooltip", has_tooltip),
293        }
294    }
295
296    pub fn height_request(self, height_request: i32) -> Self {
297        Self {
298            builder: self.builder.property("height-request", height_request),
299        }
300    }
301
302    pub fn hexpand(self, hexpand: bool) -> Self {
303        Self {
304            builder: self.builder.property("hexpand", hexpand),
305        }
306    }
307
308    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
309        Self {
310            builder: self.builder.property("hexpand-set", hexpand_set),
311        }
312    }
313
314    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
315        Self {
316            builder: self
317                .builder
318                .property("layout-manager", layout_manager.clone().upcast()),
319        }
320    }
321
322    #[cfg(feature = "v4_18")]
323    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
324    pub fn limit_events(self, limit_events: bool) -> Self {
325        Self {
326            builder: self.builder.property("limit-events", limit_events),
327        }
328    }
329
330    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
331        Self {
332            builder: self.builder.property("margin-bottom", margin_bottom),
333        }
334    }
335
336    pub fn margin_end(self, margin_end: i32) -> Self {
337        Self {
338            builder: self.builder.property("margin-end", margin_end),
339        }
340    }
341
342    pub fn margin_start(self, margin_start: i32) -> Self {
343        Self {
344            builder: self.builder.property("margin-start", margin_start),
345        }
346    }
347
348    pub fn margin_top(self, margin_top: i32) -> Self {
349        Self {
350            builder: self.builder.property("margin-top", margin_top),
351        }
352    }
353
354    pub fn name(self, name: impl Into<glib::GString>) -> Self {
355        Self {
356            builder: self.builder.property("name", name.into()),
357        }
358    }
359
360    pub fn opacity(self, opacity: f64) -> Self {
361        Self {
362            builder: self.builder.property("opacity", opacity),
363        }
364    }
365
366    pub fn overflow(self, overflow: Overflow) -> Self {
367        Self {
368            builder: self.builder.property("overflow", overflow),
369        }
370    }
371
372    pub fn receives_default(self, receives_default: bool) -> Self {
373        Self {
374            builder: self.builder.property("receives-default", receives_default),
375        }
376    }
377
378    pub fn sensitive(self, sensitive: bool) -> Self {
379        Self {
380            builder: self.builder.property("sensitive", sensitive),
381        }
382    }
383
384    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
385        Self {
386            builder: self
387                .builder
388                .property("tooltip-markup", tooltip_markup.into()),
389        }
390    }
391
392    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
393        Self {
394            builder: self.builder.property("tooltip-text", tooltip_text.into()),
395        }
396    }
397
398    pub fn valign(self, valign: Align) -> Self {
399        Self {
400            builder: self.builder.property("valign", valign),
401        }
402    }
403
404    pub fn vexpand(self, vexpand: bool) -> Self {
405        Self {
406            builder: self.builder.property("vexpand", vexpand),
407        }
408    }
409
410    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
411        Self {
412            builder: self.builder.property("vexpand-set", vexpand_set),
413        }
414    }
415
416    pub fn visible(self, visible: bool) -> Self {
417        Self {
418            builder: self.builder.property("visible", visible),
419        }
420    }
421
422    pub fn width_request(self, width_request: i32) -> Self {
423        Self {
424            builder: self.builder.property("width-request", width_request),
425        }
426    }
427
428    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
429        Self {
430            builder: self.builder.property("accessible-role", accessible_role),
431        }
432    }
433
434    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
435    pub fn font(self, font: impl Into<glib::GString>) -> Self {
436        Self {
437            builder: self.builder.property("font", font.into()),
438        }
439    }
440
441    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
442    pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
443        Self {
444            builder: self.builder.property("font-desc", font_desc),
445        }
446    }
447
448    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
449    pub fn language(self, language: impl Into<glib::GString>) -> Self {
450        Self {
451            builder: self.builder.property("language", language.into()),
452        }
453    }
454
455    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
456    pub fn level(self, level: FontChooserLevel) -> Self {
457        Self {
458            builder: self.builder.property("level", level),
459        }
460    }
461
462    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
463    pub fn preview_text(self, preview_text: impl Into<glib::GString>) -> Self {
464        Self {
465            builder: self.builder.property("preview-text", preview_text.into()),
466        }
467    }
468
469    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
470    pub fn show_preview_entry(self, show_preview_entry: bool) -> Self {
471        Self {
472            builder: self
473                .builder
474                .property("show-preview-entry", show_preview_entry),
475        }
476    }
477
478    // rustdoc-stripper-ignore-next
479    /// Build the [`FontChooserDialog`].
480    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
481    pub fn build(self) -> FontChooserDialog {
482        assert_initialized_main_thread!();
483        self.builder.build()
484    }
485}