diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-04-03 18:41:43 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-04-03 18:41:43 +0200 |
| commit | ee599d7d62c16bb59603bedb62f03c01504a1893 (patch) | |
| tree | 8e371a4d211d56ea42b648c7cd1758568b27858b /adw/include/adwaitamm | |
| parent | 6ff0bb23a71f334fe0ca86581cc86aaab2882003 (diff) | |
| download | turns-ee599d7d62c16bb59603bedb62f03c01504a1893.tar.xz turns-ee599d7d62c16bb59603bedb62f03c01504a1893.zip | |
adw: prepare files for extraction
Diffstat (limited to 'adw/include/adwaitamm')
| -rw-r--r-- | adw/include/adwaitamm/actionrow.hpp | 95 | ||||
| -rw-r--r-- | adw/include/adwaitamm/application.hpp | 67 | ||||
| -rw-r--r-- | adw/include/adwaitamm/applicationwindow.hpp | 64 | ||||
| -rw-r--r-- | adw/include/adwaitamm/breakpoint.hpp | 113 | ||||
| -rw-r--r-- | adw/include/adwaitamm/dialog.hpp | 82 | ||||
| -rw-r--r-- | adw/include/adwaitamm/helpers/gobj_mixin.hpp | 37 | ||||
| -rw-r--r-- | adw/include/adwaitamm/helpers/properties.hpp | 35 | ||||
| -rw-r--r-- | adw/include/adwaitamm/preferencesdialog.hpp | 72 | ||||
| -rw-r--r-- | adw/include/adwaitamm/preferencespage.hpp | 66 | ||||
| -rw-r--r-- | adw/include/adwaitamm/preferencesrow.hpp | 123 | ||||
| -rw-r--r-- | adw/include/adwaitamm/switchrow.hpp | 88 | ||||
| -rw-r--r-- | adw/include/adwaitamm/toast.hpp | 111 | ||||
| -rw-r--r-- | adw/include/adwaitamm/toastoverlay.hpp | 77 | ||||
| -rw-r--r-- | adw/include/adwaitamm/wrap_init.hpp | 9 |
14 files changed, 1039 insertions, 0 deletions
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 <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/propertyproxy.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <gtkmm/widget.h> + +#include <glib-object.h> +#include <glib.h> + +using AdwActionRow = struct _AdwActionRow; +using AdwActionRowClass = struct _AdwActionRowClass; + +namespace turns::adw +{ + struct ActionRow : adw::PreferencesRow, + helpers::gobj_mixin<ActionRow, AdwActionRow> + { + 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<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::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<Gtk::Widget>; + [[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<Gtk::Widget *>; + [[deprecated("replaced by add_prefix")]] auto property_icon_name() noexcept -> Glib::PropertyProxy<Glib::ustring>; + auto property_subtitle() noexcept -> Glib::PropertyProxy<Glib::ustring>; + auto property_subtitle_lines() noexcept -> Glib::PropertyProxy<int>; + auto property_subtitle_selectable() noexcept -> Glib::PropertyProxy<bool>; + auto property_title_lines() noexcept -> Glib::PropertyProxy<int>; + + 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 <glibmm/class.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <giomm/application.h> + +#include <gtkmm/application.h> + +using AdwApplication = struct _AdwApplication; +using AdwApplicationClass = struct _AdwApplicationClass; + +namespace turns::adw +{ + struct Application : Gtk::Application, + helpers::gobj_mixin<Application, AdwApplication> + { + 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<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::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<Application>; + + 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<turns::adw::Application>; +} // 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 <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <gtkmm/application.h> +#include <gtkmm/applicationwindow.h> + +using AdwApplicationWindow = struct _AdwApplicationWindow; +using AdwApplicationWindowClass = struct _AdwApplicationWindowClass; + +namespace turns::adw +{ + struct ApplicationWindow : Gtk::ApplicationWindow, + helpers::gobj_mixin<ApplicationWindow, AdwApplicationWindow> + { + 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<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::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 <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/propertyproxy.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <gtkmm/buildable.h> + +#include <glib-object.h> + +#include <optional> + +#define _ADWAITA_INSIDE +#include <adw-breakpoint.h> +#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<BreakpointCondition>; + + private: + friend struct Breakpoint; + + explicit BreakpointCondition(AdwBreakpointCondition * object); + + AdwBreakpointCondition * m_object{nullptr}; + }; + + struct Breakpoint final : Glib::Object, + Gtk::Buildable, + helpers::gobj_mixin<Breakpoint, AdwBreakpoint> + { + 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<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::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<Breakpoint>; + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + auto property_condition() -> Glib::PropertyProxy<BreakpointCondition *>; + + 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<turns::adw::Breakpoint>; +} // 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 <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <gtkmm/widget.h> + +#include <glib-object.h> + +using AdwDialog = struct _AdwDialog; +using AdwDialogClass = struct _AdwDialogClass; + +namespace turns::adw +{ + struct Dialog_Class; + + struct Dialog : Gtk::Widget, + helpers::gobj_mixin<Dialog, AdwDialog> + { + 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<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::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<Breakpoint> 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<Breakpoint>; + 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 <glibmm/object.h> + +#include <type_traits> + +namespace turns::adw::helpers +{ + + template<typename Type, typename AdwType> + struct gobj_mixin + { + template<typename Self> + auto gobj(this Self && self) noexcept + { + using clean_type = std::remove_reference_t<Self>; + using gobj_type = std::conditional_t<std::is_const_v<clean_type>, std::add_const_t<Glib::Object>, Glib::Object>; + using cast_type = std::conditional_t<std::is_const_v<clean_type>, std::add_const_t<AdwType>, AdwType>; + + return reinterpret_cast<cast_type *>(static_cast<gobj_type &&>(self).gobj()); + } + + template<typename Self> + auto gobj_copy(this Self && self) noexcept -> AdwType * + { + using clean_type = std::remove_reference_t<Self>; + using gobj_type = std::conditional_t<std::is_const_v<clean_type>, std::add_const_t<Glib::Object>, Glib::Object>; + + static_cast<gobj_type &&>(self).reference(); + return const_cast<AdwType *>(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 <glibmm/propertyproxy.h> +#include <glibmm/ustring.h> + +#include <type_traits> + +namespace turns::adw::helpers +{ + + template<typename ProxiedType, typename ObjectType> + struct deduced_property_proxy + { + using type = Glib::PropertyProxy<ProxiedType>; + }; + + template<typename ProxiedType, typename ObjectType> + struct deduced_property_proxy<ProxiedType, ObjectType const> + { + using type = Glib::PropertyProxy_ReadOnly<ProxiedType>; + }; + + template<typename ProxiedType, typename ObjectType> + using deduced_property_proxy_t = typename deduced_property_proxy<ProxiedType, ObjectType>::type; + + template<typename ProxiedType, typename ObjectType> + auto make_property_proxy(ObjectType && object, char const * property) + { + return deduced_property_proxy_t<ProxiedType, std::remove_reference_t<ObjectType>>{&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 <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <gtkmm/widget.h> + +#include <glib-object.h> + +using AdwPreferencesDialog = struct _AdwPreferencesDialog; +using AdwPreferencesDialogClass = struct _AdwPreferencesDialogClass; + +namespace turns::adw +{ + struct PreferencesDialog_Class; + + struct PreferencesDialog : adw::Dialog, + helpers::gobj_mixin<PreferencesDialog, AdwPreferencesDialog> + { + 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<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::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 <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <gtkmm/widget.h> + +#include <glib-object.h> + +using AdwPreferencesPage = struct _AdwPreferencesPage; +using AdwPreferencesPageClass = struct _AdwPreferencesPageClass; + +namespace turns::adw +{ + struct PreferencesPage : Gtk::Widget, + helpers::gobj_mixin<PreferencesPage, AdwPreferencesPage> + { + 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<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::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 <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <gtkmm/listboxrow.h> + +#include <glib-object.h> + +using AdwPreferencesRow = struct _AdwPreferencesRow; +using AdwPreferencesRowClass = struct _AdwPreferencesRowClass; + +namespace turns::adw +{ + struct PreferencesRow : Gtk::ListBoxRow, + helpers::gobj_mixin<PreferencesRow, AdwPreferencesRow> + { + 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<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::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<Glib::ustring>(self, "title"); + } + + auto PreferencesRow::property_title_selectable(this auto && self) + { + return helpers::make_property_proxy<bool>(self, "title-selectable"); + } + + auto PreferencesRow::property_use_markup(this auto && self) + { + return helpers::make_property_proxy<bool>(self, "use-markup"); + } + + auto PreferencesRow::property_use_underline(this auto && self) + { + return helpers::make_property_proxy<bool>(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 <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> + +#include <gtkmm/widget.h> + +#include <glib-object.h> + +#define _ADWAITA_INSIDE +#include <adw-switch-row.h> +#undef _ADWAITA_INSIDE + +using AdwSwitchRow = struct _AdwSwitchRow; + +namespace turns::adw +{ + struct SwitchRow final : adw::ActionRow, + helpers::gobj_mixin<SwitchRow, AdwSwitchRow> + { + 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<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::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_act |
