diff options
Diffstat (limited to 'include/turns/adw/toast.hpp')
| -rw-r--r-- | include/turns/adw/toast.hpp | 85 |
1 files changed, 45 insertions, 40 deletions
diff --git a/include/turns/adw/toast.hpp b/include/turns/adw/toast.hpp index f82e01e..83242c7 100644 --- a/include/turns/adw/toast.hpp +++ b/include/turns/adw/toast.hpp @@ -1,7 +1,7 @@ #ifndef TURNS_ADW_TOAST_HPP #define TURNS_ADW_TOAST_HPP -#include "turns/adw/helpers/gobj_cast.hpp" +#include "turns/adw/helpers/gobj_mixin.hpp" #include "turns/adw/helpers/properties.hpp" #include <glibmm/object.h> @@ -11,101 +11,106 @@ #include <gtkmm/widget.h> +#define _ADWAITA_INSIDE +#include <adw-toast.h> +#undef _ADWAITA_INSIDE + using AdwToast = struct _AdwToast; namespace turns::adw { - struct Toast_Class; - struct Toast final : Glib::Object, helpers::gobj_mixin<Toast, AdwToast> { + struct Class : Glib::Class + { + using BaseClassParent = GObjectClass; + using BaseClassType = AdwToastClass; + using BaseObjectType = AdwToast; + using CppClassParent = struct Glib::Object_Class; + using CppObjectType = Toast; + + auto init() -> Glib::Class const &; + auto static class_init_function(void * gclass, void * data) -> void; + auto static wrap_new(GObject * object) -> Glib::ObjectBase *; + }; + + using BaseObjectType = Class::BaseObjectType; + using BaseClassType = Class::BaseClassType; + using CppObjectType = Class::CppObjectType; + using CppClassType = Class; + enum class Priority { NORMAL, HIGH, }; - using helpers::gobj_mixin<Toast, AdwToast>::gobj; - using helpers::gobj_mixin<Toast, AdwToast>::gobj_copy; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj_copy; + explicit Toast(Glib::ustring const & title); + Toast(Toast const & other) = delete; Toast(Toast && other) noexcept = default; - auto operator=(Toast && other) noexcept -> Toast & = default; - Toast(Toast const & other) = delete; auto operator=(Toast const & other) noexcept -> Toast & = delete; - - explicit Toast(Glib::ustring const & title); + auto operator=(Toast && other) noexcept -> Toast & = default; auto static get_type() -> GType; auto static get_base_type() -> GType; auto dismiss() -> void; - // clang-format off - template<typename Self> auto property_action_name(this Self && self); - template<typename Self> auto property_action_target(this Self && self); - template<typename Self> auto property_button_label(this Self && self); - template<typename Self> auto property_custom_title(this Self && self); - template<typename Self> auto property_priority(this Self && self); - template<typename Self> auto property_timeout(this Self && self); - template<typename Self> auto property_title(this Self && self); - template<typename Self> auto property_use_markup(this Self && self); - // clang-format on + auto property_action_name(this auto && self); + auto property_action_target(this auto && self); + auto property_button_label(this auto && self); + auto property_custom_title(this auto && self); + auto property_priority(this auto && self); + auto property_timeout(this auto && self); + auto property_title(this auto && self); + auto property_use_markup(this auto && self); protected: explicit Toast(Glib::ConstructParams const & params); - explicit Toast(AdwToast * gobj); - - private: - friend Toast_Class; - static Toast_Class s_class; + explicit Toast(BaseObjectType * gobj); }; - template<typename Self> - auto Toast::property_action_name(this Self && self) + auto Toast::property_action_name(this auto && self) { return helpers::make_property_proxy<Glib::ustring>(self, "action-name"); } - template<typename Self> - auto Toast::property_action_target(this Self && self) + auto Toast::property_action_target(this auto && self) { return helpers::make_property_proxy<Glib::VariantBase>(self, "action-target"); } - template<typename Self> - auto Toast::property_button_label(this Self && self) + auto Toast::property_button_label(this auto && self) { return helpers::make_property_proxy<Glib::ustring>(self, "button-label"); } - template<typename Self> - auto Toast::property_custom_title(this Self && self) + auto Toast::property_custom_title(this auto && self) { return helpers::make_property_proxy<Gtk::Widget *>(self, "custom-title"); } - template<typename Self> - auto Toast::property_priority(this Self && self) + auto Toast::property_priority(this auto && self) { return helpers::make_property_proxy<Priority>(self, "priority"); } - template<typename Self> - auto Toast::property_timeout(this Self && self) + auto Toast::property_timeout(this auto && self) { return helpers::make_property_proxy<unsigned>(self, "timeout"); } - template<typename Self> - auto Toast::property_title(this Self && self) + auto Toast::property_title(this auto && self) { return helpers::make_property_proxy<Glib::ustring>(self, "title"); } - template<typename Self> - auto Toast::property_use_markup(this Self && self) + auto Toast::property_use_markup(this auto && self) { return helpers::make_property_proxy<bool>(self, "use-markup"); } |
