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