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/breakpoint.hpp | 113 +++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 adw/include/adwaitamm/breakpoint.hpp (limited to 'adw/include/adwaitamm/breakpoint.hpp') 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 -- cgit v1.2.3