From fb917713e55147c6b0de514924c4867d9e8d5894 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 --- adw/include/turns/adw/actionrow.hpp | 149 +++++++++++++++++++++++++++ adw/include/turns/adw/application.hpp | 51 +++++---- adw/include/turns/adw/dialog.hpp | 64 ++++++++++++ adw/include/turns/adw/helpers/gobj_cast.hpp | 37 ------- adw/include/turns/adw/helpers/gobj_mixin.hpp | 37 +++++++ adw/include/turns/adw/preferencesdialog.hpp | 66 ++++++++++++ adw/include/turns/adw/preferencespage.hpp | 61 +++++++++++ adw/include/turns/adw/preferencesrow.hpp | 118 +++++++++++++++++++++ adw/include/turns/adw/toast.hpp | 85 ++++++++------- adw/include/turns/adw/toastoverlay.hpp | 54 +++++----- 10 files changed, 602 insertions(+), 120 deletions(-) create mode 100644 adw/include/turns/adw/actionrow.hpp create mode 100644 adw/include/turns/adw/dialog.hpp delete mode 100644 adw/include/turns/adw/helpers/gobj_cast.hpp create mode 100644 adw/include/turns/adw/helpers/gobj_mixin.hpp create mode 100644 adw/include/turns/adw/preferencesdialog.hpp create mode 100644 adw/include/turns/adw/preferencespage.hpp create mode 100644 adw/include/turns/adw/preferencesrow.hpp (limited to 'adw/include') diff --git a/adw/include/turns/adw/actionrow.hpp b/adw/include/turns/adw/actionrow.hpp new file mode 100644 index 0000000..15ddbb1 --- /dev/null +++ b/adw/include/turns/adw/actionrow.hpp @@ -0,0 +1,149 @@ +#ifndef TURNS_ADW_ACTION_ROW_HPP +#define TURNS_ADW_ACTION_ROW_HPP + +#include "helpers/gobj_mixin.hpp" +#include "turns/adw/helpers/properties.hpp" +#include "turns/adw/preferencesrow.hpp" + +#include +#include +#include + +#include + +using AdwActionRow = struct _AdwActionRow; + +namespace turns::adw +{ + struct ActionRow : adw::PreferencesRow, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = AdwPreferencesRowClass; + using BaseClassType = struct AdwActionRowClass; + using BaseObjectType = AdwActionRow; + using CppClassParent = adw::PreferencesRow; + using CppObjectType = ActionRow; + + 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::gobj; + using helpers::gobj_mixin::gobj_copy; + + explicit ActionRow(); + ActionRow(ActionRow const & other) = delete; + ActionRow(ActionRow && other) noexcept = default; + + auto operator=(ActionRow const & other) noexcept -> ActionRow & = delete; + auto operator=(ActionRow && other) noexcept -> ActionRow & = default; + + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + auto add_prefix(Gtk::Widget & widget) -> ActionRow &; + auto add_suffix(Gtk::Widget & widget) -> ActionRow &; + auto remove(Gtk::Widget & widget) -> ActionRow &; + + auto get_activatable_widget(this auto && self) noexcept; + [[deprecated("replaced by add_prefix")]] auto get_icon_name(this auto && self); + auto get_subtitle(this auto && self); + auto get_subtitle_lines(this auto && self) noexcept; + auto get_subtitle_selectable(this auto && self) noexcept; + auto get_title_lines(this auto && self) noexcept; + + auto set_activatable_widget(Gtk::Widget & widget) noexcept -> CppObjectType &; + [[deprecated("replaced by add_prefix")]] auto set_icon_name(Glib::ustring const & name) -> CppObjectType &; + auto set_subtitle(Glib::ustring const & subtitle) -> CppObjectType &; + auto set_subtitle_lines(int subtitle_lines) noexcept -> CppObjectType &; + auto set_subtitle_selectable(bool subtitle_selectable) noexcept -> CppObjectType &; + auto set_title_lines(int title_lines) noexcept -> CppObjectType &; + + auto property_activatable_widget(this auto && self); + [[deprecated("replaced by add_prefix")]] auto property_icon_name(this auto && self); + auto property_subtitle(this auto && self); + auto property_subtitle_lines(this auto && self); + auto property_subtitle_selectable(this auto && self); + auto property_title_lines(this auto && self); + + protected: + explicit ActionRow(Glib::ConstructParams const & params); + explicit ActionRow(BaseObjectType * gobj); + }; + + auto ActionRow::get_activatable_widget(this auto && self) noexcept + { + return self.property_activatable_widget().value(); + } + + auto ActionRow::get_icon_name(this auto && self) + { + return self.property_icon_name().value(); + } + + auto ActionRow::get_subtitle(this auto && self) + { + return self.property_subtitle().value(); + } + + auto ActionRow::get_subtitle_lines(this auto && self) noexcept + { + return self.property_subtitle_lines().value(); + } + + auto ActionRow::get_subtitle_selectable(this auto && self) noexcept + { + return self.property_subtitle_selectable().value(); + } + + auto ActionRow::get_title_lines(this auto && self) noexcept + { + return self.property_title_lines().value(); + } + + auto ActionRow::property_activatable_widget(this auto && self) + { + return helpers::make_property_proxy(self, "activatable-widget"); + } + + auto ActionRow::property_icon_name(this auto && self) + { + return helpers::make_property_proxy(self, "icon-name"); + } + + auto ActionRow::property_subtitle(this auto && self) + { + return helpers::make_property_proxy(self, "subtitle"); + } + + auto ActionRow::property_subtitle_lines(this auto && self) + { + return helpers::make_property_proxy(self, "subtitle-lines"); + } + + auto ActionRow::property_subtitle_selectable(this auto && self) + { + return helpers::make_property_proxy(self, "subtitle-selectable"); + } + + auto ActionRow::property_title_lines(this auto && self) + { + return helpers::make_property_proxy(self, "title-lines"); + } + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwActionRow * object, bool copy = false) -> Glib::RefPtr; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/turns/adw/application.hpp b/adw/include/turns/adw/application.hpp index 26bec41..64efcb0 100644 --- a/adw/include/turns/adw/application.hpp +++ b/adw/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 diff --git a/adw/include/turns/adw/dialog.hpp b/adw/include/turns/adw/dialog.hpp new file mode 100644 index 0000000..af5f5da --- /dev/null +++ b/adw/include/turns/adw/dialog.hpp @@ -0,0 +1,64 @@ +#ifndef TURNS_ADW_DIALOG_HPP +#define TURNS_ADW_DIALOG_HPP + +#include "helpers/gobj_mixin.hpp" + +#include +#include + +#include + +using AdwDialog = struct _AdwDialog; + +namespace turns::adw +{ + struct Dialog_Class; + + struct Dialog : Gtk::Widget, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = GtkWidgetClass; + using BaseClassType = struct AdwDialogClass; + using BaseObjectType = AdwDialog; + using CppClassParent = struct Gtk::Widget_Class; + using CppObjectType = Dialog; + + 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::gobj; + using helpers::gobj_mixin::gobj_copy; + + explicit Dialog(); + Dialog(Dialog const & other) = delete; + Dialog(Dialog && other) noexcept = default; + + auto operator=(Dialog const & other) noexcept -> Dialog & = delete; + auto operator=(Dialog && other) noexcept -> Dialog & = default; + + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + auto present(Gtk::Widget * parent) -> void; + + protected: + explicit Dialog(Glib::ConstructParams const & params); + explicit Dialog(BaseObjectType * gobj); + }; +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwDialog * object, bool copy = false) -> Glib::RefPtr; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/turns/adw/helpers/gobj_cast.hpp b/adw/include/turns/adw/helpers/gobj_cast.hpp deleted file mode 100644 index 1ef9089..0000000 --- a/adw/include/turns/adw/helpers/gobj_cast.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef TURNS_ADW_HELPERS_GOBJ_CAST_HPP -#define TURNS_ADW_HELPERS_GOBJ_CAST_HPP - -#include - -#include - -namespace turns::adw::helpers -{ - - template - struct gobj_mixin - { - template - auto gobj(this Self && self) noexcept - { - using clean_type = std::remove_reference_t; - using gobj_type = std::conditional_t, std::add_const_t, Glib::Object>; - using cast_type = std::conditional_t, std::add_const_t, AdwType>; - - return reinterpret_cast(static_cast(self).gobj()); - } - - template - auto gobj_copy(this Self && self) noexcept -> AdwType * - { - using clean_type = std::remove_reference_t; - using gobj_type = std::conditional_t, std::add_const_t, Glib::Object>; - - static_cast(self).reference(); - return self.gobj(); - } - }; - -} // namespace turns::adw::helpers - -#endif \ No newline at end of file diff --git a/adw/include/turns/adw/helpers/gobj_mixin.hpp b/adw/include/turns/adw/helpers/gobj_mixin.hpp new file mode 100644 index 0000000..d9e5097 --- /dev/null +++ b/adw/include/turns/adw/helpers/gobj_mixin.hpp @@ -0,0 +1,37 @@ +#ifndef TURNS_ADW_HELPERS_GOBJ_MIXIN_HPP +#define TURNS_ADW_HELPERS_GOBJ_MIXIN_HPP + +#include + +#include + +namespace turns::adw::helpers +{ + + template + struct gobj_mixin + { + template + auto gobj(this Self && self) noexcept + { + using clean_type = std::remove_reference_t; + using gobj_type = std::conditional_t, std::add_const_t, Glib::Object>; + using cast_type = std::conditional_t, std::add_const_t, AdwType>; + + return reinterpret_cast(static_cast(self).gobj()); + } + + template + auto gobj_copy(this Self && self) noexcept -> AdwType * + { + using clean_type = std::remove_reference_t; + using gobj_type = std::conditional_t, std::add_const_t, Glib::Object>; + + static_cast(self).reference(); + return self.gobj(); + } + }; + +} // namespace turns::adw::helpers + +#endif \ No newline at end of file diff --git a/adw/include/turns/adw/preferencesdialog.hpp b/adw/include/turns/adw/preferencesdialog.hpp new file mode 100644 index 0000000..06ac600 --- /dev/null +++ b/adw/include/turns/adw/preferencesdialog.hpp @@ -0,0 +1,66 @@ +#ifndef TURNS_ADW_PREFERENCES_DIALOG_HPP +#define TURNS_ADW_PREFERENCES_DIALOG_HPP + +#include "dialog.hpp" +#include "helpers/gobj_mixin.hpp" +#include "turns/adw/preferencespage.hpp" + +#include +#include + +#include + +using AdwPreferencesDialog = struct _AdwPreferencesDialog; + +namespace turns::adw +{ + struct PreferencesDialog_Class; + + struct PreferencesDialog : adw::Dialog, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = AdwDialogClass; + using BaseClassType = struct AdwPreferencesDialogClass; + using BaseObjectType = AdwPreferencesDialog; + using CppClassParent = adw::Dialog::Class; + using CppObjectType = PreferencesDialog; + + 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::gobj; + using helpers::gobj_mixin::gobj_copy; + + explicit PreferencesDialog(); + PreferencesDialog(PreferencesDialog const & other) = delete; + PreferencesDialog(PreferencesDialog && other) noexcept = default; + + auto operator=(PreferencesDialog const & other) noexcept -> PreferencesDialog & = delete; + auto operator=(PreferencesDialog && other) noexcept -> PreferencesDialog & = default; + + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + auto add(adw::PreferencesPage & page) -> void; + + protected: + explicit PreferencesDialog(Glib::ConstructParams const & params); + explicit PreferencesDialog(BaseObjectType * gobj); + }; +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwPreferencesDialog * object, bool copy = false) -> Glib::RefPtr; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/turns/adw/preferencespage.hpp b/adw/include/turns/adw/preferencespage.hpp new file mode 100644 index 0000000..30e7eed --- /dev/null +++ b/adw/include/turns/adw/preferencespage.hpp @@ -0,0 +1,61 @@ +#ifndef TURNS_ADW_PREFERENCES_PAGE_HPP +#define TURNS_ADW_PREFERENCES_PAGE_HPP + +#include "helpers/gobj_mixin.hpp" + +#include +#include +#include + +#include + +using AdwPreferencesPage = struct _AdwPreferencesPage; + +namespace turns::adw +{ + struct PreferencesPage : Gtk::Widget, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = GtkWidgetClass; + using BaseClassType = struct AdwPreferencesPageClass; + using BaseObjectType = AdwPreferencesPage; + using CppClassParent = struct Gtk::Widget_Class; + using CppObjectType = PreferencesPage; + + 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::gobj; + using helpers::gobj_mixin::gobj_copy; + + explicit PreferencesPage(); + PreferencesPage(PreferencesPage const & other) = delete; + PreferencesPage(PreferencesPage && other) noexcept = default; + + auto operator=(PreferencesPage const & other) noexcept -> PreferencesPage & = delete; + auto operator=(PreferencesPage && other) noexcept -> PreferencesPage & = default; + + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + protected: + explicit PreferencesPage(Glib::ConstructParams const & params); + explicit PreferencesPage(BaseObjectType * gobj); + }; +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwPreferencesPage * object, bool copy = false) -> Glib::RefPtr; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/turns/adw/preferencesrow.hpp b/adw/include/turns/adw/preferencesrow.hpp new file mode 100644 index 0000000..6f831b0 --- /dev/null +++ b/adw/include/turns/adw/preferencesrow.hpp @@ -0,0 +1,118 @@ +#ifndef TURNS_ADW_PREFERENCES_ROW_HPP +#define TURNS_ADW_PREFERENCES_ROW_HPP + +#include "helpers/gobj_mixin.hpp" +#include "turns/adw/helpers/properties.hpp" + +#include +#include +#include + +#include + +using AdwPreferencesRow = struct _AdwPreferencesRow; + +namespace turns::adw +{ + struct PreferencesRow : Gtk::ListBoxRow, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = GtkListBoxRowClass; + using BaseClassType = struct AdwPreferencesRowClass; + using BaseObjectType = AdwPreferencesRow; + using CppClassParent = struct Gtk::ListBoxRow_Class; + using CppObjectType = PreferencesRow; + + 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::gobj; + using helpers::gobj_mixin::gobj_copy; + + explicit PreferencesRow(); + PreferencesRow(PreferencesRow const & other) = delete; + PreferencesRow(PreferencesRow && other) noexcept = default; + + auto operator=(PreferencesRow const & other) noexcept -> PreferencesRow & = delete; + auto operator=(PreferencesRow && other) noexcept -> PreferencesRow & = default; + + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + auto get_title(this auto && self); + auto get_title_selectable(this auto && self) noexcept; + auto get_use_markup(this auto && self) noexcept; + auto get_use_underline(this auto && self) noexcept; + + auto set_title(Glib::ustring const & title) -> CppObjectType &; + auto set_title_selectable(bool selectable) noexcept -> CppObjectType &; + auto set_use_markup(bool use) noexcept -> CppObjectType &; + auto set_use_underline(bool use) noexcept -> CppObjectType &; + + auto property_title(this auto && self); + auto property_title_selectable(this auto && self); + auto property_use_markup(this auto && self); + auto property_use_underline(this auto && self); + + protected: + explicit PreferencesRow(Glib::ConstructParams const & params); + explicit PreferencesRow(BaseObjectType * gobj); + }; + + auto PreferencesRow::get_title(this auto && self) + { + return self.property_title().value(); + } + + auto PreferencesRow::get_title_selectable(this auto && self) noexcept + { + return self.property_title_selectable().value(); + } + + auto PreferencesRow::get_use_markup(this auto && self) noexcept + { + return self.property_use_markup().value(); + } + + auto PreferencesRow::get_use_underline(this auto && self) noexcept + { + return self.property_use_underline().value(); + } + + auto PreferencesRow::property_title(this auto && self) + { + return helpers::make_property_proxy(self, "title"); + } + + auto PreferencesRow::property_title_selectable(this auto && self) + { + return helpers::make_property_proxy(self, "title-selectable"); + } + + auto PreferencesRow::property_use_markup(this auto && self) + { + return helpers::make_property_proxy(self, "use-markup"); + } + + auto PreferencesRow::property_use_underline(this auto && self) + { + return helpers::make_property_proxy(self, "use-underline"); + } + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwPreferencesRow * object, bool copy = false) -> Glib::RefPtr; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/turns/adw/toast.hpp b/adw/include/turns/adw/toast.hpp index f82e01e..83242c7 100644 --- a/adw/include/turns/adw/toast.hpp +++ b/adw/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 @@ -11,101 +11,106 @@ #include +#define _ADWAITA_INSIDE +#include +#undef _ADWAITA_INSIDE + using AdwToast = struct _AdwToast; namespace turns::adw { - struct Toast_Class; - struct Toast final : Glib::Object, helpers::gobj_mixin { + 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::gobj; - using helpers::gobj_mixin::gobj_copy; + using helpers::gobj_mixin::gobj; + using helpers::gobj_mixin::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 auto property_action_name(this Self && self); - template auto property_action_target(this Self && self); - template auto property_button_label(this Self && self); - template auto property_custom_title(this Self && self); - template auto property_priority(this Self && self); - template auto property_timeout(this Self && self); - template auto property_title(this Self && self); - template 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 - auto Toast::property_action_name(this Self && self) + auto Toast::property_action_name(this auto && self) { return helpers::make_property_proxy(self, "action-name"); } - template - auto Toast::property_action_target(this Self && self) + auto Toast::property_action_target(this auto && self) { return helpers::make_property_proxy(self, "action-target"); } - template - auto Toast::property_button_label(this Self && self) + auto Toast::property_button_label(this auto && self) { return helpers::make_property_proxy(self, "button-label"); } - template - auto Toast::property_custom_title(this Self && self) + auto Toast::property_custom_title(this auto && self) { return helpers::make_property_proxy(self, "custom-title"); } - template - auto Toast::property_priority(this Self && self) + auto Toast::property_priority(this auto && self) { return helpers::make_property_proxy(self, "priority"); } - template - auto Toast::property_timeout(this Self && self) + auto Toast::property_timeout(this auto && self) { return helpers::make_property_proxy(self, "timeout"); } - template - auto Toast::property_title(this Self && self) + auto Toast::property_title(this auto && self) { return helpers::make_property_proxy(self, "title"); } - template - auto Toast::property_use_markup(this Self && self) + auto Toast::property_use_markup(this auto && self) { return helpers::make_property_proxy(self, "use-markup"); } diff --git a/adw/include/turns/adw/toastoverlay.hpp b/adw/include/turns/adw/toastoverlay.hpp index 958266b..49f6a59 100644 --- a/adw/include/turns/adw/toastoverlay.hpp +++ b/adw/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 #include -using AdwToastOverlay = struct _AdwToastOverlay; +#define _ADWAITA_INSIDE +#include +#undef _ADWAITA_INSIDE namespace turns::adw { - struct ToastOverlay_Class; - - struct Toast; - struct ToastOverlay final : Gtk::Widget, helpers::gobj_mixin { - using helpers::gobj_mixin::gobj; - using helpers::gobj_mixin::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::gobj; + using helpers::gobj_mixin::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 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 - auto ToastOverlay::property_child(this Self && self) + auto ToastOverlay::property_child(this auto && self) { return helpers::make_property_proxy(self, "child"); } -- cgit v1.2.3