Skip to main content

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