gtk/auto/
assistant.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
5use gdk;
6use gdk_pixbuf;
7use glib;
8use glib::object::Cast;
9use glib::object::IsA;
10use glib::object::ObjectExt;
11use glib::signal::connect_raw;
12use glib::signal::SignalHandlerId;
13use glib::translate::*;
14use glib::GString;
15use glib::StaticType;
16use glib::ToValue;
17use glib::Value;
18use glib_sys;
19use gobject_sys;
20use gtk_sys;
21use std::boxed::Box as Box_;
22use std::fmt;
23use std::mem::transmute;
24use Align;
25use Application;
26use AssistantPageType;
27use Bin;
28use Buildable;
29use Container;
30use ResizeMode;
31use Widget;
32use Window;
33use WindowPosition;
34use WindowType;
35
36glib_wrapper! {
37    pub struct Assistant(Object<gtk_sys::GtkAssistant, gtk_sys::GtkAssistantClass, AssistantClass>) @extends Window, Bin, Container, Widget, @implements Buildable;
38
39    match fn {
40        get_type => || gtk_sys::gtk_assistant_get_type(),
41    }
42}
43
44impl Assistant {
45    pub fn new() -> Assistant {
46        assert_initialized_main_thread!();
47        unsafe { Widget::from_glib_none(gtk_sys::gtk_assistant_new()).unsafe_cast() }
48    }
49}
50
51impl Default for Assistant {
52    fn default() -> Self {
53        Self::new()
54    }
55}
56
57pub struct AssistantBuilder {
58    use_header_bar: Option<i32>,
59    accept_focus: Option<bool>,
60    application: Option<Application>,
61    attached_to: Option<Widget>,
62    decorated: Option<bool>,
63    default_height: Option<i32>,
64    default_width: Option<i32>,
65    deletable: Option<bool>,
66    destroy_with_parent: Option<bool>,
67    focus_on_map: Option<bool>,
68    focus_visible: Option<bool>,
69    gravity: Option<gdk::Gravity>,
70    hide_titlebar_when_maximized: Option<bool>,
71    icon: Option<gdk_pixbuf::Pixbuf>,
72    icon_name: Option<String>,
73    mnemonics_visible: Option<bool>,
74    modal: Option<bool>,
75    resizable: Option<bool>,
76    role: Option<String>,
77    screen: Option<gdk::Screen>,
78    skip_pager_hint: Option<bool>,
79    skip_taskbar_hint: Option<bool>,
80    startup_id: Option<String>,
81    title: Option<String>,
82    transient_for: Option<Window>,
83    type_: Option<WindowType>,
84    type_hint: Option<gdk::WindowTypeHint>,
85    urgency_hint: Option<bool>,
86    window_position: Option<WindowPosition>,
87    border_width: Option<u32>,
88    child: Option<Widget>,
89    resize_mode: Option<ResizeMode>,
90    app_paintable: Option<bool>,
91    can_default: Option<bool>,
92    can_focus: Option<bool>,
93    events: Option<gdk::EventMask>,
94    expand: Option<bool>,
95    #[cfg(any(feature = "v3_20", feature = "dox"))]
96    focus_on_click: Option<bool>,
97    halign: Option<Align>,
98    has_default: Option<bool>,
99    has_focus: Option<bool>,
100    has_tooltip: Option<bool>,
101    height_request: Option<i32>,
102    hexpand: Option<bool>,
103    hexpand_set: Option<bool>,
104    is_focus: Option<bool>,
105    margin: Option<i32>,
106    margin_bottom: Option<i32>,
107    margin_end: Option<i32>,
108    margin_start: Option<i32>,
109    margin_top: Option<i32>,
110    name: Option<String>,
111    no_show_all: Option<bool>,
112    opacity: Option<f64>,
113    parent: Option<Container>,
114    receives_default: Option<bool>,
115    sensitive: Option<bool>,
116    //style: /*Unknown type*/,
117    tooltip_markup: Option<String>,
118    tooltip_text: Option<String>,
119    valign: Option<Align>,
120    vexpand: Option<bool>,
121    vexpand_set: Option<bool>,
122    visible: Option<bool>,
123    width_request: Option<i32>,
124}
125
126impl AssistantBuilder {
127    pub fn new() -> Self {
128        Self {
129            use_header_bar: None,
130            accept_focus: None,
131            application: None,
132            attached_to: None,
133            decorated: None,
134            default_height: None,
135            default_width: None,
136            deletable: None,
137            destroy_with_parent: None,
138            focus_on_map: None,
139            focus_visible: None,
140            gravity: None,
141            hide_titlebar_when_maximized: None,
142            icon: None,
143            icon_name: None,
144            mnemonics_visible: None,
145            modal: None,
146            resizable: None,
147            role: None,
148            screen: None,
149            skip_pager_hint: None,
150            skip_taskbar_hint: None,
151            startup_id: None,
152            title: None,
153            transient_for: None,
154            type_: None,
155            type_hint: None,
156            urgency_hint: None,
157            window_position: None,
158            border_width: None,
159            child: None,
160            resize_mode: None,
161            app_paintable: None,
162            can_default: None,
163            can_focus: None,
164            events: None,
165            expand: None,
166            #[cfg(any(feature = "v3_20", feature = "dox"))]
167            focus_on_click: None,
168            halign: None,
169            has_default: None,
170            has_focus: None,
171            has_tooltip: None,
172            height_request: None,
173            hexpand: None,
174            hexpand_set: None,
175            is_focus: None,
176            margin: None,
177            margin_bottom: None,
178            margin_end: None,
179            margin_start: None,
180            margin_top: None,
181            name: None,
182            no_show_all: None,
183            opacity: None,
184            parent: None,
185            receives_default: None,
186            sensitive: None,
187            tooltip_markup: None,
188            tooltip_text: None,
189            valign: None,
190            vexpand: None,
191            vexpand_set: None,
192            visible: None,
193            width_request: None,
194        }
195    }
196
197    pub fn build(self) -> Assistant {
198        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
199        if let Some(ref use_header_bar) = self.use_header_bar {
200            properties.push(("use-header-bar", use_header_bar));
201        }
202        if let Some(ref accept_focus) = self.accept_focus {
203            properties.push(("accept-focus", accept_focus));
204        }
205        if let Some(ref application) = self.application {
206            properties.push(("application", application));
207        }
208        if let Some(ref attached_to) = self.attached_to {
209            properties.push(("attached-to", attached_to));
210        }
211        if let Some(ref decorated) = self.decorated {
212            properties.push(("decorated", decorated));
213        }
214        if let Some(ref default_height) = self.default_height {
215            properties.push(("default-height", default_height));
216        }
217        if let Some(ref default_width) = self.default_width {
218            properties.push(("default-width", default_width));
219        }
220        if let Some(ref deletable) = self.deletable {
221            properties.push(("deletable", deletable));
222        }
223        if let Some(ref destroy_with_parent) = self.destroy_with_parent {
224            properties.push(("destroy-with-parent", destroy_with_parent));
225        }
226        if let Some(ref focus_on_map) = self.focus_on_map {
227            properties.push(("focus-on-map", focus_on_map));
228        }
229        if let Some(ref focus_visible) = self.focus_visible {
230            properties.push(("focus-visible", focus_visible));
231        }
232        if let Some(ref gravity) = self.gravity {
233            properties.push(("gravity", gravity));
234        }
235        if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized {
236            properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized));
237        }
238        if let Some(ref icon) = self.icon {
239            properties.push(("icon", icon));
240        }
241        if let Some(ref icon_name) = self.icon_name {
242            properties.push(("icon-name", icon_name));
243        }
244        if let Some(ref mnemonics_visible) = self.mnemonics_visible {
245            properties.push(("mnemonics-visible", mnemonics_visible));
246        }
247        if let Some(ref modal) = self.modal {
248            properties.push(("modal", modal));
249        }
250        if let Some(ref resizable) = self.resizable {
251            properties.push(("resizable", resizable));
252        }
253        if let Some(ref role) = self.role {
254            properties.push(("role", role));
255        }
256        if let Some(ref screen) = self.screen {
257            properties.push(("screen", screen));
258        }
259        if let Some(ref skip_pager_hint) = self.skip_pager_hint {
260            properties.push(("skip-pager-hint", skip_pager_hint));
261        }
262        if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint {
263            properties.push(("skip-taskbar-hint", skip_taskbar_hint));
264        }
265        if let Some(ref startup_id) = self.startup_id {
266            properties.push(("startup-id", startup_id));
267        }
268        if let Some(ref title) = self.title {
269            properties.push(("title", title));
270        }
271        if let Some(ref transient_for) = self.transient_for {
272            properties.push(("transient-for", transient_for));
273        }
274        if let Some(ref type_) = self.type_ {
275            properties.push(("type", type_));
276        }
277        if let Some(ref type_hint) = self.type_hint {
278            properties.push(("type-hint", type_hint));
279        }
280        if let Some(ref urgency_hint) = self.urgency_hint {
281            properties.push(("urgency-hint", urgency_hint));
282        }
283        if let Some(ref window_position) = self.window_position {
284            properties.push(("window-position", window_position));
285        }
286        if let Some(ref border_width) = self.border_width {
287            properties.push(("border-width", border_width));
288        }
289        if let Some(ref child) = self.child {
290            properties.push(("child", child));
291        }
292        if let Some(ref resize_mode) = self.resize_mode {
293            properties.push(("resize-mode", resize_mode));
294        }
295        if let Some(ref app_paintable) = self.app_paintable {
296            properties.push(("app-paintable", app_paintable));
297        }
298        if let Some(ref can_default) = self.can_default {
299            properties.push(("can-default", can_default));
300        }
301        if let Some(ref can_focus) = self.can_focus {
302            properties.push(("can-focus", can_focus));
303        }
304        if let Some(ref events) = self.events {
305            properties.push(("events", events));
306        }
307        if let Some(ref expand) = self.expand {
308            properties.push(("expand", expand));
309        }
310        #[cfg(any(feature = "v3_20", feature = "dox"))]
311        {
312            if let Some(ref focus_on_click) = self.focus_on_click {
313                properties.push(("focus-on-click", focus_on_click));
314            }
315        }
316        if let Some(ref halign) = self.halign {
317            properties.push(("halign", halign));
318        }
319        if let Some(ref has_default) = self.has_default {
320            properties.push(("has-default", has_default));
321        }
322        if let Some(ref has_focus) = self.has_focus {
323            properties.push(("has-focus", has_focus));
324        }
325        if let Some(ref has_tooltip) = self.has_tooltip {
326            properties.push(("has-tooltip", has_tooltip));
327        }
328        if let Some(ref height_request) = self.height_request {
329            properties.push(("height-request", height_request));
330        }
331        if let Some(ref hexpand) = self.hexpand {
332            properties.push(("hexpand", hexpand));
333        }
334        if let Some(ref hexpand_set) = self.hexpand_set {
335            properties.push(("hexpand-set", hexpand_set));
336        }
337        if let Some(ref is_focus) = self.is_focus {
338            properties.push(("is-focus", is_focus));
339        }
340        if let Some(ref margin) = self.margin {
341            properties.push(("margin", margin));
342        }
343        if let Some(ref margin_bottom) = self.margin_bottom {
344            properties.push(("margin-bottom", margin_bottom));
345        }
346        if let Some(ref margin_end) = self.margin_end {
347            properties.push(("margin-end", margin_end));
348        }
349        if let Some(ref margin_start) = self.margin_start {
350            properties.push(("margin-start", margin_start));
351        }
352        if let Some(ref margin_top) = self.margin_top {
353            properties.push(("margin-top", margin_top));
354        }
355        if let Some(ref name) = self.name {
356            properties.push(("name", name));
357        }
358        if let Some(ref no_show_all) = self.no_show_all {
359            properties.push(("no-show-all", no_show_all));
360        }
361        if let Some(ref opacity) = self.opacity {
362            properties.push(("opacity", opacity));
363        }
364        if let Some(ref parent) = self.parent {
365            properties.push(("parent", parent));
366        }
367        if let Some(ref receives_default) = self.receives_default {
368            properties.push(("receives-default", receives_default));
369        }
370        if let Some(ref sensitive) = self.sensitive {
371            properties.push(("sensitive", sensitive));
372        }
373        if let Some(ref tooltip_markup) = self.tooltip_markup {
374            properties.push(("tooltip-markup", tooltip_markup));
375        }
376        if let Some(ref tooltip_text) = self.tooltip_text {
377            properties.push(("tooltip-text", tooltip_text));
378        }
379        if let Some(ref valign) = self.valign {
380            properties.push(("valign", valign));
381        }
382        if let Some(ref vexpand) = self.vexpand {
383            properties.push(("vexpand", vexpand));
384        }
385        if let Some(ref vexpand_set) = self.vexpand_set {
386            properties.push(("vexpand-set", vexpand_set));
387        }
388        if let Some(ref visible) = self.visible {
389            properties.push(("visible", visible));
390        }
391        if let Some(ref width_request) = self.width_request {
392            properties.push(("width-request", width_request));
393        }
394        glib::Object::new(Assistant::static_type(), &properties)
395            .expect("object new")
396            .downcast()
397            .expect("downcast")
398    }
399
400    pub fn use_header_bar(mut self, use_header_bar: i32) -> Self {
401        self.use_header_bar = Some(use_header_bar);
402        self
403    }
404
405    pub fn accept_focus(mut self, accept_focus: bool) -> Self {
406        self.accept_focus = Some(accept_focus);
407        self
408    }
409
410    pub fn application(mut self, application: &Application) -> Self {
411        self.application = Some(application.clone());
412        self
413    }
414
415    pub fn attached_to(mut self, attached_to: &Widget) -> Self {
416        self.attached_to = Some(attached_to.clone());
417        self
418    }
419
420    pub fn decorated(mut self, decorated: bool) -> Self {
421        self.decorated = Some(decorated);
422        self
423    }
424
425    pub fn default_height(mut self, default_height: i32) -> Self {
426        self.default_height = Some(default_height);
427        self
428    }
429
430    pub fn default_width(mut self, default_width: i32) -> Self {
431        self.default_width = Some(default_width);
432        self
433    }
434
435    pub fn deletable(mut self, deletable: bool) -> Self {
436        self.deletable = Some(deletable);
437        self
438    }
439
440    pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self {
441        self.destroy_with_parent = Some(destroy_with_parent);
442        self
443    }
444
445    pub fn focus_on_map(mut self, focus_on_map: bool) -> Self {
446        self.focus_on_map = Some(focus_on_map);
447        self
448    }
449
450    pub fn focus_visible(mut self, focus_visible: bool) -> Self {
451        self.focus_visible = Some(focus_visible);
452        self
453    }
454
455    pub fn gravity(mut self, gravity: gdk::Gravity) -> Self {
456        self.gravity = Some(gravity);
457        self
458    }
459
460    pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self {
461        self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized);
462        self
463    }
464
465    pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self {
466        self.icon = Some(icon.clone());
467        self
468    }
469
470    pub fn icon_name(mut self, icon_name: &str) -> Self {
471        self.icon_name = Some(icon_name.to_string());
472        self
473    }
474
475    pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self {
476        self.mnemonics_visible = Some(mnemonics_visible);
477        self
478    }
479
480    pub fn modal(mut self, modal: bool) -> Self {
481        self.modal = Some(modal);
482        self
483    }
484
485    pub fn resizable(mut self, resizable: bool) -> Self {
486        self.resizable = Some(resizable);
487        self
488    }
489
490    pub fn role(mut self, role: &str) -> Self {
491        self.role = Some(role.to_string());
492        self
493    }
494
495    pub fn screen(mut self, screen: &gdk::Screen) -> Self {
496        self.screen = Some(screen.clone());
497        self
498    }
499
500    pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self {
501        self.skip_pager_hint = Some(skip_pager_hint);
502        self
503    }
504
505    pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self {
506        self.skip_taskbar_hint = Some(skip_taskbar_hint);
507        self
508    }
509
510    pub fn startup_id(mut self, startup_id: &str) -> Self {
511        self.startup_id = Some(startup_id.to_string());
512        self
513    }
514
515    pub fn title(mut self, title: &str) -> Self {
516        self.title = Some(title.to_string());
517        self
518    }
519
520    pub fn transient_for(mut self, transient_for: &Window) -> Self {
521        self.transient_for = Some(transient_for.clone());
522        self
523    }
524
525    pub fn type_(mut self, type_: WindowType) -> Self {
526        self.type_ = Some(type_);
527        self
528    }
529
530    pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self {
531        self.type_hint = Some(type_hint);
532        self
533    }
534
535    pub fn urgency_hint(mut self, urgency_hint: bool) -> Self {
536        self.urgency_hint = Some(urgency_hint);
537        self
538    }
539
540    pub fn window_position(mut self, window_position: WindowPosition) -> Self {
541        self.window_position = Some(window_position);
542        self
543    }
544
545    pub fn border_width(mut self, border_width: u32) -> Self {
546        self.border_width = Some(border_width);
547        self
548    }
549
550    pub fn child(mut self, child: &Widget) -> Self {
551        self.child = Some(child.clone());
552        self
553    }
554
555    pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
556        self.resize_mode = Some(resize_mode);
557        self
558    }
559
560    pub fn app_paintable(mut self, app_paintable: bool) -> Self {
561        self.app_paintable = Some(app_paintable);
562        self
563    }
564
565    pub fn can_default(mut self, can_default: bool) -> Self {
566        self.can_default = Some(can_default);
567        self
568    }
569
570    pub fn can_focus(mut self, can_focus: bool) -> Self {
571        self.can_focus = Some(can_focus);
572        self
573    }
574
575    pub fn events(mut self, events: gdk::EventMask) -> Self {
576        self.events = Some(events);
577        self
578    }
579
580    pub fn expand(mut self, expand: bool) -> Self {
581        self.expand = Some(expand);
582        self
583    }
584
585    #[cfg(any(feature = "v3_20", feature = "dox"))]
586    pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
587        self.focus_on_click = Some(focus_on_click);
588        self
589    }
590
591    pub fn halign(mut self, halign: Align) -> Self {
592        self.halign = Some(halign);
593        self
594    }
595
596    pub fn has_default(mut self, has_default: bool) -> Self {
597        self.has_default = Some(has_default);
598        self
599    }
600
601    pub fn has_focus(mut self, has_focus: bool) -> Self {
602        self.has_focus = Some(has_focus);
603        self
604    }
605
606    pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
607        self.has_tooltip = Some(has_tooltip);
608        self
609    }
610
611    pub fn height_request(mut self, height_request: i32) -> Self {
612        self.height_request = Some(height_request);
613        self
614    }
615
616    pub fn hexpand(mut self, hexpand: bool) -> Self {
617        self.hexpand = Some(hexpand);
618        self
619    }
620
621    pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
622        self.hexpand_set = Some(hexpand_set);
623        self
624    }
625
626    pub fn is_focus(mut self, is_focus: bool) -> Self {
627        self.is_focus = Some(is_focus);
628        self
629    }
630
631    pub fn margin(mut self, margin: i32) -> Self {
632        self.margin = Some(margin);
633        self
634    }
635
636    pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
637        self.margin_bottom = Some(margin_bottom);
638        self
639    }
640
641    pub fn margin_end(mut self, margin_end: i32) -> Self {
642        self.margin_end = Some(margin_end);
643        self
644    }
645
646    pub fn margin_start(mut self, margin_start: i32) -> Self {
647        self.margin_start = Some(margin_start);
648        self
649    }
650
651    pub fn margin_top(mut self, margin_top: i32) -> Self {
652        self.margin_top = Some(margin_top);
653        self
654    }
655
656    pub fn name(mut self, name: &str) -> Self {
657        self.name = Some(name.to_string());
658        self
659    }
660
661    pub fn no_show_all(mut self, no_show_all: bool) -> Self {
662        self.no_show_all = Some(no_show_all);
663        self
664    }
665
666    pub fn opacity(mut self, opacity: f64) -> Self {
667        self.opacity = Some(opacity);
668        self
669    }
670
671    pub fn parent(mut self, parent: &Container) -> Self {
672        self.parent = Some(parent.clone());
673        self
674    }
675
676    pub fn receives_default(mut self, receives_default: bool) -> Self {
677        self.receives_default = Some(receives_default);
678        self
679    }
680
681    pub fn sensitive(mut self, sensitive: bool) -> Self {
682        self.sensitive = Some(sensitive);
683        self
684    }
685
686    pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
687        self.tooltip_markup = Some(tooltip_markup.to_string());
688        self
689    }
690
691    pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
692        self.tooltip_text = Some(tooltip_text.to_string());
693        self
694    }
695
696    pub fn valign(mut self, valign: Align) -> Self {
697        self.valign = Some(valign);
698        self
699    }
700
701    pub fn vexpand(mut self, vexpand: bool) -> Self {
702        self.vexpand = Some(vexpand);
703        self
704    }
705
706    pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
707        self.vexpand_set = Some(vexpand_set);
708        self
709    }
710
711    pub fn visible(mut self, visible: bool) -> Self {
712        self.visible = Some(visible);
713        self
714    }
715
716    pub fn width_request(mut self, width_request: i32) -> Self {
717        self.width_request = Some(width_request);
718        self
719    }
720}
721
722pub const NONE_ASSISTANT: Option<&Assistant> = None;
723
724pub trait AssistantExt: 'static {
725    fn add_action_widget<P: IsA<Widget>>(&self, child: &P);
726
727    fn append_page<P: IsA<Widget>>(&self, page: &P) -> i32;
728
729    fn commit(&self);
730
731    fn get_current_page(&self) -> i32;
732
733    fn get_n_pages(&self) -> i32;
734
735    fn get_nth_page(&self, page_num: i32) -> Option<Widget>;
736
737    fn get_page_complete<P: IsA<Widget>>(&self, page: &P) -> bool;
738
739    #[cfg(any(feature = "v3_18", feature = "dox"))]
740    fn get_page_has_padding<P: IsA<Widget>>(&self, page: &P) -> bool;
741
742    fn get_page_title<P: IsA<Widget>>(&self, page: &P) -> Option<GString>;
743
744    fn get_page_type<P: IsA<Widget>>(&self, page: &P) -> AssistantPageType;
745
746    fn insert_page<P: IsA<Widget>>(&self, page: &P, position: i32) -> i32;
747
748    fn next_page(&self);
749
750    fn prepend_page<P: IsA<Widget>>(&self, page: &P) -> i32;
751
752    fn previous_page(&self);
753
754    fn remove_action_widget<P: IsA<Widget>>(&self, child: &P);
755
756    fn remove_page(&self, page_num: i32);
757
758    fn set_current_page(&self, page_num: i32);
759
760    fn set_forward_page_func(&self, page_func: Option<Box<dyn Fn(i32) -> i32 + 'static>>);
761
762    fn set_page_complete<P: IsA<Widget>>(&self, page: &P, complete: bool);
763
764    #[cfg(any(feature = "v3_18", feature = "dox"))]
765    fn set_page_has_padding<P: IsA<Widget>>(&self, page: &P, has_padding: bool);
766
767    fn set_page_title<P: IsA<Widget>>(&self, page: &P, title: &str);
768
769    fn set_page_type<P: IsA<Widget>>(&self, page: &P, type_: AssistantPageType);
770
771    fn update_buttons_state(&self);
772
773    fn get_property_use_header_bar(&self) -> i32;
774
775    fn get_child_complete<T: IsA<Widget>>(&self, item: &T) -> bool;
776
777    fn set_child_complete<T: IsA<Widget>>(&self, item: &T, complete: bool);
778
779    fn get_child_has_padding<T: IsA<Widget>>(&self, item: &T) -> bool;
780
781    fn set_child_has_padding<T: IsA<Widget>>(&self, item: &T, has_padding: bool);
782
783    fn get_child_page_type<T: IsA<Widget>>(&self, item: &T) -> AssistantPageType;
784
785    fn set_child_page_type<T: IsA<Widget>>(&self, item: &T, page_type: AssistantPageType);
786
787    fn get_child_title<T: IsA<Widget>>(&self, item: &T) -> Option<GString>;
788
789    fn set_child_title<T: IsA<Widget>>(&self, item: &T, title: Option<&str>);
790
791    fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
792
793    fn connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
794
795    fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
796
797    fn connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
798
799    fn emit_escape(&self);
800
801    fn connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId;
802}
803
804impl<O: IsA<Assistant>> AssistantExt for O {
805    fn add_action_widget<P: IsA<Widget>>(&self, child: &P) {
806        unsafe {
807            gtk_sys::gtk_assistant_add_action_widget(
808                self.as_ref().to_glib_none().0,
809                child.as_ref().to_glib_none().0,
810            );
811        }
812    }
813
814    fn append_page<P: IsA<Widget>>(&self, page: &P) -> i32 {
815        unsafe {
816            gtk_sys::gtk_assistant_append_page(
817                self.as_ref().to_glib_none().0,
818                page.as_ref().to_glib_none().0,
819            )
820        }
821    }
822
823    fn commit(&self) {
824        unsafe {
825            gtk_sys::gtk_assistant_commit(self.as_ref().to_glib_none().0);
826        }
827    }
828
829    fn get_current_page(&self) -> i32 {
830        unsafe { gtk_sys::gtk_assistant_get_current_page(self.as_ref().to_glib_none().0) }
831    }
832
833    fn get_n_pages(&self) -> i32 {
834        unsafe { gtk_sys::gtk_assistant_get_n_pages(self.as_ref().to_glib_none().0) }
835    }
836
837    fn get_nth_page(&self, page_num: i32) -> Option<Widget> {
838        unsafe {
839            from_glib_none(gtk_sys::gtk_assistant_get_nth_page(
840                self.as_ref().to_glib_none().0,
841                page_num,
842            ))
843        }
844    }
845
846    fn get_page_complete<P: IsA<Widget>>(&self, page: &P) -> bool {
847        unsafe {
848            from_glib(gtk_sys::gtk_assistant_get_page_complete(
849                self.as_ref().to_glib_none().0,
850                page.as_ref().to_glib_none().0,
851            ))
852        }
853    }
854
855    #[cfg(any(feature = "v3_18", feature = "dox"))]
856    fn get_page_has_padding<P: IsA<Widget>>(&self, page: &P) -> bool {
857        unsafe {
858            from_glib(gtk_sys::gtk_assistant_get_page_has_padding(
859                self.as_ref().to_glib_none().0,
860                page.as_ref().to_glib_none().0,
861            ))
862        }
863    }
864
865    fn get_page_title<P: IsA<Widget>>(&self, page: &P) -> Option<GString> {
866        unsafe {
867            from_glib_none(gtk_sys::gtk_assistant_get_page_title(
868                self.as_ref().to_glib_none().0,
869                page.as_ref().to_glib_none().0,
870            ))
871        }
872    }
873
874    fn get_page_type<P: IsA<Widget>>(&self, page: &P) -> AssistantPageType {
875        unsafe {
876            from_glib(gtk_sys::gtk_assistant_get_page_type(
877                self.as_ref().to_glib_none().0,
878                page.as_ref().to_glib_none().0,
879            ))
880        }
881    }
882
883    fn insert_page<P: IsA<Widget>>(&self, page: &P, position: i32) -> i32 {
884        unsafe {
885            gtk_sys::gtk_assistant_insert_page(
886                self.as_ref().to_glib_none().0,
887                page.as_ref().to_glib_none().0,
888                position,
889            )
890        }
891    }
892
893    fn next_page(&self) {
894        unsafe {
895            gtk_sys::gtk_assistant_next_page(self.as_ref().to_glib_none().0);
896        }
897    }
898
899    fn prepend_page<P: IsA<Widget>>(&self, page: &P) -> i32 {
900        unsafe {
901            gtk_sys::gtk_assistant_prepend_page(
902                self.as_ref().to_glib_none().0,
903                page.as_ref().to_glib_none().0,
904            )
905        }
906    }
907
908    fn previous_page(&self) {
909        unsafe {
910            gtk_sys::gtk_assistant_previous_page(self.as_ref().to_glib_none().0);
911        }
912    }
913
914    fn remove_action_widget<P: IsA<Widget>>(&self, child: &P) {
915        unsafe {
916            gtk_sys::gtk_assistant_remove_action_widget(
917                self.as_ref().to_glib_none().0,
918                child.as_ref().to_glib_none().0,
919            );
920        }
921    }
922
923    fn remove_page(&self, page_num: i32) {
924        unsafe {
925            gtk_sys::gtk_assistant_remove_page(self.as_ref().to_glib_none().0, page_num);
926        }
927    }
928
929    fn set_current_page(&self, page_num: i32) {
930        unsafe {
931            gtk_sys::gtk_assistant_set_current_page(self.as_ref().to_glib_none().0, page_num);
932        }
933    }
934
935    fn set_forward_page_func(&self, page_func: Option<Box<dyn Fn(i32) -> i32 + 'static>>) {
936        let page_func_data: Box_<Option<Box<dyn Fn(i32) -> i32 + 'static>>> = Box::new(page_func);
937        unsafe extern "C" fn page_func_func(
938            current_page: libc::c_int,
939            data: glib_sys::gpointer,
940        ) -> libc::c_int {
941            let callback: &Option<Box<dyn Fn(i32) -> i32 + 'static>> = &*(data as *mut _);
942            let res = if let Some(ref callback) = *callback {
943                callback(current_page)
944            } else {
945                panic!("cannot get closure...")
946            };
947            res
948        }
949        let page_func = if page_func_data.is_some() {
950            Some(page_func_func as _)
951        } else {
952            None
953        };
954        unsafe extern "C" fn destroy_func(data: glib_sys::gpointer) {
955            let _callback: Box_<Option<Box<dyn Fn(i32) -> i32 + 'static>>> =
956                Box_::from_raw(data as *mut _);
957        }
958        let destroy_call3 = Some(destroy_func as _);
959        let super_callback0: Box_<Option<Box<dyn Fn(i32) -> i32 + 'static>>> = page_func_data;
960        unsafe {
961            gtk_sys::gtk_assistant_set_forward_page_func(
962                self.as_ref().to_glib_none().0,
963                page_func,
964                Box::into_raw(super_callback0) as *mut _,
965                destroy_call3,
966            );
967        }
968    }
969
970    fn set_page_complete<P: IsA<Widget>>(&self, page: &P, complete: bool) {
971        unsafe {
972            gtk_sys::gtk_assistant_set_page_complete(
973                self.as_ref().to_glib_none().0,
974                page.as_ref().to_glib_none().0,
975                complete.to_glib(),
976            );
977        }
978    }
979
980    #[cfg(any(feature = "v3_18", feature = "dox"))]
981    fn set_page_has_padding<P: IsA<Widget>>(&self, page: &P, has_padding: bool) {
982        unsafe {
983            gtk_sys::gtk_assistant_set_page_has_padding(
984                self.as_ref().to_glib_none().0,
985                page.as_ref().to_glib_none().0,
986                has_padding.to_glib(),
987            );
988        }
989    }
990
991    fn set_page_title<P: IsA<Widget>>(&self, page: &P, title: &str) {
992        unsafe {
993            gtk_sys::gtk_assistant_set_page_title(
994                self.as_ref().to_glib_none().0,
995                page.as_ref().to_glib_none().0,
996                title.to_glib_none().0,
997            );
998        }
999    }
1000
1001    fn set_page_type<P: IsA<Widget>>(&self, page: &P, type_: AssistantPageType) {
1002        unsafe {
1003            gtk_sys::gtk_assistant_set_page_type(
1004                self.as_ref().to_glib_none().0,
1005                page.as_ref().to_glib_none().0,
1006                type_.to_glib(),
1007            );
1008        }
1009    }
1010
1011    fn update_buttons_state(&self) {
1012        unsafe {
1013            gtk_sys::gtk_assistant_update_buttons_state(self.as_ref().to_glib_none().0);
1014        }
1015    }
1016
1017    fn get_property_use_header_bar(&self) -> i32 {
1018        unsafe {
1019            let mut value = Value::from_type(<i32 as StaticType>::static_type());
1020            gobject_sys::g_object_get_property(
1021                self.to_glib_none().0 as *mut gobject_sys::GObject,
1022                b"use-header-bar\0".as_ptr() as *const _,
1023                value.to_glib_none_mut().0,
1024            );
1025            value.get().unwrap()
1026        }
1027    }
1028
1029    fn get_child_complete<T: IsA<Widget>>(&self, item: &T) -> bool {
1030        unsafe {
1031            let mut value = Value::from_type(<bool as StaticType>::static_type());
1032            gtk_sys::gtk_container_child_get_property(
1033                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1034                item.to_glib_none().0 as *mut _,
1035                b"complete\0".as_ptr() as *const _,
1036                value.to_glib_none_mut().0,
1037            );
1038            value.get().unwrap()
1039        }
1040    }
1041
1042    fn set_child_complete<T: IsA<Widget>>(&self, item: &T, complete: bool) {
1043        unsafe {
1044            gtk_sys::gtk_container_child_set_property(
1045                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1046                item.to_glib_none().0 as *mut _,
1047                b"complete\0".as_ptr() as *const _,
1048                Value::from(&complete).to_glib_none().0,
1049            );
1050        }
1051    }
1052
1053    fn get_child_has_padding<T: IsA<Widget>>(&self, item: &T) -> bool {
1054        unsafe {
1055            let mut value = Value::from_type(<bool as StaticType>::static_type());
1056            gtk_sys::gtk_container_child_get_property(
1057                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1058                item.to_glib_none().0 as *mut _,
1059                b"has-padding\0".as_ptr() as *const _,
1060                value.to_glib_none_mut().0,
1061            );
1062            value.get().unwrap()
1063        }
1064    }
1065
1066    fn set_child_has_padding<T: IsA<Widget>>(&self, item: &T, has_padding: bool) {
1067        unsafe {
1068            gtk_sys::gtk_container_child_set_property(
1069                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1070                item.to_glib_none().0 as *mut _,
1071                b"has-padding\0".as_ptr() as *const _,
1072                Value::from(&has_padding).to_glib_none().0,
1073            );
1074        }
1075    }
1076
1077    fn get_child_page_type<T: IsA<Widget>>(&self, item: &T) -> AssistantPageType {
1078        unsafe {
1079            let mut value = Value::from_type(<AssistantPageType as StaticType>::static_type());
1080            gtk_sys::gtk_container_child_get_property(
1081                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1082                item.to_glib_none().0 as *mut _,
1083                b"page-type\0".as_ptr() as *const _,
1084                value.to_glib_none_mut().0,
1085            );
1086            value.get().unwrap()
1087        }
1088    }
1089
1090    fn set_child_page_type<T: IsA<Widget>>(&self, item: &T, page_type: AssistantPageType) {
1091        unsafe {
1092            gtk_sys::gtk_container_child_set_property(
1093                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1094                item.to_glib_none().0 as *mut _,
1095                b"page-type\0".as_ptr() as *const _,
1096                Value::from(&page_type).to_glib_none().0,
1097            );
1098        }
1099    }
1100
1101    fn get_child_title<T: IsA<Widget>>(&self, item: &T) -> Option<GString> {
1102        unsafe {
1103            let mut value = Value::from_type(<GString as StaticType>::static_type());
1104            gtk_sys::gtk_container_child_get_property(
1105                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1106                item.to_glib_none().0 as *mut _,
1107                b"title\0".as_ptr() as *const _,
1108                value.to_glib_none_mut().0,
1109            );
1110            value.get()
1111        }
1112    }
1113
1114    fn set_child_title<T: IsA<Widget>>(&self, item: &T, title: Option<&str>) {
1115        unsafe {
1116            gtk_sys::gtk_container_child_set_property(
1117                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1118                item.to_glib_none().0 as *mut _,
1119                b"title\0".as_ptr() as *const _,
1120                Value::from(title).to_glib_none().0,
1121            );
1122        }
1123    }
1124
1125    fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1126        unsafe extern "C" fn apply_trampoline<P, F: Fn(&P) + 'static>(
1127            this: *mut gtk_sys::GtkAssistant,
1128            f: glib_sys::gpointer,
1129        ) where
1130            P: IsA<Assistant>,
1131        {
1132            let f: &F = &*(f as *const F);
1133            f(&Assistant::from_glib_borrow(this).unsafe_cast())
1134        }
1135        unsafe {
1136            let f: Box_<F> = Box_::new(f);
1137            connect_raw(
1138                self.as_ptr() as *mut _,
1139                b"apply\0".as_ptr() as *const _,
1140                Some(transmute(apply_trampoline::<Self, F> as usize)),
1141                Box_::into_raw(f),
1142            )
1143        }
1144    }
1145
1146    fn connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1147        unsafe extern "C" fn cancel_trampoline<P, F: Fn(&P) + 'static>(
1148            this: *mut gtk_sys::GtkAssistant,
1149            f: glib_sys::gpointer,
1150        ) where
1151            P: IsA<Assistant>,
1152        {
1153            let f: &F = &*(f as *const F);
1154            f(&Assistant::from_glib_borrow(this).unsafe_cast())
1155        }
1156        unsafe {
1157            let f: Box_<F> = Box_::new(f);
1158            connect_raw(
1159                self.as_ptr() as *mut _,
1160                b"cancel\0".as_ptr() as *const _,
1161                Some(transmute(cancel_trampoline::<Self, F> as usize)),
1162                Box_::into_raw(f),
1163            )
1164        }
1165    }
1166
1167    fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1168        unsafe extern "C" fn close_trampoline<P, F: Fn(&P) + 'static>(
1169            this: *mut gtk_sys::GtkAssistant,
1170            f: glib_sys::gpointer,
1171        ) where
1172            P: IsA<Assistant>,
1173        {
1174            let f: &F = &*(f as *const F);
1175            f(&Assistant::from_glib_borrow(this).unsafe_cast())
1176        }
1177        unsafe {
1178            let f: Box_<F> = Box_::new(f);
1179            connect_raw(
1180                self.as_ptr() as *mut _,
1181                b"close\0".as_ptr() as *const _,
1182                Some(transmute(close_trampoline::<Self, F> as usize)),
1183                Box_::into_raw(f),
1184            )
1185        }
1186    }
1187
1188    fn connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1189        unsafe extern "C" fn escape_trampoline<P, F: Fn(&P) + 'static>(
1190            this: *mut gtk_sys::GtkAssistant,
1191            f: glib_sys::gpointer,
1192        ) where
1193            P: IsA<Assistant>,
1194        {
1195            let f: &F = &*(f as *const F);
1196            f(&Assistant::from_glib_borrow(this).unsafe_cast())
1197        }
1198        unsafe {
1199            let f: Box_<F> = Box_::new(f);
1200            connect_raw(
1201                self.as_ptr() as *mut _,
1202                b"escape\0".as_ptr() as *const _,
1203                Some(transmute(escape_trampoline::<Self, F> as usize)),
1204                Box_::into_raw(f),
1205            )
1206        }
1207    }
1208
1209    fn emit_escape(&self) {
1210        let _ = unsafe {
1211            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
1212                .emit("escape", &[])
1213                .unwrap()
1214        };
1215    }
1216
1217    fn connect_prepare<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
1218        unsafe extern "C" fn prepare_trampoline<P, F: Fn(&P, &Widget) + 'static>(
1219            this: *mut gtk_sys::GtkAssistant,
1220            page: *mut gtk_sys::GtkWidget,
1221            f: glib_sys::gpointer,
1222        ) where
1223            P: IsA<Assistant>,
1224        {
1225            let f: &F = &*(f as *const F);
1226            f(
1227                &Assistant::from_glib_borrow(this).unsafe_cast(),
1228                &from_glib_borrow(page),
1229            )
1230        }
1231        unsafe {
1232            let f: Box_<F> = Box_::new(f);
1233            connect_raw(
1234                self.as_ptr() as *mut _,
1235                b"prepare\0".as_ptr() as *const _,
1236                Some(transmute(prepare_trampoline::<Self, F> as usize)),
1237                Box_::into_raw(f),
1238            )
1239        }
1240    }
1241}
1242
1243impl fmt::Display for Assistant {
1244    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1245        write!(f, "Assistant")
1246    }
1247}