#include "adwaitamm/alertdialog.hpp" #include "adwaitamm/private/alertdialog_p.hpp" #include "adwaitamm/dialog.hpp" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace Adwaita { namespace { auto constinit _class = AlertDialog_Class{}; } // namespace auto AlertDialog::create(Glib::ustring heading, Glib::ustring body) -> Glib::RefPtr { return Glib::RefPtr{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 const & cancellable, Gio::SlotAsyncReady const & slot) -> void { adw_alert_dialog_choose(unwrap(this), parent.gobj(), const_cast(unwrap(cancellable)), &helpers::async_callback, new Gio::SlotAsyncReady(slot)); } auto AlertDialog::choose_finish(Glib::RefPtr 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(static_cast(value))); } } // namespace Adwaita namespace Glib { auto wrap(AdwAlertDialog * object, bool copy) -> Adwaita::AlertDialog * { return dynamic_cast(Glib::wrap_auto(G_OBJECT(object), copy)); } } // namespace Glib