aboutsummaryrefslogtreecommitdiff
path: root/include/turns/adw/breakpoint.hpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2025-03-27 12:05:53 +0100
committerFelix Morgner <felix.morgner@gmail.com>2025-03-27 12:05:53 +0100
commiteabdf3c6c4f10ee8232a75fff6f1cefa0734cebf (patch)
tree526e2cee0d5a7b9c7ea2441e147732a0613ee47c /include/turns/adw/breakpoint.hpp
parent5d7c8646d5ed2a57bc322b62de192fbdf70429de (diff)
downloadlibadwaitamm-eabdf3c6c4f10ee8232a75fff6f1cefa0734cebf.tar.xz
libadwaitamm-eabdf3c6c4f10ee8232a75fff6f1cefa0734cebf.zip
adw: extend dialog
Diffstat (limited to 'include/turns/adw/breakpoint.hpp')
-rw-r--r--include/turns/adw/breakpoint.hpp112
1 files changed, 112 insertions, 0 deletions
diff --git a/include/turns/adw/breakpoint.hpp b/include/turns/adw/breakpoint.hpp
new file mode 100644
index 0000000..b274bbb
--- /dev/null
+++ b/include/turns/adw/breakpoint.hpp
@@ -0,0 +1,112 @@
+#ifndef TURNS_ADW_BREAKPOINT_HPP
+#define TURNS_ADW_BREAKPOINT_HPP
+
+#include "turns/adw/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;
+
+ explicit Breakpoint(BreakpointCondition & condition);
+ 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 get_type() -> GType;
+ auto static get_base_type() -> GType;
+
+ auto property_condition() -> Glib::PropertyProxy<BreakpointCondition *>;
+
+ protected:
+ 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