From 97cb30337429a6849c276693ddf7fb40fec1aa14 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sat, 17 Aug 2024 11:41:43 +0200 Subject: ui: add participant shading color preferences --- include/turns/adw/application.hpp | 51 ++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'include/turns/adw/application.hpp') diff --git a/include/turns/adw/application.hpp b/include/turns/adw/application.hpp index 26bec41..64efcb0 100644 --- a/include/turns/adw/application.hpp +++ b/include/turns/adw/application.hpp @@ -1,6 +1,9 @@ #ifndef TURNS_ADW_APPLICATION_HPP #define TURNS_ADW_APPLICATION_HPP +#include "turns/adw/helpers/gobj_mixin.hpp" + +#include #include #include @@ -12,38 +15,46 @@ using AdwApplication = struct _AdwApplication; namespace turns::adw { - struct Application_Class; - - struct Application : Gtk::Application + struct Application : Gtk::Application, + helpers::gobj_mixin { - Application(Application && other) noexcept = default; - auto operator=(Application && other) noexcept -> Application & = default; + struct Class : Glib::Class + { + using BaseClassParent = GtkApplicationClass; + using BaseClassType = struct AdwApplicationClass; + using BaseObjectType = AdwApplication; + using CppClassParent = struct Gtk::Application_Class; + using CppObjectType = Application; - Application(Application const & other) = delete; - auto operator=(Application const & other) noexcept -> Application & = delete; + auto init() -> Glib::Class const &; + auto static class_init_function(void * gclass, void * data) -> void; + auto static wrap_new(GObject * object) -> Glib::ObjectBase *; + }; - auto static get_type() -> GType; - auto static get_base_type() -> GType; + using BaseObjectType = Class::BaseObjectType; + using BaseClassType = Class::BaseClassType; + using CppObjectType = Class::CppObjectType; + using CppClassType = Class; - template - auto gobj(this Self && self) noexcept - { - return reinterpret_cast(self.gobject_); - } + using helpers::gobj_mixin::gobj; + using helpers::gobj_mixin::gobj_copy; - auto gobj_copy() -> AdwApplication *; + Application(Application const & other) = delete; + Application(Application && other) noexcept = default; + + auto operator=(Application const & other) noexcept -> Application & = delete; + auto operator=(Application && other) noexcept -> Application & = default; auto static create(Glib::ustring const & id = {}, Gio::Application::Flags flags = Gio::Application::Flags::NONE) -> Glib::RefPtr; + auto static get_type() -> GType; + auto static get_base_type() -> GType; + protected: explicit Application(Glib::ConstructParams const & params); - explicit Application(AdwApplication * gobj); + explicit Application(BaseObjectType * gobj); explicit Application(Glib::ustring const & id = {}, Gio::Application::Flags flags = Gio::Application::Flags::NONE); - - private: - friend Application_Class; - static Application_Class s_class; }; } // namespace turns::adw -- cgit v1.2.3