From ee599d7d62c16bb59603bedb62f03c01504a1893 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 3 Apr 2025 18:41:43 +0200 Subject: adw: prepare files for extraction --- adw/include/adwaitamm/actionrow.hpp | 95 +++++++++++++++++++++ adw/include/adwaitamm/application.hpp | 67 +++++++++++++++ adw/include/adwaitamm/applicationwindow.hpp | 64 ++++++++++++++ adw/include/adwaitamm/breakpoint.hpp | 113 ++++++++++++++++++++++++ adw/include/adwaitamm/dialog.hpp | 82 ++++++++++++++++++ adw/include/adwaitamm/helpers/gobj_mixin.hpp | 37 ++++++++ adw/include/adwaitamm/helpers/properties.hpp | 35 ++++++++ adw/include/adwaitamm/preferencesdialog.hpp | 72 ++++++++++++++++ adw/include/adwaitamm/preferencespage.hpp | 66 ++++++++++++++ adw/include/adwaitamm/preferencesrow.hpp | 123 +++++++++++++++++++++++++++ adw/include/adwaitamm/switchrow.hpp | 88 +++++++++++++++++++ adw/include/adwaitamm/toast.hpp | 111 ++++++++++++++++++++++++ adw/include/adwaitamm/toastoverlay.hpp | 77 +++++++++++++++++ adw/include/adwaitamm/wrap_init.hpp | 9 ++ 14 files changed, 1039 insertions(+) create mode 100644 adw/include/adwaitamm/actionrow.hpp create mode 100644 adw/include/adwaitamm/application.hpp create mode 100644 adw/include/adwaitamm/applicationwindow.hpp create mode 100644 adw/include/adwaitamm/breakpoint.hpp create mode 100644 adw/include/adwaitamm/dialog.hpp create mode 100644 adw/include/adwaitamm/helpers/gobj_mixin.hpp create mode 100644 adw/include/adwaitamm/helpers/properties.hpp create mode 100644 adw/include/adwaitamm/preferencesdialog.hpp create mode 100644 adw/include/adwaitamm/preferencespage.hpp create mode 100644 adw/include/adwaitamm/preferencesrow.hpp create mode 100644 adw/include/adwaitamm/switchrow.hpp create mode 100644 adw/include/adwaitamm/toast.hpp create mode 100644 adw/include/adwaitamm/toastoverlay.hpp create mode 100644 adw/include/adwaitamm/wrap_init.hpp (limited to 'adw/include/adwaitamm') diff --git a/adw/include/adwaitamm/actionrow.hpp b/adw/include/adwaitamm/actionrow.hpp new file mode 100644 index 0000000..1859048 --- /dev/null +++ b/adw/include/adwaitamm/actionrow.hpp @@ -0,0 +1,95 @@ +#ifndef LIBADWAITAMM_ACTION_ROW_HPP +#define LIBADWAITAMM_ACTION_ROW_HPP + +#include "helpers/gobj_mixin.hpp" +#include "adwaitamm/preferencesrow.hpp" + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +using AdwActionRow = struct _AdwActionRow; +using AdwActionRowClass = struct _AdwActionRowClass; + +namespace turns::adw +{ + struct ActionRow : adw::PreferencesRow, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = AdwPreferencesRowClass; + using BaseClassType = AdwActionRowClass; + using BaseObjectType = AdwActionRow; + using CppClassParent = adw::PreferencesRow::Class; + 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() const noexcept -> Glib::RefPtr; + [[deprecated("replaced by add_prefix")]] auto get_icon_name() const -> Glib::ustring; + auto get_subtitle() const -> Glib::ustring; + auto get_subtitle_lines() const noexcept -> int; + auto get_subtitle_selectable() const noexcept -> bool; + auto get_title_lines() const noexcept -> int; + + auto property_activatable_widget() noexcept -> Glib::PropertyProxy; + [[deprecated("replaced by add_prefix")]] auto property_icon_name() noexcept -> Glib::PropertyProxy; + auto property_subtitle() noexcept -> Glib::PropertyProxy; + auto property_subtitle_lines() noexcept -> Glib::PropertyProxy; + auto property_subtitle_selectable() noexcept -> Glib::PropertyProxy; + auto property_title_lines() noexcept -> Glib::PropertyProxy; + + 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 &; + + protected: + explicit ActionRow(Glib::ConstructParams const & params); + explicit ActionRow(BaseObjectType * gobj); + }; + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwActionRow * object, bool copy = false) -> turns::adw::ActionRow *; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/application.hpp b/adw/include/adwaitamm/application.hpp new file mode 100644 index 0000000..c482b8a --- /dev/null +++ b/adw/include/adwaitamm/application.hpp @@ -0,0 +1,67 @@ +#ifndef LIBADWAITAMM_APPLICATION_HPP +#define LIBADWAITAMM_APPLICATION_HPP + +#include "adwaitamm/helpers/gobj_mixin.hpp" + +#include +#include +#include + +#include + +#include + +using AdwApplication = struct _AdwApplication; +using AdwApplicationClass = struct _AdwApplicationClass; + +namespace turns::adw +{ + struct Application : Gtk::Application, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = GtkApplicationClass; + using BaseClassType = AdwApplicationClass; + using BaseObjectType = AdwApplication; + using CppClassParent = struct Gtk::Application_Class; + using CppObjectType = Application; + + 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; + + 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(BaseObjectType * gobj); + explicit Application(Glib::ustring const & id = {}, Gio::Application::Flags flags = Gio::Application::Flags::NONE); + }; +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwApplication * object, bool copy = false) -> Glib::RefPtr; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/applicationwindow.hpp b/adw/include/adwaitamm/applicationwindow.hpp new file mode 100644 index 0000000..a8175df --- /dev/null +++ b/adw/include/adwaitamm/applicationwindow.hpp @@ -0,0 +1,64 @@ +#ifndef LIBADWAITAMM_APPLICATION_WINDOW_HPP +#define LIBADWAITAMM_APPLICATION_WINDOW_HPP + +#include "helpers/gobj_mixin.hpp" + +#include +#include +#include +#include + +#include +#include + +using AdwApplicationWindow = struct _AdwApplicationWindow; +using AdwApplicationWindowClass = struct _AdwApplicationWindowClass; + +namespace turns::adw +{ + struct ApplicationWindow : Gtk::ApplicationWindow, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = GtkApplicationWindowClass; + using BaseClassType = AdwApplicationWindowClass; + using BaseObjectType = AdwApplicationWindow; + using CppClassParent = struct Gtk::ApplicationWindow_Class; + using CppObjectType = ApplicationWindow; + + 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 ApplicationWindow(Gtk::Application & app); + ApplicationWindow(ApplicationWindow const & other) = delete; + ApplicationWindow(ApplicationWindow && other) noexcept = default; + + auto operator=(ApplicationWindow const & other) noexcept -> ApplicationWindow & = delete; + auto operator=(ApplicationWindow && other) noexcept -> ApplicationWindow & = default; + + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + protected: + explicit ApplicationWindow(Glib::ConstructParams const & params); + explicit ApplicationWindow(BaseObjectType * gobj); + }; +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwApplicationWindow * object, bool copy = false) -> turns::adw::ApplicationWindow *; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/breakpoint.hpp b/adw/include/adwaitamm/breakpoint.hpp new file mode 100644 index 0000000..8a78abb --- /dev/null +++ b/adw/include/adwaitamm/breakpoint.hpp @@ -0,0 +1,113 @@ +#ifndef LIBADWAITAMM_BREAKPOINT_HPP +#define LIBADWAITAMM_BREAKPOINT_HPP + +#include "adwaitamm/helpers/gobj_mixin.hpp" + +#include +#include +#include +#include +#include + +#include + +#include + +#include + +#define _ADWAITA_INSIDE +#include +#undef _ADWAITA_INSIDE + +namespace turns::adw +{ + struct BreakpointCondition + { + enum struct LengthType : int + { + min_width, + max_width, + min_height, + max_height, + }; + + enum struct RatioType : int + { + min_aspect_ratio, + max_aspect_ratio + }; + + BreakpointCondition(BreakpointCondition const & other); + BreakpointCondition(BreakpointCondition && other); + BreakpointCondition(LengthType type, double value, int unit); // FIXME: replace unit type with actual enum. + BreakpointCondition(RatioType type, int width, int height); + + ~BreakpointCondition() noexcept; + + auto operator&&(BreakpointCondition & rhs) & -> BreakpointCondition; + auto operator||(BreakpointCondition & lhs) & -> BreakpointCondition; + + explicit operator Glib::ustring() const; + + auto static parse(Glib::ustring str) -> std::optional; + + private: + friend struct Breakpoint; + + explicit BreakpointCondition(AdwBreakpointCondition * object); + + AdwBreakpointCondition * m_object{nullptr}; + }; + + struct Breakpoint final : Glib::Object, + Gtk::Buildable, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = GObjectClass; + using BaseClassType = AdwBreakpointClass; + using BaseObjectType = AdwBreakpoint; + using CppClassParent = struct Glib::Object_Class; + using CppObjectType = Breakpoint; + + 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; + + Breakpoint(Breakpoint const & other) = delete; + Breakpoint(Breakpoint && other) noexcept = default; + + auto operator=(Breakpoint const & other) noexcept -> Breakpoint & = delete; + auto operator=(Breakpoint && other) noexcept -> Breakpoint & = default; + + auto static create(BreakpointCondition & condition) -> Glib::RefPtr; + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + auto property_condition() -> Glib::PropertyProxy; + + protected: + explicit Breakpoint(BreakpointCondition & condition); + explicit Breakpoint(Glib::ConstructParams const & params); + explicit Breakpoint(BaseObjectType * gobj); + }; + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwBreakpoint * object, bool copy = false) -> Glib::RefPtr; +} // namespace Glib + + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/dialog.hpp b/adw/include/adwaitamm/dialog.hpp new file mode 100644 index 0000000..5be01b9 --- /dev/null +++ b/adw/include/adwaitamm/dialog.hpp @@ -0,0 +1,82 @@ +#ifndef LIBADWAITAMM_DIALOG_HPP +#define LIBADWAITAMM_DIALOG_HPP + +#include "helpers/gobj_mixin.hpp" +#include "adwaitamm/breakpoint.hpp" + +#include +#include +#include +#include +#include + +#include + +#include + +using AdwDialog = struct _AdwDialog; +using AdwDialogClass = struct _AdwDialogClass; + +namespace turns::adw +{ + struct Dialog_Class; + + struct Dialog : Gtk::Widget, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = GtkWidgetClass; + using BaseClassType = 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 add_breakpoint(Glib::RefPtr const & breakpoint) -> void; + auto close() -> void; + auto force_close() -> void; + auto get_can_close() const -> bool; + auto get_child() const -> Gtk::Widget *; + auto get_content_height() const -> int; + auto get_content_width() const -> int; + auto get_current_breakpoint() const -> Glib::RefPtr; + auto get_default_widget() const -> Gtk::Widget *; + auto get_focus() const -> Gtk::Widget *; + auto present(Gtk::Widget * parent) -> void; + auto set_title(Glib::ustring const & str) -> void; + + protected: + explicit Dialog(Glib::ConstructParams const & params); + explicit Dialog(BaseObjectType * gobj); + }; +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwDialog * object, bool copy = false) -> turns::adw::Dialog *; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/helpers/gobj_mixin.hpp b/adw/include/adwaitamm/helpers/gobj_mixin.hpp new file mode 100644 index 0000000..2a6aa37 --- /dev/null +++ b/adw/include/adwaitamm/helpers/gobj_mixin.hpp @@ -0,0 +1,37 @@ +#ifndef LIBADWAITAMM_HELPERS_GOBJ_MIXIN_HPP +#define LIBADWAITAMM_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 const_cast(self.gobj()); + } + }; + +} // namespace turns::adw::helpers + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/helpers/properties.hpp b/adw/include/adwaitamm/helpers/properties.hpp new file mode 100644 index 0000000..6a7f7aa --- /dev/null +++ b/adw/include/adwaitamm/helpers/properties.hpp @@ -0,0 +1,35 @@ +#ifndef LIBADWAITAMM_HELPERS_PROPERTIES_HPP +#define LIBADWAITAMM_HELPERS_PROPERTIES_HPP + +#include +#include + +#include + +namespace turns::adw::helpers +{ + + template + struct deduced_property_proxy + { + using type = Glib::PropertyProxy; + }; + + template + struct deduced_property_proxy + { + using type = Glib::PropertyProxy_ReadOnly; + }; + + template + using deduced_property_proxy_t = typename deduced_property_proxy::type; + + template + auto make_property_proxy(ObjectType && object, char const * property) + { + return deduced_property_proxy_t>{&object, property}; + } + +} // namespace turns::adw::helpers + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/preferencesdialog.hpp b/adw/include/adwaitamm/preferencesdialog.hpp new file mode 100644 index 0000000..d57e015 --- /dev/null +++ b/adw/include/adwaitamm/preferencesdialog.hpp @@ -0,0 +1,72 @@ +#ifndef LIBADWAITAMM_PREFERENCES_DIALOG_HPP +#define LIBADWAITAMM_PREFERENCES_DIALOG_HPP + +#include "dialog.hpp" +#include "helpers/gobj_mixin.hpp" +#include "adwaitamm/preferencespage.hpp" + +#include +#include +#include +#include +#include + +#include + +#include + +using AdwPreferencesDialog = struct _AdwPreferencesDialog; +using AdwPreferencesDialogClass = struct _AdwPreferencesDialogClass; + +namespace turns::adw +{ + struct PreferencesDialog_Class; + + struct PreferencesDialog : adw::Dialog, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = AdwDialogClass; + using BaseClassType = 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) -> turns::adw::PreferencesDialog *; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/preferencespage.hpp b/adw/include/adwaitamm/preferencespage.hpp new file mode 100644 index 0000000..d6c4ca4 --- /dev/null +++ b/adw/include/adwaitamm/preferencespage.hpp @@ -0,0 +1,66 @@ +#ifndef LIBADWAITAMM_PREFERENCES_PAGE_HPP +#define LIBADWAITAMM_PREFERENCES_PAGE_HPP + +#include "helpers/gobj_mixin.hpp" + +#include +#include +#include +#include +#include + +#include + +#include + +using AdwPreferencesPage = struct _AdwPreferencesPage; +using AdwPreferencesPageClass = struct _AdwPreferencesPageClass; + +namespace turns::adw +{ + struct PreferencesPage : Gtk::Widget, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = GtkWidgetClass; + using BaseClassType = 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) -> turns::adw::PreferencesPage *; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/preferencesrow.hpp b/adw/include/adwaitamm/preferencesrow.hpp new file mode 100644 index 0000000..f98e125 --- /dev/null +++ b/adw/include/adwaitamm/preferencesrow.hpp @@ -0,0 +1,123 @@ +#ifndef LIBADWAITAMM_PREFERENCES_ROW_HPP +#define LIBADWAITAMM_PREFERENCES_ROW_HPP + +#include "helpers/gobj_mixin.hpp" +#include "adwaitamm/helpers/properties.hpp" + +#include +#include +#include +#include +#include + +#include + +#include + +using AdwPreferencesRow = struct _AdwPreferencesRow; +using AdwPreferencesRowClass = struct _AdwPreferencesRowClass; + +namespace turns::adw +{ + struct PreferencesRow : Gtk::ListBoxRow, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = GtkListBoxRowClass; + using BaseClassType = 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) -> turns::adw::PreferencesRow *; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/switchrow.hpp b/adw/include/adwaitamm/switchrow.hpp new file mode 100644 index 0000000..c13d534 --- /dev/null +++ b/adw/include/adwaitamm/switchrow.hpp @@ -0,0 +1,88 @@ +#ifndef LIBADWAITAMM_SWITCH_ROW_HPP +#define LIBADWAITAMM_SWITCH_ROW_HPP + +#include "helpers/gobj_mixin.hpp" +#include "adwaitamm/actionrow.hpp" +#include "adwaitamm/helpers/properties.hpp" + +#include +#include +#include +#include +#include + +#include + +#include + +#define _ADWAITA_INSIDE +#include +#undef _ADWAITA_INSIDE + +using AdwSwitchRow = struct _AdwSwitchRow; + +namespace turns::adw +{ + struct SwitchRow final : adw::ActionRow, + helpers::gobj_mixin + { + struct Class : Glib::Class + { + using BaseClassParent = AdwActionRowClass; + using BaseClassType = AdwSwitchRowClass; + using BaseObjectType = AdwSwitchRow; + using CppClassParent = adw::ActionRow::Class; + using CppObjectType = SwitchRow; + + 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 SwitchRow(); + SwitchRow(SwitchRow const & other) = delete; + SwitchRow(SwitchRow && other) noexcept = default; + + auto operator=(SwitchRow const & other) noexcept -> SwitchRow & = delete; + auto operator=(SwitchRow && other) noexcept -> SwitchRow & = default; + + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + auto get_active(this auto && self) noexcept; + + auto get_active(Gtk::Widget & widget) noexcept -> CppObjectType &; + + auto property_active(this auto && self); + + protected: + explicit SwitchRow(Glib::ConstructParams const & params); + explicit SwitchRow(BaseObjectType * gobj); + }; + + auto SwitchRow::get_active(this auto && self) noexcept + { + return self.property_active().value(); + } + + auto SwitchRow::property_active(this auto && self) + { + return helpers::make_property_proxy(self, "active"); + } + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwSwitchRow * object, bool copy = false) -> turns::adw::SwitchRow *; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/toast.hpp b/adw/include/adwaitamm/toast.hpp new file mode 100644 index 0000000..88460f9 --- /dev/null +++ b/adw/include/adwaitamm/toast.hpp @@ -0,0 +1,111 @@ +#ifndef LIBADWAITAMM_TOAST_HPP +#define LIBADWAITAMM_TOAST_HPP + +#include "adwaitamm/helpers/gobj_mixin.hpp" +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#define _ADWAITA_INSIDE +#include +#undef _ADWAITA_INSIDE + +using AdwToast = struct _AdwToast; + +namespace turns::adw +{ + 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; + + Toast(Toast const & other) = delete; + Toast(Toast && other) noexcept = default; + + auto operator=(Toast const & other) noexcept -> Toast & = delete; + auto operator=(Toast && other) noexcept -> Toast & = default; + + auto static create(Glib::ustring const & title) -> Glib::RefPtr; + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + auto dismiss() -> void; + auto get_action_name() const -> Glib::ustring; + auto get_action_target_value() const -> Glib::VariantBase; + auto get_button_label() const -> Glib::ustring; + auto get_custom_title() const -> Gtk::Widget *; + auto get_priority() const -> Priority; + auto get_timeout() const -> unsigned; + auto get_title() const -> Glib::ustring; + auto get_use_markup() const -> bool; + auto set_action_name(Glib::ustring value) -> void; + auto set_action_target_value(Glib::VariantBase const & value) -> void; + auto set_button_label(Glib::ustring value) -> void; + auto set_custom_title(Gtk::Widget * value) -> void; + auto set_detailed_action_name(Glib::ustring value) -> void; + auto set_priority(Priority value) -> void; + auto set_timeout(unsigned value) -> void; + auto set_title(Glib::ustring value) -> void; + auto set_use_markup(bool value) -> void; + + auto property_action_name() -> Glib::PropertyProxy; + auto property_action_target() -> Glib::PropertyProxy; + auto property_button_label() -> Glib::PropertyProxy; + auto property_custom_title() -> Glib::PropertyProxy; + auto property_priority() -> Glib::PropertyProxy; + auto property_timeout() -> Glib::PropertyProxy; + auto property_title() -> Glib::PropertyProxy; + auto property_use_markup() -> Glib::PropertyProxy; + + auto signal_button_clicked() -> Glib::SignalProxy; + auto signal_dismissed() -> Glib::SignalProxy; + + protected: + explicit Toast(Glib::ustring const & title); + explicit Toast(Glib::ConstructParams const & params); + explicit Toast(BaseObjectType * gobj); + }; + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwToast * object, bool copy = false) -> Glib::RefPtr; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/toastoverlay.hpp b/adw/include/adwaitamm/toastoverlay.hpp new file mode 100644 index 0000000..0ae8bcb --- /dev/null +++ b/adw/include/adwaitamm/toastoverlay.hpp @@ -0,0 +1,77 @@ +#ifndef LIBADWAITAMM_TOASTOVERLAY_HPP +#define LIBADWAITAMM_TOASTOVERLAY_HPP + +#include "adwaitamm/helpers/gobj_mixin.hpp" +#include "adwaitamm/helpers/properties.hpp" + +#include +#include +#include +#include + +#include + +#include + +#define _ADWAITA_INSIDE +#include +#undef _ADWAITA_INSIDE + +namespace turns::adw +{ + struct ToastOverlay final : Gtk::Widget, + helpers::gobj_mixin + { + 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 const & other) noexcept -> ToastOverlay & = delete; + auto operator=(ToastOverlay && other) noexcept -> ToastOverlay & = default; + + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + auto add(Glib::RefPtr const & toast) -> void; + + auto property_child(this auto && self); + + protected: + explicit ToastOverlay(Glib::ConstructParams const & params); + explicit ToastOverlay(BaseObjectType * gobj); + }; + + auto ToastOverlay::property_child(this auto && self) + { + return helpers::make_property_proxy(self, "child"); + } + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwToastOverlay * object, bool copy = false) -> turns::adw::ToastOverlay *; +} // namespace Glib + +#endif \ No newline at end of file diff --git a/adw/include/adwaitamm/wrap_init.hpp b/adw/include/adwaitamm/wrap_init.hpp new file mode 100644 index 0000000..0e22a9b --- /dev/null +++ b/adw/include/adwaitamm/wrap_init.hpp @@ -0,0 +1,9 @@ +#ifndef LIBADWAITAMM_WRAP_INIT_HPP +#define LIBADWAITAMM_WRAP_INIT_HPP + +namespace turns::adw +{ + auto wrap_init() -> void; +} // namespace turns::adw + +#endif \ No newline at end of file -- cgit v1.2.3