diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-08-17 11:41:43 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-08-17 11:41:43 +0200 |
| commit | 97cb30337429a6849c276693ddf7fb40fec1aa14 (patch) | |
| tree | 5f42489d34deb3076677996ce10269d78af9cfa2 /include/turns/adw/application.hpp | |
| parent | 6fb8667b9848c8fe0989bb665e2f4ddc09179983 (diff) | |
| download | libadwaitamm-97cb30337429a6849c276693ddf7fb40fec1aa14.tar.xz libadwaitamm-97cb30337429a6849c276693ddf7fb40fec1aa14.zip | |
ui: add participant shading color preferences
Diffstat (limited to 'include/turns/adw/application.hpp')
| -rw-r--r-- | include/turns/adw/application.hpp | 51 |
1 files changed, 31 insertions, 20 deletions
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 <glibmm/class.h> #include <glibmm/refptr.h> #include <glibmm/ustring.h> @@ -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, AdwApplication> { - 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<typename Self> - auto gobj(this Self && self) noexcept - { - return reinterpret_cast<AdwApplication *>(self.gobject_); - } + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::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<Application>; + 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 |
