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