gtk/auto/message_dialog.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6 Align, Application, Bin, Buildable, ButtonsType, Container, Dialog, MessageType, ResizeMode,
7 Widget, Window, WindowPosition, WindowType,
8};
9use glib::{
10 prelude::*,
11 signal::{connect_raw, SignalHandlerId},
12 translate::*,
13};
14use std::{boxed::Box as Box_, fmt, mem::transmute};
15
16glib::wrapper! {
17 /// [`MessageDialog`][crate::MessageDialog] presents a dialog with some message text. It’s simply a
18 /// convenience widget; you could construct the equivalent of [`MessageDialog`][crate::MessageDialog]
19 /// from [`Dialog`][crate::Dialog] without too much effort, but [`MessageDialog`][crate::MessageDialog] saves typing.
20 ///
21 /// One difference from [`Dialog`][crate::Dialog] is that [`MessageDialog`][crate::MessageDialog] sets the
22 /// [`skip-taskbar-hint`][struct@crate::Window#skip-taskbar-hint] property to [`true`], so that the dialog is hidden
23 /// from the taskbar by default.
24 ///
25 /// The easiest way to do a modal message dialog is to use [`DialogExt::run()`][crate::prelude::DialogExt::run()], though
26 /// you can also pass in the [`DialogFlags::MODAL`][crate::DialogFlags::MODAL] flag, [`DialogExt::run()`][crate::prelude::DialogExt::run()] automatically
27 /// makes the dialog modal and waits for the user to respond to it. [`DialogExt::run()`][crate::prelude::DialogExt::run()]
28 /// returns when any dialog button is clicked.
29 ///
30 /// An example for using a modal dialog:
31 ///
32 ///
33 /// **⚠️ The following code is in C ⚠️**
34 ///
35 /// ```C
36 /// GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
37 /// dialog = gtk_message_dialog_new (parent_window,
38 /// flags,
39 /// GTK_MESSAGE_ERROR,
40 /// GTK_BUTTONS_CLOSE,
41 /// "Error reading “%s”: %s",
42 /// filename,
43 /// g_strerror (errno));
44 /// gtk_dialog_run (GTK_DIALOG (dialog));
45 /// gtk_widget_destroy (dialog);
46 /// ```
47 ///
48 /// You might do a non-modal [`MessageDialog`][crate::MessageDialog] as follows:
49 ///
50 /// An example for a non-modal dialog:
51 ///
52 ///
53 /// **⚠️ The following code is in C ⚠️**
54 ///
55 /// ```C
56 /// GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
57 /// dialog = gtk_message_dialog_new (parent_window,
58 /// flags,
59 /// GTK_MESSAGE_ERROR,
60 /// GTK_BUTTONS_CLOSE,
61 /// "Error reading “%s”: %s",
62 /// filename,
63 /// g_strerror (errno));
64 ///
65 /// // Destroy the dialog when the user responds to it
66 /// // (e.g. clicks a button)
67 ///
68 /// g_signal_connect_swapped (dialog, "response",
69 /// G_CALLBACK (gtk_widget_destroy),
70 /// dialog);
71 /// ```
72 ///
73 /// # GtkMessageDialog as GtkBuildable
74 ///
75 /// The GtkMessageDialog implementation of the GtkBuildable interface exposes
76 /// the message area as an internal child with the name “message_area”.
77 ///
78 /// ## Properties
79 ///
80 ///
81 /// #### `buttons`
82 /// Writeable | Construct Only
83 ///
84 ///
85 /// #### `image`
86 /// The image for this dialog.
87 ///
88 /// Readable | Writeable
89 ///
90 ///
91 /// #### `message-area`
92 /// The [`Box`][crate::Box] that corresponds to the message area of this dialog. See
93 /// [`MessageDialogExt::message_area()`][crate::prelude::MessageDialogExt::message_area()] for a detailed description of this
94 /// area.
95 ///
96 /// Readable
97 ///
98 ///
99 /// #### `message-type`
100 /// The type of the message.
101 ///
102 /// Readable | Writeable | Construct
103 ///
104 ///
105 /// #### `secondary-text`
106 /// The secondary text of the message dialog.
107 ///
108 /// Readable | Writeable
109 ///
110 ///
111 /// #### `secondary-use-markup`
112 /// [`true`] if the secondary text of the dialog includes Pango markup.
113 /// See `pango_parse_markup()`.
114 ///
115 /// Readable | Writeable
116 ///
117 ///
118 /// #### `text`
119 /// The primary text of the message dialog. If the dialog has
120 /// a secondary text, this will appear as the title.
121 ///
122 /// Readable | Writeable
123 ///
124 ///
125 /// #### `use-markup`
126 /// [`true`] if the primary text of the dialog includes Pango markup.
127 /// See `pango_parse_markup()`.
128 ///
129 /// Readable | Writeable
130 /// <details><summary><h4>Dialog</h4></summary>
131 ///
132 ///
133 /// #### `use-header-bar`
134 /// [`true`] if the dialog uses a [`HeaderBar`][crate::HeaderBar] for action buttons
135 /// instead of the action-area.
136 ///
137 /// For technical reasons, this property is declared as an integer
138 /// property, but you should only set it to [`true`] or [`false`].
139 ///
140 /// Readable | Writeable | Construct Only
141 /// </details>
142 /// <details><summary><h4>Window</h4></summary>
143 ///
144 ///
145 /// #### `accept-focus`
146 /// Whether the window should receive the input focus.
147 ///
148 /// Readable | Writeable
149 ///
150 ///
151 /// #### `application`
152 /// The [`Application`][crate::Application] associated with the window.
153 ///
154 /// The application will be kept alive for at least as long as it
155 /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
156 /// for a way to keep it alive without windows).
157 ///
158 /// Normally, the connection between the application and the window
159 /// will remain until the window is destroyed, but you can explicitly
160 /// remove it by setting the :application property to [`None`].
161 ///
162 /// Readable | Writeable
163 ///
164 ///
165 /// #### `attached-to`
166 /// The widget to which this window is attached.
167 /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
168 ///
169 /// Examples of places where specifying this relation is useful are
170 /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
171 /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
172 /// created by [`TreeView`][crate::TreeView].
173 ///
174 /// Readable | Writeable | Construct
175 ///
176 ///
177 /// #### `decorated`
178 /// Whether the window should be decorated by the window manager.
179 ///
180 /// Readable | Writeable
181 ///
182 ///
183 /// #### `default-height`
184 /// Readable | Writeable
185 ///
186 ///
187 /// #### `default-width`
188 /// Readable | Writeable
189 ///
190 ///
191 /// #### `deletable`
192 /// Whether the window frame should have a close button.
193 ///
194 /// Readable | Writeable
195 ///
196 ///
197 /// #### `destroy-with-parent`
198 /// Readable | Writeable
199 ///
200 ///
201 /// #### `focus-on-map`
202 /// Whether the window should receive the input focus when mapped.
203 ///
204 /// Readable | Writeable
205 ///
206 ///
207 /// #### `focus-visible`
208 /// Whether 'focus rectangles' are currently visible in this window.
209 ///
210 /// This property is maintained by GTK+ based on user input
211 /// and should not be set by applications.
212 ///
213 /// Readable | Writeable
214 ///
215 ///
216 /// #### `gravity`
217 /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
218 /// more details about window gravity.
219 ///
220 /// Readable | Writeable
221 ///
222 ///
223 /// #### `has-resize-grip`
224 /// Whether the window has a corner resize grip.
225 ///
226 /// Note that the resize grip is only shown if the window is
227 /// actually resizable and not maximized. Use
228 /// [`resize-grip-visible`][struct@crate::Window#resize-grip-visible] to find out if the resize
229 /// grip is currently shown.
230 ///
231 /// Readable | Writeable
232 ///
233 ///
234 /// #### `has-toplevel-focus`
235 /// Readable
236 ///
237 ///
238 /// #### `hide-titlebar-when-maximized`
239 /// Whether the titlebar should be hidden during maximization.
240 ///
241 /// Readable | Writeable
242 ///
243 ///
244 /// #### `icon`
245 /// Readable | Writeable
246 ///
247 ///
248 /// #### `icon-name`
249 /// The :icon-name property specifies the name of the themed icon to
250 /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
251 ///
252 /// Readable | Writeable
253 ///
254 ///
255 /// #### `is-active`
256 /// Readable
257 ///
258 ///
259 /// #### `is-maximized`
260 /// Readable
261 ///
262 ///
263 /// #### `mnemonics-visible`
264 /// Whether mnemonics are currently visible in this window.
265 ///
266 /// This property is maintained by GTK+ based on user input,
267 /// and should not be set by applications.
268 ///
269 /// Readable | Writeable
270 ///
271 ///
272 /// #### `modal`
273 /// Readable | Writeable
274 ///
275 ///
276 /// #### `resizable`
277 /// Readable | Writeable
278 ///
279 ///
280 /// #### `resize-grip-visible`
281 /// Whether a corner resize grip is currently shown.
282 ///
283 /// Readable
284 ///
285 ///
286 /// #### `role`
287 /// Readable | Writeable
288 ///
289 ///
290 /// #### `screen`
291 /// Readable | Writeable
292 ///
293 ///
294 /// #### `skip-pager-hint`
295 /// Readable | Writeable
296 ///
297 ///
298 /// #### `skip-taskbar-hint`
299 /// Readable | Writeable
300 ///
301 ///
302 /// #### `startup-id`
303 /// The :startup-id is a write-only property for setting window's
304 /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
305 /// for more details.
306 ///
307 /// Writeable
308 ///
309 ///
310 /// #### `title`
311 /// Readable | Writeable
312 ///
313 ///
314 /// #### `transient-for`
315 /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
316 /// more details about transient windows.
317 ///
318 /// Readable | Writeable | Construct
319 ///
320 ///
321 /// #### `type`
322 /// Readable | Writeable | Construct Only
323 ///
324 ///
325 /// #### `type-hint`
326 /// Readable | Writeable
327 ///
328 ///
329 /// #### `urgency-hint`
330 /// Readable | Writeable
331 ///
332 ///
333 /// #### `window-position`
334 /// Readable | Writeable
335 /// </details>
336 /// <details><summary><h4>Container</h4></summary>
337 ///
338 ///
339 /// #### `border-width`
340 /// Readable | Writeable
341 ///
342 ///
343 /// #### `child`
344 /// Writeable
345 ///
346 ///
347 /// #### `resize-mode`
348 /// Readable | Writeable
349 /// </details>
350 /// <details><summary><h4>Widget</h4></summary>
351 ///
352 ///
353 /// #### `app-paintable`
354 /// Readable | Writeable
355 ///
356 ///
357 /// #### `can-default`
358 /// Readable | Writeable
359 ///
360 ///
361 /// #### `can-focus`
362 /// Readable | Writeable
363 ///
364 ///
365 /// #### `composite-child`
366 /// Readable
367 ///
368 ///
369 /// #### `double-buffered`
370 /// Whether the widget is double buffered.
371 ///
372 /// Readable | Writeable
373 ///
374 ///
375 /// #### `events`
376 /// Readable | Writeable
377 ///
378 ///
379 /// #### `expand`
380 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
381 ///
382 /// Readable | Writeable
383 ///
384 ///
385 /// #### `focus-on-click`
386 /// Whether the widget should grab focus when it is clicked with the mouse.
387 ///
388 /// This property is only relevant for widgets that can take focus.
389 ///
390 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
391 /// GtkComboBox) implemented this property individually.
392 ///
393 /// Readable | Writeable
394 ///
395 ///
396 /// #### `halign`
397 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
398 ///
399 /// Readable | Writeable
400 ///
401 ///
402 /// #### `has-default`
403 /// Readable | Writeable
404 ///
405 ///
406 /// #### `has-focus`
407 /// Readable | Writeable
408 ///
409 ///
410 /// #### `has-tooltip`
411 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
412 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
413 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
414 /// whether it will provide a tooltip or not.
415 ///
416 /// Note that setting this property to [`true`] for the first time will change
417 /// the event masks of the GdkWindows of this widget to include leave-notify
418 /// and motion-notify events. This cannot and will not be undone when the
419 /// property is set to [`false`] again.
420 ///
421 /// Readable | Writeable
422 ///
423 ///
424 /// #### `height-request`
425 /// Readable | Writeable
426 ///
427 ///
428 /// #### `hexpand`
429 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
430 ///
431 /// Readable | Writeable
432 ///
433 ///
434 /// #### `hexpand-set`
435 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
436 ///
437 /// Readable | Writeable
438 ///
439 ///
440 /// #### `is-focus`
441 /// Readable | Writeable
442 ///
443 ///
444 /// #### `margin`
445 /// Sets all four sides' margin at once. If read, returns max
446 /// margin on any side.
447 ///
448 /// Readable | Writeable
449 ///
450 ///
451 /// #### `margin-bottom`
452 /// Margin on bottom side of widget.
453 ///
454 /// This property adds margin outside of the widget's normal size
455 /// request, the margin will be added in addition to the size from
456 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
457 ///
458 /// Readable | Writeable
459 ///
460 ///
461 /// #### `margin-end`
462 /// Margin on end of widget, horizontally. This property supports
463 /// left-to-right and right-to-left text directions.
464 ///
465 /// This property adds margin outside of the widget's normal size
466 /// request, the margin will be added in addition to the size from
467 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
468 ///
469 /// Readable | Writeable
470 ///
471 ///
472 /// #### `margin-left`
473 /// Margin on left side of widget.
474 ///
475 /// This property adds margin outside of the widget's normal size
476 /// request, the margin will be added in addition to the size from
477 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
478 ///
479 /// Readable | Writeable
480 ///
481 ///
482 /// #### `margin-right`
483 /// Margin on right side of widget.
484 ///
485 /// This property adds margin outside of the widget's normal size
486 /// request, the margin will be added in addition to the size from
487 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
488 ///
489 /// Readable | Writeable
490 ///
491 ///
492 /// #### `margin-start`
493 /// Margin on start of widget, horizontally. This property supports
494 /// left-to-right and right-to-left text directions.
495 ///
496 /// This property adds margin outside of the widget's normal size
497 /// request, the margin will be added in addition to the size from
498 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
499 ///
500 /// Readable | Writeable
501 ///
502 ///
503 /// #### `margin-top`
504 /// Margin on top side of widget.
505 ///
506 /// This property adds margin outside of the widget's normal size
507 /// request, the margin will be added in addition to the size from
508 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
509 ///
510 /// Readable | Writeable
511 ///
512 ///
513 /// #### `name`
514 /// Readable | Writeable
515 ///
516 ///
517 /// #### `no-show-all`
518 /// Readable | Writeable
519 ///
520 ///
521 /// #### `opacity`
522 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
523 /// more details about window opacity.
524 ///
525 /// Before 3.8 this was only available in GtkWindow
526 ///
527 /// Readable | Writeable
528 ///
529 ///
530 /// #### `parent`
531 /// Readable | Writeable
532 ///
533 ///
534 /// #### `receives-default`
535 /// Readable | Writeable
536 ///
537 ///
538 /// #### `scale-factor`
539 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
540 /// more details about widget scaling.
541 ///
542 /// Readable
543 ///
544 ///
545 /// #### `sensitive`
546 /// Readable | Writeable
547 ///
548 ///
549 /// #### `style`
550 /// The style of the widget, which contains information about how it will look (colors, etc).
551 ///
552 /// Readable | Writeable
553 ///
554 ///
555 /// #### `tooltip-markup`
556 /// Sets the text of tooltip to be the given string, which is marked up
557 /// with the [Pango text markup language][PangoMarkupFormat].
558 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
559 ///
560 /// This is a convenience property which will take care of getting the
561 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
562 /// will automatically be set to [`true`] and there will be taken care of
563 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
564 ///
565 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
566 /// are set, the last one wins.
567 ///
568 /// Readable | Writeable
569 ///
570 ///
571 /// #### `tooltip-text`
572 /// Sets the text of tooltip to be the given string.
573 ///
574 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
575 ///
576 /// This is a convenience property which will take care of getting the
577 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
578 /// will automatically be set to [`true`] and there will be taken care of
579 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
580 ///
581 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
582 /// are set, the last one wins.
583 ///
584 /// Readable | Writeable
585 ///
586 ///
587 /// #### `valign`
588 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
589 ///
590 /// Readable | Writeable
591 ///
592 ///
593 /// #### `vexpand`
594 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
595 ///
596 /// Readable | Writeable
597 ///
598 ///
599 /// #### `vexpand-set`
600 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
601 ///
602 /// Readable | Writeable
603 ///
604 ///
605 /// #### `visible`
606 /// Readable | Writeable
607 ///
608 ///
609 /// #### `width-request`
610 /// Readable | Writeable
611 ///
612 ///
613 /// #### `window`
614 /// The widget's window if it is realized, [`None`] otherwise.
615 ///
616 /// Readable
617 /// </details>
618 ///
619 /// # Implements
620 ///
621 /// [`MessageDialogExt`][trait@crate::prelude::MessageDialogExt], [`DialogExt`][trait@crate::prelude::DialogExt], [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`DialogExtManual`][trait@crate::prelude::DialogExtManual], [`GtkWindowExtManual`][trait@crate::prelude::GtkWindowExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
622 #[doc(alias = "GtkMessageDialog")]
623 pub struct MessageDialog(Object<ffi::GtkMessageDialog, ffi::GtkMessageDialogClass>) @extends Dialog, Window, Bin, Container, Widget, @implements Buildable;
624
625 match fn {
626 type_ => || ffi::gtk_message_dialog_get_type(),
627 }
628}
629
630impl MessageDialog {
631 pub const NONE: Option<&'static MessageDialog> = None;
632
633 //#[doc(alias = "gtk_message_dialog_new")]
634 //pub fn new(parent: Option<&impl IsA<Window>>, flags: DialogFlags, type_: MessageType, buttons: ButtonsType, message_format: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> MessageDialog {
635 // unsafe { TODO: call ffi:gtk_message_dialog_new() }
636 //}
637
638 //#[doc(alias = "gtk_message_dialog_new_with_markup")]
639 //#[doc(alias = "new_with_markup")]
640 //pub fn with_markup(parent: Option<&impl IsA<Window>>, flags: DialogFlags, type_: MessageType, buttons: ButtonsType, message_format: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> MessageDialog {
641 // unsafe { TODO: call ffi:gtk_message_dialog_new_with_markup() }
642 //}
643
644 // rustdoc-stripper-ignore-next
645 /// Creates a new builder-pattern struct instance to construct [`MessageDialog`] objects.
646 ///
647 /// This method returns an instance of [`MessageDialogBuilder`](crate::builders::MessageDialogBuilder) which can be used to create [`MessageDialog`] objects.
648 pub fn builder() -> MessageDialogBuilder {
649 MessageDialogBuilder::new()
650 }
651}
652
653impl Default for MessageDialog {
654 fn default() -> Self {
655 glib::object::Object::new::<Self>()
656 }
657}
658
659// rustdoc-stripper-ignore-next
660/// A [builder-pattern] type to construct [`MessageDialog`] objects.
661///
662/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
663#[must_use = "The builder must be built to be used"]
664pub struct MessageDialogBuilder {
665 builder: glib::object::ObjectBuilder<'static, MessageDialog>,
666}
667
668impl MessageDialogBuilder {
669 fn new() -> Self {
670 Self {
671 builder: glib::object::Object::builder(),
672 }
673 }
674
675 pub fn buttons(self, buttons: ButtonsType) -> Self {
676 Self {
677 builder: self.builder.property("buttons", buttons),
678 }
679 }
680
681 /// The type of the message.
682 pub fn message_type(self, message_type: MessageType) -> Self {
683 Self {
684 builder: self.builder.property("message-type", message_type),
685 }
686 }
687
688 /// The secondary text of the message dialog.
689 pub fn secondary_text(self, secondary_text: impl Into<glib::GString>) -> Self {
690 Self {
691 builder: self
692 .builder
693 .property("secondary-text", secondary_text.into()),
694 }
695 }
696
697 /// [`true`] if the secondary text of the dialog includes Pango markup.
698 /// See `pango_parse_markup()`.
699 pub fn secondary_use_markup(self, secondary_use_markup: bool) -> Self {
700 Self {
701 builder: self
702 .builder
703 .property("secondary-use-markup", secondary_use_markup),
704 }
705 }
706
707 /// The primary text of the message dialog. If the dialog has
708 /// a secondary text, this will appear as the title.
709 pub fn text(self, text: impl Into<glib::GString>) -> Self {
710 Self {
711 builder: self.builder.property("text", text.into()),
712 }
713 }
714
715 /// [`true`] if the primary text of the dialog includes Pango markup.
716 /// See `pango_parse_markup()`.
717 pub fn use_markup(self, use_markup: bool) -> Self {
718 Self {
719 builder: self.builder.property("use-markup", use_markup),
720 }
721 }
722
723 /// [`true`] if the dialog uses a [`HeaderBar`][crate::HeaderBar] for action buttons
724 /// instead of the action-area.
725 ///
726 /// For technical reasons, this property is declared as an integer
727 /// property, but you should only set it to [`true`] or [`false`].
728 pub fn use_header_bar(self, use_header_bar: i32) -> Self {
729 Self {
730 builder: self.builder.property("use-header-bar", use_header_bar),
731 }
732 }
733
734 /// Whether the window should receive the input focus.
735 pub fn accept_focus(self, accept_focus: bool) -> Self {
736 Self {
737 builder: self.builder.property("accept-focus", accept_focus),
738 }
739 }
740
741 /// The [`Application`][crate::Application] associated with the window.
742 ///
743 /// The application will be kept alive for at least as long as it
744 /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
745 /// for a way to keep it alive without windows).
746 ///
747 /// Normally, the connection between the application and the window
748 /// will remain until the window is destroyed, but you can explicitly
749 /// remove it by setting the :application property to [`None`].
750 pub fn application(self, application: &impl IsA<Application>) -> Self {
751 Self {
752 builder: self
753 .builder
754 .property("application", application.clone().upcast()),
755 }
756 }
757
758 /// The widget to which this window is attached.
759 /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
760 ///
761 /// Examples of places where specifying this relation is useful are
762 /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
763 /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
764 /// created by [`TreeView`][crate::TreeView].
765 pub fn attached_to(self, attached_to: &impl IsA<Widget>) -> Self {
766 Self {
767 builder: self
768 .builder
769 .property("attached-to", attached_to.clone().upcast()),
770 }
771 }
772
773 /// Whether the window should be decorated by the window manager.
774 pub fn decorated(self, decorated: bool) -> Self {
775 Self {
776 builder: self.builder.property("decorated", decorated),
777 }
778 }
779
780 pub fn default_height(self, default_height: i32) -> Self {
781 Self {
782 builder: self.builder.property("default-height", default_height),
783 }
784 }
785
786 pub fn default_width(self, default_width: i32) -> Self {
787 Self {
788 builder: self.builder.property("default-width", default_width),
789 }
790 }
791
792 /// Whether the window frame should have a close button.
793 pub fn deletable(self, deletable: bool) -> Self {
794 Self {
795 builder: self.builder.property("deletable", deletable),
796 }
797 }
798
799 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
800 Self {
801 builder: self
802 .builder
803 .property("destroy-with-parent", destroy_with_parent),
804 }
805 }
806
807 /// Whether the window should receive the input focus when mapped.
808 pub fn focus_on_map(self, focus_on_map: bool) -> Self {
809 Self {
810 builder: self.builder.property("focus-on-map", focus_on_map),
811 }
812 }
813
814 /// Whether 'focus rectangles' are currently visible in this window.
815 ///
816 /// This property is maintained by GTK+ based on user input
817 /// and should not be set by applications.
818 pub fn focus_visible(self, focus_visible: bool) -> Self {
819 Self {
820 builder: self.builder.property("focus-visible", focus_visible),
821 }
822 }
823
824 /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
825 /// more details about window gravity.
826 pub fn gravity(self, gravity: gdk::Gravity) -> Self {
827 Self {
828 builder: self.builder.property("gravity", gravity),
829 }
830 }
831
832 /// Whether the titlebar should be hidden during maximization.
833 pub fn hide_titlebar_when_maximized(self, hide_titlebar_when_maximized: bool) -> Self {
834 Self {
835 builder: self
836 .builder
837 .property("hide-titlebar-when-maximized", hide_titlebar_when_maximized),
838 }
839 }
840
841 pub fn icon(self, icon: &gdk_pixbuf::Pixbuf) -> Self {
842 Self {
843 builder: self.builder.property("icon", icon.clone()),
844 }
845 }
846
847 /// The :icon-name property specifies the name of the themed icon to
848 /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
849 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
850 Self {
851 builder: self.builder.property("icon-name", icon_name.into()),
852 }
853 }
854
855 /// Whether mnemonics are currently visible in this window.
856 ///
857 /// This property is maintained by GTK+ based on user input,
858 /// and should not be set by applications.
859 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
860 Self {
861 builder: self
862 .builder
863 .property("mnemonics-visible", mnemonics_visible),
864 }
865 }
866
867 pub fn modal(self, modal: bool) -> Self {
868 Self {
869 builder: self.builder.property("modal", modal),
870 }
871 }
872
873 pub fn resizable(self, resizable: bool) -> Self {
874 Self {
875 builder: self.builder.property("resizable", resizable),
876 }
877 }
878
879 pub fn role(self, role: impl Into<glib::GString>) -> Self {
880 Self {
881 builder: self.builder.property("role", role.into()),
882 }
883 }
884
885 pub fn screen(self, screen: &gdk::Screen) -> Self {
886 Self {
887 builder: self.builder.property("screen", screen.clone()),
888 }
889 }
890
891 pub fn skip_pager_hint(self, skip_pager_hint: bool) -> Self {
892 Self {
893 builder: self.builder.property("skip-pager-hint", skip_pager_hint),
894 }
895 }
896
897 pub fn skip_taskbar_hint(self, skip_taskbar_hint: bool) -> Self {
898 Self {
899 builder: self
900 .builder
901 .property("skip-taskbar-hint", skip_taskbar_hint),
902 }
903 }
904
905 /// The :startup-id is a write-only property for setting window's
906 /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
907 /// for more details.
908 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
909 Self {
910 builder: self.builder.property("startup-id", startup_id.into()),
911 }
912 }
913
914 pub fn title(self, title: impl Into<glib::GString>) -> Self {
915 Self {
916 builder: self.builder.property("title", title.into()),
917 }
918 }
919
920 /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
921 /// more details about transient windows.
922 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
923 Self {
924 builder: self
925 .builder
926 .property("transient-for", transient_for.clone().upcast()),
927 }
928 }
929
930 pub fn type_(self, type_: WindowType) -> Self {
931 Self {
932 builder: self.builder.property("type", type_),
933 }
934 }
935
936 pub fn type_hint(self, type_hint: gdk::WindowTypeHint) -> Self {
937 Self {
938 builder: self.builder.property("type-hint", type_hint),
939 }
940 }
941
942 pub fn urgency_hint(self, urgency_hint: bool) -> Self {
943 Self {
944 builder: self.builder.property("urgency-hint", urgency_hint),
945 }
946 }
947
948 pub fn window_position(self, window_position: WindowPosition) -> Self {
949 Self {
950 builder: self.builder.property("window-position", window_position),
951 }
952 }
953
954 pub fn border_width(self, border_width: u32) -> Self {
955 Self {
956 builder: self.builder.property("border-width", border_width),
957 }
958 }
959
960 pub fn child(self, child: &impl IsA<Widget>) -> Self {
961 Self {
962 builder: self.builder.property("child", child.clone().upcast()),
963 }
964 }
965
966 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
967 Self {
968 builder: self.builder.property("resize-mode", resize_mode),
969 }
970 }
971
972 pub fn app_paintable(self, app_paintable: bool) -> Self {
973 Self {
974 builder: self.builder.property("app-paintable", app_paintable),
975 }
976 }
977
978 pub fn can_default(self, can_default: bool) -> Self {
979 Self {
980 builder: self.builder.property("can-default", can_default),
981 }
982 }
983
984 pub fn can_focus(self, can_focus: bool) -> Self {
985 Self {
986 builder: self.builder.property("can-focus", can_focus),
987 }
988 }
989
990 pub fn events(self, events: gdk::EventMask) -> Self {
991 Self {
992 builder: self.builder.property("events", events),
993 }
994 }
995
996 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
997 pub fn expand(self, expand: bool) -> Self {
998 Self {
999 builder: self.builder.property("expand", expand),
1000 }
1001 }
1002
1003 /// Whether the widget should grab focus when it is clicked with the mouse.
1004 ///
1005 /// This property is only relevant for widgets that can take focus.
1006 ///
1007 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1008 /// GtkComboBox) implemented this property individually.
1009 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1010 Self {
1011 builder: self.builder.property("focus-on-click", focus_on_click),
1012 }
1013 }
1014
1015 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1016 pub fn halign(self, halign: Align) -> Self {
1017 Self {
1018 builder: self.builder.property("halign", halign),
1019 }
1020 }
1021
1022 pub fn has_default(self, has_default: bool) -> Self {
1023 Self {
1024 builder: self.builder.property("has-default", has_default),
1025 }
1026 }
1027
1028 pub fn has_focus(self, has_focus: bool) -> Self {
1029 Self {
1030 builder: self.builder.property("has-focus", has_focus),
1031 }
1032 }
1033
1034 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1035 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1036 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1037 /// whether it will provide a tooltip or not.
1038 ///
1039 /// Note that setting this property to [`true`] for the first time will change
1040 /// the event masks of the GdkWindows of this widget to include leave-notify
1041 /// and motion-notify events. This cannot and will not be undone when the
1042 /// property is set to [`false`] again.
1043 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1044 Self {
1045 builder: self.builder.property("has-tooltip", has_tooltip),
1046 }
1047 }
1048
1049 pub fn height_request(self, height_request: i32) -> Self {
1050 Self {
1051 builder: self.builder.property("height-request", height_request),
1052 }
1053 }
1054
1055 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1056 pub fn hexpand(self, hexpand: bool) -> Self {
1057 Self {
1058 builder: self.builder.property("hexpand", hexpand),
1059 }
1060 }
1061
1062 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1063 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1064 Self {
1065 builder: self.builder.property("hexpand-set", hexpand_set),
1066 }
1067 }
1068
1069 pub fn is_focus(self, is_focus: bool) -> Self {
1070 Self {
1071 builder: self.builder.property("is-focus", is_focus),
1072 }
1073 }
1074
1075 /// Sets all four sides' margin at once. If read, returns max
1076 /// margin on any side.
1077 pub fn margin(self, margin: i32) -> Self {
1078 Self {
1079 builder: self.builder.property("margin", margin),
1080 }
1081 }
1082
1083 /// Margin on bottom side of widget.
1084 ///
1085 /// This property adds margin outside of the widget's normal size
1086 /// request, the margin will be added in addition to the size from
1087 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1088 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1089 Self {
1090 builder: self.builder.property("margin-bottom", margin_bottom),
1091 }
1092 }
1093
1094 /// Margin on end of widget, horizontally. This property supports
1095 /// left-to-right and right-to-left text directions.
1096 ///
1097 /// This property adds margin outside of the widget's normal size
1098 /// request, the margin will be added in addition to the size from
1099 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1100 pub fn margin_end(self, margin_end: i32) -> Self {
1101 Self {
1102 builder: self.builder.property("margin-end", margin_end),
1103 }
1104 }
1105
1106 /// Margin on start of widget, horizontally. This property supports
1107 /// left-to-right and right-to-left text directions.
1108 ///
1109 /// This property adds margin outside of the widget's normal size
1110 /// request, the margin will be added in addition to the size from
1111 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1112 pub fn margin_start(self, margin_start: i32) -> Self {
1113 Self {
1114 builder: self.builder.property("margin-start", margin_start),
1115 }
1116 }
1117
1118 /// Margin on top side of widget.
1119 ///
1120 /// This property adds margin outside of the widget's normal size
1121 /// request, the margin will be added in addition to the size from
1122 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1123 pub fn margin_top(self, margin_top: i32) -> Self {
1124 Self {
1125 builder: self.builder.property("margin-top", margin_top),
1126 }
1127 }
1128
1129 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1130 Self {
1131 builder: self.builder.property("name", name.into()),
1132 }
1133 }
1134
1135 pub fn no_show_all(self, no_show_all: bool) -> Self {
1136 Self {
1137 builder: self.builder.property("no-show-all", no_show_all),
1138 }
1139 }
1140
1141 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1142 /// more details about window opacity.
1143 ///
1144 /// Before 3.8 this was only available in GtkWindow
1145 pub fn opacity(self, opacity: f64) -> Self {
1146 Self {
1147 builder: self.builder.property("opacity", opacity),
1148 }
1149 }
1150
1151 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1152 Self {
1153 builder: self.builder.property("parent", parent.clone().upcast()),
1154 }
1155 }
1156
1157 pub fn receives_default(self, receives_default: bool) -> Self {
1158 Self {
1159 builder: self.builder.property("receives-default", receives_default),
1160 }
1161 }
1162
1163 pub fn sensitive(self, sensitive: bool) -> Self {
1164 Self {
1165 builder: self.builder.property("sensitive", sensitive),
1166 }
1167 }
1168
1169 /// Sets the text of tooltip to be the given string, which is marked up
1170 /// with the [Pango text markup language][PangoMarkupFormat].
1171 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1172 ///
1173 /// This is a convenience property which will take care of getting the
1174 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1175 /// will automatically be set to [`true`] and there will be taken care of
1176 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1177 ///
1178 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1179 /// are set, the last one wins.
1180 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1181 Self {
1182 builder: self
1183 .builder
1184 .property("tooltip-markup", tooltip_markup.into()),
1185 }
1186 }
1187
1188 /// Sets the text of tooltip to be the given string.
1189 ///
1190 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1191 ///
1192 /// This is a convenience property which will take care of getting the
1193 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1194 /// will automatically be set to [`true`] and there will be taken care of
1195 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1196 ///
1197 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1198 /// are set, the last one wins.
1199 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1200 Self {
1201 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1202 }
1203 }
1204
1205 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1206 pub fn valign(self, valign: Align) -> Self {
1207 Self {
1208 builder: self.builder.property("valign", valign),
1209 }
1210 }
1211
1212 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1213 pub fn vexpand(self, vexpand: bool) -> Self {
1214 Self {
1215 builder: self.builder.property("vexpand", vexpand),
1216 }
1217 }
1218
1219 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1220 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1221 Self {
1222 builder: self.builder.property("vexpand-set", vexpand_set),
1223 }
1224 }
1225
1226 pub fn visible(self, visible: bool) -> Self {
1227 Self {
1228 builder: self.builder.property("visible", visible),
1229 }
1230 }
1231
1232 pub fn width_request(self, width_request: i32) -> Self {
1233 Self {
1234 builder: self.builder.property("width-request", width_request),
1235 }
1236 }
1237
1238 // rustdoc-stripper-ignore-next
1239 /// Build the [`MessageDialog`].
1240 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1241 pub fn build(self) -> MessageDialog {
1242 self.builder.build()
1243 }
1244}
1245
1246mod sealed {
1247 pub trait Sealed {}
1248 impl<T: super::IsA<super::MessageDialog>> Sealed for T {}
1249}
1250
1251/// Trait containing all [`struct@MessageDialog`] methods.
1252///
1253/// # Implementors
1254///
1255/// [`MessageDialog`][struct@crate::MessageDialog]
1256pub trait MessageDialogExt: IsA<MessageDialog> + sealed::Sealed + 'static {
1257 //#[doc(alias = "gtk_message_dialog_format_secondary_markup")]
1258 //fn format_secondary_markup(&self, message_format: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
1259 // unsafe { TODO: call ffi:gtk_message_dialog_format_secondary_markup() }
1260 //}
1261
1262 //#[doc(alias = "gtk_message_dialog_format_secondary_text")]
1263 //fn format_secondary_text(&self, message_format: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
1264 // unsafe { TODO: call ffi:gtk_message_dialog_format_secondary_text() }
1265 //}
1266
1267 /// Returns the message area of the dialog. This is the box where the
1268 /// dialog’s primary and secondary labels are packed. You can add your
1269 /// own extra content to that box and it will appear below those labels.
1270 /// See [`DialogExt::content_area()`][crate::prelude::DialogExt::content_area()] for the corresponding
1271 /// function in the parent [`Dialog`][crate::Dialog].
1272 ///
1273 /// # Returns
1274 ///
1275 /// A [`Box`][crate::Box] corresponding to the
1276 /// “message area” in the `self`.
1277 #[doc(alias = "gtk_message_dialog_get_message_area")]
1278 #[doc(alias = "get_message_area")]
1279 fn message_area(&self) -> Widget {
1280 unsafe {
1281 from_glib_none(ffi::gtk_message_dialog_get_message_area(
1282 self.as_ref().to_glib_none().0,
1283 ))
1284 }
1285 }
1286
1287 /// Sets the text of the message dialog to be `str`, which is marked
1288 /// up with the [Pango text markup language][PangoMarkupFormat].
1289 /// ## `str`
1290 /// markup string (see [Pango markup format][PangoMarkupFormat])
1291 #[doc(alias = "gtk_message_dialog_set_markup")]
1292 fn set_markup(&self, str: &str) {
1293 unsafe {
1294 ffi::gtk_message_dialog_set_markup(
1295 self.as_ref().to_glib_none().0,
1296 str.to_glib_none().0,
1297 );
1298 }
1299 }
1300
1301 /// The type of the message.
1302 #[doc(alias = "message-type")]
1303 fn message_type(&self) -> MessageType {
1304 ObjectExt::property(self.as_ref(), "message-type")
1305 }
1306
1307 /// The type of the message.
1308 #[doc(alias = "message-type")]
1309 fn set_message_type(&self, message_type: MessageType) {
1310 ObjectExt::set_property(self.as_ref(), "message-type", message_type)
1311 }
1312
1313 /// The secondary text of the message dialog.
1314 #[doc(alias = "secondary-text")]
1315 fn secondary_text(&self) -> Option<glib::GString> {
1316 ObjectExt::property(self.as_ref(), "secondary-text")
1317 }
1318
1319 /// The secondary text of the message dialog.
1320 #[doc(alias = "secondary-text")]
1321 fn set_secondary_text(&self, secondary_text: Option<&str>) {
1322 ObjectExt::set_property(self.as_ref(), "secondary-text", secondary_text)
1323 }
1324
1325 /// [`true`] if the secondary text of the dialog includes Pango markup.
1326 /// See `pango_parse_markup()`.
1327 #[doc(alias = "secondary-use-markup")]
1328 fn is_secondary_use_markup(&self) -> bool {
1329 ObjectExt::property(self.as_ref(), "secondary-use-markup")
1330 }
1331
1332 /// [`true`] if the secondary text of the dialog includes Pango markup.
1333 /// See `pango_parse_markup()`.
1334 #[doc(alias = "secondary-use-markup")]
1335 fn set_secondary_use_markup(&self, secondary_use_markup: bool) {
1336 ObjectExt::set_property(self.as_ref(), "secondary-use-markup", secondary_use_markup)
1337 }
1338
1339 /// The primary text of the message dialog. If the dialog has
1340 /// a secondary text, this will appear as the title.
1341 fn text(&self) -> Option<glib::GString> {
1342 ObjectExt::property(self.as_ref(), "text")
1343 }
1344
1345 /// The primary text of the message dialog. If the dialog has
1346 /// a secondary text, this will appear as the title.
1347 fn set_text(&self, text: Option<&str>) {
1348 ObjectExt::set_property(self.as_ref(), "text", text)
1349 }
1350
1351 /// [`true`] if the primary text of the dialog includes Pango markup.
1352 /// See `pango_parse_markup()`.
1353 #[doc(alias = "use-markup")]
1354 fn uses_markup(&self) -> bool {
1355 ObjectExt::property(self.as_ref(), "use-markup")
1356 }
1357
1358 /// [`true`] if the primary text of the dialog includes Pango markup.
1359 /// See `pango_parse_markup()`.
1360 #[doc(alias = "use-markup")]
1361 fn set_use_markup(&self, use_markup: bool) {
1362 ObjectExt::set_property(self.as_ref(), "use-markup", use_markup)
1363 }
1364
1365 #[doc(alias = "message-area")]
1366 fn connect_message_area_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1367 unsafe extern "C" fn notify_message_area_trampoline<
1368 P: IsA<MessageDialog>,
1369 F: Fn(&P) + 'static,
1370 >(
1371 this: *mut ffi::GtkMessageDialog,
1372 _param_spec: glib::ffi::gpointer,
1373 f: glib::ffi::gpointer,
1374 ) {
1375 let f: &F = &*(f as *const F);
1376 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1377 }
1378 unsafe {
1379 let f: Box_<F> = Box_::new(f);
1380 connect_raw(
1381 self.as_ptr() as *mut _,
1382 b"notify::message-area\0".as_ptr() as *const _,
1383 Some(transmute::<_, unsafe extern "C" fn()>(
1384 notify_message_area_trampoline::<Self, F> as *const (),
1385 )),
1386 Box_::into_raw(f),
1387 )
1388 }
1389 }
1390
1391 #[doc(alias = "message-type")]
1392 fn connect_message_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1393 unsafe extern "C" fn notify_message_type_trampoline<
1394 P: IsA<MessageDialog>,
1395 F: Fn(&P) + 'static,
1396 >(
1397 this: *mut ffi::GtkMessageDialog,
1398 _param_spec: glib::ffi::gpointer,
1399 f: glib::ffi::gpointer,
1400 ) {
1401 let f: &F = &*(f as *const F);
1402 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1403 }
1404 unsafe {
1405 let f: Box_<F> = Box_::new(f);
1406 connect_raw(
1407 self.as_ptr() as *mut _,
1408 b"notify::message-type\0".as_ptr() as *const _,
1409 Some(transmute::<_, unsafe extern "C" fn()>(
1410 notify_message_type_trampoline::<Self, F> as *const (),
1411 )),
1412 Box_::into_raw(f),
1413 )
1414 }
1415 }
1416
1417 #[doc(alias = "secondary-text")]
1418 fn connect_secondary_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1419 unsafe extern "C" fn notify_secondary_text_trampoline<
1420 P: IsA<MessageDialog>,
1421 F: Fn(&P) + 'static,
1422 >(
1423 this: *mut ffi::GtkMessageDialog,
1424 _param_spec: glib::ffi::gpointer,
1425 f: glib::ffi::gpointer,
1426 ) {
1427 let f: &F = &*(f as *const F);
1428 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1429 }
1430 unsafe {
1431 let f: Box_<F> = Box_::new(f);
1432 connect_raw(
1433 self.as_ptr() as *mut _,
1434 b"notify::secondary-text\0".as_ptr() as *const _,
1435 Some(transmute::<_, unsafe extern "C" fn()>(
1436 notify_secondary_text_trampoline::<Self, F> as *const (),
1437 )),
1438 Box_::into_raw(f),
1439 )
1440 }
1441 }
1442
1443 #[doc(alias = "secondary-use-markup")]
1444 fn connect_secondary_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1445 unsafe extern "C" fn notify_secondary_use_markup_trampoline<
1446 P: IsA<MessageDialog>,
1447 F: Fn(&P) + 'static,
1448 >(
1449 this: *mut ffi::GtkMessageDialog,
1450 _param_spec: glib::ffi::gpointer,
1451 f: glib::ffi::gpointer,
1452 ) {
1453 let f: &F = &*(f as *const F);
1454 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1455 }
1456 unsafe {
1457 let f: Box_<F> = Box_::new(f);
1458 connect_raw(
1459 self.as_ptr() as *mut _,
1460 b"notify::secondary-use-markup\0".as_ptr() as *const _,
1461 Some(transmute::<_, unsafe extern "C" fn()>(
1462 notify_secondary_use_markup_trampoline::<Self, F> as *const (),
1463 )),
1464 Box_::into_raw(f),
1465 )
1466 }
1467 }
1468
1469 #[doc(alias = "text")]
1470 fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1471 unsafe extern "C" fn notify_text_trampoline<P: IsA<MessageDialog>, F: Fn(&P) + 'static>(
1472 this: *mut ffi::GtkMessageDialog,
1473 _param_spec: glib::ffi::gpointer,
1474 f: glib::ffi::gpointer,
1475 ) {
1476 let f: &F = &*(f as *const F);
1477 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1478 }
1479 unsafe {
1480 let f: Box_<F> = Box_::new(f);
1481 connect_raw(
1482 self.as_ptr() as *mut _,
1483 b"notify::text\0".as_ptr() as *const _,
1484 Some(transmute::<_, unsafe extern "C" fn()>(
1485 notify_text_trampoline::<Self, F> as *const (),
1486 )),
1487 Box_::into_raw(f),
1488 )
1489 }
1490 }
1491
1492 #[doc(alias = "use-markup")]
1493 fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1494 unsafe extern "C" fn notify_use_markup_trampoline<
1495 P: IsA<MessageDialog>,
1496 F: Fn(&P) + 'static,
1497 >(
1498 this: *mut ffi::GtkMessageDialog,
1499 _param_spec: glib::ffi::gpointer,
1500 f: glib::ffi::gpointer,
1501 ) {
1502 let f: &F = &*(f as *const F);
1503 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1504 }
1505 unsafe {
1506 let f: Box_<F> = Box_::new(f);
1507 connect_raw(
1508 self.as_ptr() as *mut _,
1509 b"notify::use-markup\0".as_ptr() as *const _,
1510 Some(transmute::<_, unsafe extern "C" fn()>(
1511 notify_use_markup_trampoline::<Self, F> as *const (),
1512 )),
1513 Box_::into_raw(f),
1514 )
1515 }
1516 }
1517}
1518
1519impl<O: IsA<MessageDialog>> MessageDialogExt for O {}
1520
1521impl fmt::Display for MessageDialog {
1522 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1523 f.write_str("MessageDialog")
1524 }
1525}