From 6ff0bb23a71f334fe0ca86581cc86aaab2882003 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 3 Apr 2025 17:45:48 +0200 Subject: adw: implement missing members in Toast --- adw/src/toast.cpp | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) (limited to 'adw/src') 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 #include #include #include #include #include +#include #include #include #include +#include #include #include #include #include +#include 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(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(Glib::unwrap(this))), true); + } + + auto Toast::get_button_label() const -> Glib::ustring + { + return adw_toast_get_button_label(const_cast(Glib::unwrap(this))); + } + + auto Toast::get_custom_title() const -> Gtk::Widget * + { + return Glib::wrap(adw_toast_get_custom_title(const_cast(Glib::unwrap(this)))); + } + + auto Toast::get_priority() const -> Priority + { + return static_cast(adw_toast_get_priority(const_cast(Glib::unwrap(this)))); + } + + auto Toast::get_timeout() const -> unsigned + { + return adw_toast_get_timeout(const_cast(Glib::unwrap(this))); + } + + auto Toast::get_title() const -> Glib::ustring + { + return adw_toast_get_title(const_cast(Glib::unwrap(this))); + } + + auto Toast::get_use_markup() const -> bool + { + return adw_toast_get_use_markup(const_cast(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(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(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 + { + return helpers::make_property_proxy(*this, "action-name"); + } + + auto Toast::property_action_target() -> Glib::PropertyProxy + { + return helpers::make_property_proxy(*this, "action-target"); + } + + auto Toast::property_button_label() -> Glib::PropertyProxy + { + return helpers::make_property_proxy(*this, "button-label"); + } + + auto Toast::property_custom_title() -> Glib::PropertyProxy + { + return helpers::make_property_proxy(*this, "custom-title"); + } + + auto Toast::property_priority() -> Glib::PropertyProxy + { + return helpers::make_property_proxy(*this, "priority"); + } + + auto Toast::property_timeout() -> Glib::PropertyProxy + { + return helpers::make_property_proxy(*this, "timeout"); + } + + auto Toast::property_title() -> Glib::PropertyProxy + { + return helpers::make_property_proxy(*this, "title"); + } + + auto Toast::property_use_markup() -> Glib::PropertyProxy + { + return helpers::make_property_proxy(*this, "use-markup"); + } + + auto Toast::signal_button_clicked() -> Glib::SignalProxy + { + return Glib::SignalProxy{this, &Toast_signal_button_clicked_info}; + } + + auto Toast::signal_dismissed() -> Glib::SignalProxy + { + return Glib::SignalProxy{this, &Toast_signal_dismissed_info}; + } + } // namespace turns::adw namespace Glib -- cgit v1.2.3