1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
#include "adwaitamm/alertdialog.hpp"
#include "adwaitamm/dialog.hpp"
#include <glibmm/class.h>
#include <glibmm/exceptionhandler.h>
#include <glibmm/object.h>
#include <glibmm/objectbase.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/utility.h>
#include <glibmm/wrap.h>
#include <giomm/asyncresult.h>
#include <giomm/cancellable.h>
#include <gtkmm/init.h>
#include <gtkmm/object.h>
#include <gtkmm/private/widget_p.h>
#include <gtkmm/widget.h>
#include <adwaitamm/helpers/async_callback.hpp>
#include <adwaita.h>
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.h>
namespace Adwaita
{
namespace
{
auto constinit _class = AlertDialog::Class{};
} // namespace
auto AlertDialog::Class::init() -> Glib::Class const &
{
if (!gtype_)
{
class_init_func_ = &class_init_function;
register_derived_type(adw_alert_dialog_get_type());
}
return *this;
}
auto AlertDialog::Class::class_init_function(void * gclass, void * data) -> void
{
auto const klass = static_cast<BaseClassType *>(gclass);
CppClassParent::class_init_function(klass, data);
}
auto AlertDialog::Class::wrap_new(GObject * object) -> Glib::ObjectBase *
{
return Gtk::manage(new AlertDialog(ADW_ALERT_DIALOG(object)));
}
auto AlertDialog::create(Glib::ustring heading, Glib::ustring body) -> Glib::RefPtr<AlertDialog>
{
return Glib::RefPtr<AlertDialog>{new AlertDialog(heading, body)};
}
auto AlertDialog::get_type() -> GType
{
return _class.init().get_type();
}
auto AlertDialog::get_base_type() -> GType
{
return adw_alert_dialog_get_type();
}
AlertDialog::AlertDialog(Glib::ConstructParams const & params)
: Dialog{params}
{
}
AlertDialog::AlertDialog(BaseObjectType * gobj)
: Dialog(ADW_DIALOG(gobj))
{
}
AlertDialog::AlertDialog(Glib::ustring heading, Glib::ustring body)
: Glib::ObjectBase{nullptr}
, Dialog{Glib::ConstructParams{_class.init(), "heading", heading.c_str(), "body", Glib::c_str_or_nullptr(body), nullptr}}
{
}
auto AlertDialog::add_response(Glib::ustring id, Glib::ustring label) -> void
{
adw_alert_dialog_add_response(Glib::unwrap(this), id.c_str(), label.c_str());
}
auto AlertDialog::choose(Gtk::Widget & parent, Glib::RefPtr<Gio::Cancellable> const & cancellable, Gio::SlotAsyncReady const & slot) -> void
{
adw_alert_dialog_choose(unwrap(this),
parent.gobj(),
const_cast<GCancellable *>(unwrap(cancellable)),
&helpers::async_callback,
new Gio::SlotAsyncReady(slot));
}
auto AlertDialog::choose_finish(Glib::RefPtr<Gio::AsyncResult> const & result) -> Glib::ustring
{
return adw_alert_dialog_choose_finish(Glib::unwrap(this), Glib::unwrap(result));
}
auto AlertDialog::set_close_response(Glib::ustring id) -> void
{
adw_alert_dialog_set_close_response(unwrap(this), id.c_str());
}
auto AlertDialog::set_default_response(Glib::ustring id) -> void
{
adw_alert_dialog_set_default_response(unwrap(this), id.c_str());
}
auto AlertDialog::set_response_appearance(Glib::ustring id, ResponseAppearance value) -> void
{
adw_alert_dialog_set_response_appearance(unwrap(this), id.c_str(), static_cast<AdwResponseAppearance>(static_cast<int>(value)));
}
} // namespace Adwaita
namespace Glib
{
auto wrap(AdwAlertDialog * object, bool copy) -> Adwaita::AlertDialog *
{
return dynamic_cast<Adwaita::AlertDialog *>(Glib::wrap_auto(G_OBJECT(object), copy));
}
} // namespace Glib
|