Debian Codegraph @

gtk/src/messagedialog.ccg

raw
1 /* Copyright (C) 2002 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <gtk/gtk.h>
18
19
20 namespace Gtk
21 {
22
23 MessageDialog::MessageDialog(const Glib::ustring& message, bool use_markup,
24 MessageType type, ButtonsType buttons,
25 bool modal)
26 :
27 _CONSTRUCT("message_type", (GtkMessageType)type, "buttons", (GtkButtonsType)buttons)
28 {
29 set_modal(modal);
30 set_message(message, use_markup);
31 }
32
33 MessageDialog::MessageDialog(Gtk::Window& parent, const Glib::ustring& message, bool use_markup,
34 MessageType type, ButtonsType buttons,
35 bool modal)
36 :
37 _CONSTRUCT("message_type", (GtkMessageType)type, "buttons", (GtkButtonsType)buttons)
38 {
39 set_modal(modal);
40 set_transient_for(parent);
41 set_message(message, use_markup);
42 }
43
44 void MessageDialog::set_message(const Glib::ustring& message, bool use_markup)
45 {
46 if(use_markup)
47 gtk_message_dialog_set_markup(gobj(), message.c_str());
48 else
49 {
50 property_use_markup() = false;
51 property_text() = message;
52 }
53 }
54
55 void MessageDialog::set_secondary_text(const Glib::ustring& text, bool use_markup)
56 {
57 if(use_markup)
58 gtk_message_dialog_format_secondary_markup(gobj(), "%s", text.c_str());
59 else
60 gtk_message_dialog_format_secondary_text(gobj(), "%s", text.c_str());
61 }
62
63 } // namespace Gtk