diff options
Diffstat (limited to 'include/turns/adw/toastoverlay.hpp')
| -rw-r--r-- | include/turns/adw/toastoverlay.hpp | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/include/turns/adw/toastoverlay.hpp b/include/turns/adw/toastoverlay.hpp index 958266b..49f6a59 100644 --- a/include/turns/adw/toastoverlay.hpp +++ b/include/turns/adw/toastoverlay.hpp @@ -1,55 +1,63 @@ #ifndef TURNS_ADW_TOASTOVERLAY_HPP #define TURNS_ADW_TOASTOVERLAY_HPP -#include "turns/adw/helpers/gobj_cast.hpp" +#include "turns/adw/helpers/gobj_mixin.hpp" #include "turns/adw/helpers/properties.hpp" #include <glibmm/refptr.h> #include <gtkmm/widget.h> -using AdwToastOverlay = struct _AdwToastOverlay; +#define _ADWAITA_INSIDE +#include <adw-toast-overlay.h> +#undef _ADWAITA_INSIDE namespace turns::adw { - struct ToastOverlay_Class; - - struct Toast; - struct ToastOverlay final : Gtk::Widget, helpers::gobj_mixin<ToastOverlay, AdwToastOverlay> { - using helpers::gobj_mixin<ToastOverlay, AdwToastOverlay>::gobj; - using helpers::gobj_mixin<ToastOverlay, AdwToastOverlay>::gobj_copy; + struct Class : Glib::Class + { + using BaseClassParent = GtkWidgetClass; + using BaseClassType = AdwToastOverlayClass; + using BaseObjectType = AdwToastOverlay; + using CppClassParent = struct Gtk::Widget_Class; + using CppObjectType = ToastOverlay; + + 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; + + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj_copy; + explicit ToastOverlay(); + ToastOverlay(ToastOverlay const & other) = delete; ToastOverlay(ToastOverlay && other) noexcept = default; - auto operator=(ToastOverlay && other) noexcept -> ToastOverlay & = default; - ToastOverlay(ToastOverlay const & other) = delete; auto operator=(ToastOverlay const & other) noexcept -> ToastOverlay & = delete; - - explicit ToastOverlay(); + auto operator=(ToastOverlay && other) noexcept -> ToastOverlay & = default; auto static get_type() -> GType; auto static get_base_type() -> GType; - auto add(Toast && toast) -> void; + auto add(struct Toast && toast) -> void; - // clang-format off - template<typename Self> auto property_child(this Self && self); - // clang-format on + auto property_child(this auto && self); protected: explicit ToastOverlay(Glib::ConstructParams const & params); - explicit ToastOverlay(AdwToastOverlay * gobj); - - private: - friend ToastOverlay_Class; - static ToastOverlay_Class s_class; + explicit ToastOverlay(BaseObjectType * gobj); }; - template<typename Self> - auto ToastOverlay::property_child(this Self && self) + auto ToastOverlay::property_child(this auto && self) { return helpers::make_property_proxy<Gtk::Widget *>(self, "child"); } |
