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