diff options
| -rw-r--r-- | adw/include/adwaitamm/enums.hpp | 7 | ||||
| -rw-r--r-- | adw/include/adwaitamm/toast.hpp | 14 | ||||
| -rw-r--r-- | adw/src/enums.cpp | 4 | ||||
| -rw-r--r-- | adw/src/toast.cpp | 14 |
4 files changed, 22 insertions, 17 deletions
diff --git a/adw/include/adwaitamm/enums.hpp b/adw/include/adwaitamm/enums.hpp index 2fca425..03f5dc9 100644 --- a/adw/include/adwaitamm/enums.hpp +++ b/adw/include/adwaitamm/enums.hpp @@ -50,6 +50,12 @@ namespace Adwaita Destructive, }; + enum class ToastPriority + { + Normal, + High, + }; + } // namespace Adwaita namespace Glib @@ -68,6 +74,7 @@ namespace Glib VALUE_SPECIALIZATION(LengthType); VALUE_SPECIALIZATION(RatioType); VALUE_SPECIALIZATION(ResponseAppearance); + VALUE_SPECIALIZATION(ToastPriority); #undef VALUE_SPECIALIZATION diff --git a/adw/include/adwaitamm/toast.hpp b/adw/include/adwaitamm/toast.hpp index 4f69c1e..ba82497 100644 --- a/adw/include/adwaitamm/toast.hpp +++ b/adw/include/adwaitamm/toast.hpp @@ -24,6 +24,8 @@ using AdwToast = struct _AdwToast; namespace Adwaita { + enum struct ToastPriority; + struct Toast final : Glib::Object, helpers::gobj_mixin<Toast, AdwToast> { @@ -45,12 +47,6 @@ namespace Adwaita using CppObjectType = Class::CppObjectType; using CppClassType = Class; - enum class Priority - { - NORMAL, - HIGH, - }; - using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj; using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj_copy; @@ -69,7 +65,7 @@ namespace Adwaita auto get_action_target_value() const -> Glib::VariantBase; auto get_button_label() const -> Glib::ustring; auto get_custom_title() const -> Gtk::Widget *; - auto get_priority() const -> Priority; + auto get_priority() const -> ToastPriority; auto get_timeout() const -> unsigned; auto get_title() const -> Glib::ustring; auto get_use_markup() const -> bool; @@ -78,7 +74,7 @@ namespace Adwaita auto set_button_label(Glib::ustring value) -> void; auto set_custom_title(Gtk::Widget * value) -> void; auto set_detailed_action_name(Glib::ustring value) -> void; - auto set_priority(Priority value) -> void; + auto set_priority(ToastPriority value) -> void; auto set_timeout(unsigned value) -> void; auto set_title(Glib::ustring value) -> void; auto set_use_markup(bool value) -> void; @@ -87,7 +83,7 @@ namespace Adwaita auto property_action_target() -> Glib::PropertyProxy<Glib::VariantBase>; auto property_button_label() -> Glib::PropertyProxy<Glib::ustring>; auto property_custom_title() -> Glib::PropertyProxy<Gtk::Widget *>; - auto property_priority() -> Glib::PropertyProxy<Priority>; + auto property_priority() -> Glib::PropertyProxy<ToastPriority>; auto property_timeout() -> Glib::PropertyProxy<unsigned>; auto property_title() -> Glib::PropertyProxy<Glib::ustring>; auto property_use_markup() -> Glib::PropertyProxy<bool>; diff --git a/adw/src/enums.cpp b/adw/src/enums.cpp index 9891845..9261387 100644 --- a/adw/src/enums.cpp +++ b/adw/src/enums.cpp @@ -45,6 +45,9 @@ namespace Adwaita static_assert(matches<ResponseAppearance::Suggested, ADW_RESPONSE_SUGGESTED>); static_assert(matches<ResponseAppearance::Destructive, ADW_RESPONSE_DESTRUCTIVE>); + static_assert(matches<ToastPriority::Normal, ADW_TOAST_PRIORITY_NORMAL>); + static_assert(matches<ToastPriority::High, ADW_TOAST_PRIORITY_HIGH>); + } // namespace Adwaita namespace Glib @@ -60,6 +63,7 @@ namespace Glib VALUE_SPECIALIZATION(LengthType, breakpoint_condition) VALUE_SPECIALIZATION(RatioType, breakpoint_condition) VALUE_SPECIALIZATION(ResponseAppearance, response_appearance) + VALUE_SPECIALIZATION(ToastPriority, toast_priority) #undef VALUE_SPECIALIZATION } // namespace Glib
\ No newline at end of file diff --git a/adw/src/toast.cpp b/adw/src/toast.cpp index 9ec0a5b..205e69f 100644 --- a/adw/src/toast.cpp +++ b/adw/src/toast.cpp @@ -1,5 +1,6 @@ #include "adwaitamm/toast.hpp" +#include "adwaitamm/enums.hpp" #include "adwaitamm/helpers/properties.hpp" #include <glibmm/class.h> @@ -23,9 +24,6 @@ namespace Adwaita { - static_assert(static_cast<int>(Toast::Priority::NORMAL) == ADW_TOAST_PRIORITY_NORMAL); - static_assert(static_cast<int>(Toast::Priority::HIGH) == ADW_TOAST_PRIORITY_HIGH); - namespace { auto constinit _class = Toast::Class{}; @@ -118,9 +116,9 @@ namespace Adwaita return Glib::wrap(adw_toast_get_custom_title(const_cast<BaseObjectType *>(Glib::unwrap(this)))); } - auto Toast::get_priority() const -> Priority + auto Toast::get_priority() const -> ToastPriority { - return static_cast<Priority>(adw_toast_get_priority(const_cast<BaseObjectType *>(Glib::unwrap(this)))); + return static_cast<ToastPriority>(adw_toast_get_priority(const_cast<BaseObjectType *>(Glib::unwrap(this)))); } auto Toast::get_timeout() const -> unsigned @@ -163,7 +161,7 @@ namespace Adwaita adw_toast_set_detailed_action_name(Glib::unwrap(this), Glib::c_str_or_nullptr(value)); } - auto Toast::set_priority(Priority value) -> void + auto Toast::set_priority(ToastPriority value) -> void { adw_toast_set_priority(Glib::unwrap(this), static_cast<AdwToastPriority>(value)); } @@ -203,9 +201,9 @@ namespace Adwaita return helpers::make_property_proxy<Gtk::Widget *>(*this, "custom-title"); } - auto Toast::property_priority() -> Glib::PropertyProxy<Priority> + auto Toast::property_priority() -> Glib::PropertyProxy<ToastPriority> { - return helpers::make_property_proxy<Priority>(*this, "priority"); + return helpers::make_property_proxy<ToastPriority>(*this, "priority"); } auto Toast::property_timeout() -> Glib::PropertyProxy<unsigned> |
