diff options
Diffstat (limited to 'adw/src/toast.cpp')
| -rw-r--r-- | adw/src/toast.cpp | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/adw/src/toast.cpp b/adw/src/toast.cpp index 1267221..2e39cec 100644 --- a/adw/src/toast.cpp +++ b/adw/src/toast.cpp @@ -1,20 +1,25 @@ #include "turns/adw/toast.hpp" +#include "turns/adw/helpers/properties.hpp" + #include <glibmm/class.h> #include <glibmm/object.h> #include <glibmm/objectbase.h> #include <glibmm/private/object_p.h> #include <glibmm/propertyproxy.h> #include <glibmm/refptr.h> +#include <glibmm/signalproxy.h> #include <glibmm/ustring.h> #include <glibmm/utility.h> #include <glibmm/variant.h> +#include <glibmm/wrap.h> #include <gtkmm/widget.h> #include <adwaita.h> #include <gio/gio.h> #include <glib-object.h> +#include <glib.h> namespace turns::adw { @@ -24,6 +29,15 @@ namespace turns::adw namespace { auto constinit _class = Toast::Class{}; + + static const Glib::SignalProxyInfo Toast_signal_button_clicked_info = {"button-clicked", + (GCallback)&Glib::SignalProxyNormal::slot0_void_callback, + (GCallback)&Glib::SignalProxyNormal::slot0_void_callback}; + + static const Glib::SignalProxyInfo Toast_signal_dismissed_info = {"dismissed", + (GCallback)&Glib::SignalProxyNormal::slot0_void_callback, + (GCallback)&Glib::SignalProxyNormal::slot0_void_callback}; + } // namespace auto Toast::Class::init() -> Glib::Class const & @@ -83,6 +97,142 @@ namespace turns::adw return adw_toast_dismiss(gobj()); } + auto Toast::get_action_name() const -> Glib::ustring + { + return adw_toast_get_action_name(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto Toast::get_action_target_value() const -> Glib::VariantBase + { + // Take a copy because the value is owned by the toast. + return Glib::wrap(adw_toast_get_action_target_value(const_cast<BaseObjectType *>(Glib::unwrap(this))), true); + } + + auto Toast::get_button_label() const -> Glib::ustring + { + return adw_toast_get_button_label(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto Toast::get_custom_title() const -> Gtk::Widget * + { + return Glib::wrap(adw_toast_get_custom_title(const_cast<BaseObjectType *>(Glib::unwrap(this)))); + } + + auto Toast::get_priority() const -> Priority + { + return static_cast<Priority>(adw_toast_get_priority(const_cast<BaseObjectType *>(Glib::unwrap(this)))); + } + + auto Toast::get_timeout() const -> unsigned + { + return adw_toast_get_timeout(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto Toast::get_title() const -> Glib::ustring + { + return adw_toast_get_title(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto Toast::get_use_markup() const -> bool + { + return adw_toast_get_use_markup(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto Toast::set_action_name(Glib::ustring value) -> void + { + adw_toast_set_action_name(Glib::unwrap(this), Glib::c_str_or_nullptr(value)); + } + + auto Toast::set_action_target_value(Glib::VariantBase const & value) -> void + { + adw_toast_set_action_target_value(Glib::unwrap(this), const_cast<GVariant *>(Glib::unwrap(&value))); + } + + auto Toast::set_button_label(Glib::ustring value) -> void + { + adw_toast_set_button_label(Glib::unwrap(this), Glib::c_str_or_nullptr(value)); + } + + auto Toast::set_custom_title(Gtk::Widget * value) -> void + { + adw_toast_set_custom_title(Glib::unwrap(this), Glib::unwrap(value)); + } + + auto Toast::set_detailed_action_name(Glib::ustring value) -> void + { + adw_toast_set_detailed_action_name(Glib::unwrap(this), Glib::c_str_or_nullptr(value)); + } + + auto Toast::set_priority(Priority value) -> void + { + adw_toast_set_priority(Glib::unwrap(this), static_cast<AdwToastPriority>(value)); + } + + auto Toast::set_timeout(unsigned value) -> void + { + adw_toast_set_timeout(Glib::unwrap(this), value); + } + + auto Toast::set_title(Glib::ustring value) -> void + { + adw_toast_set_title(Glib::unwrap(this), Glib::c_str_or_nullptr(value)); + } + + auto Toast::set_use_markup(bool value) -> void + { + adw_toast_set_use_markup(Glib::unwrap(this), value); + } + + auto Toast::property_action_name() -> Glib::PropertyProxy<Glib::ustring> + { + return helpers::make_property_proxy<Glib::ustring>(*this, "action-name"); + } + + auto Toast::property_action_target() -> Glib::PropertyProxy<Glib::VariantBase> + { + return helpers::make_property_proxy<Glib::VariantBase>(*this, "action-target"); + } + + auto Toast::property_button_label() -> Glib::PropertyProxy<Glib::ustring> + { + return helpers::make_property_proxy<Glib::ustring>(*this, "button-label"); + } + + auto Toast::property_custom_title() -> Glib::PropertyProxy<Gtk::Widget *> + { + return helpers::make_property_proxy<Gtk::Widget *>(*this, "custom-title"); + } + + auto Toast::property_priority() -> Glib::PropertyProxy<Priority> + { + return helpers::make_property_proxy<Priority>(*this, "priority"); + } + + auto Toast::property_timeout() -> Glib::PropertyProxy<unsigned> + { + return helpers::make_property_proxy<unsigned>(*this, "timeout"); + } + + auto Toast::property_title() -> Glib::PropertyProxy<Glib::ustring> + { + return helpers::make_property_proxy<Glib::ustring>(*this, "title"); + } + + auto Toast::property_use_markup() -> Glib::PropertyProxy<bool> + { + return helpers::make_property_proxy<bool>(*this, "use-markup"); + } + + auto Toast::signal_button_clicked() -> Glib::SignalProxy<void()> + { + return Glib::SignalProxy<void()>{this, &Toast_signal_button_clicked_info}; + } + + auto Toast::signal_dismissed() -> Glib::SignalProxy<void()> + { + return Glib::SignalProxy<void()>{this, &Toast_signal_dismissed_info}; + } + } // namespace turns::adw namespace Glib |
