summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--adw/include/adwaitamm/breakpoint.hpp17
-rw-r--r--adw/include/adwaitamm/enums.hpp19
-rw-r--r--adw/src/breakpoint.cpp10
-rw-r--r--adw/src/enums.cpp10
4 files changed, 33 insertions, 23 deletions
diff --git a/adw/include/adwaitamm/breakpoint.hpp b/adw/include/adwaitamm/breakpoint.hpp
index db17d27..529344d 100644
--- a/adw/include/adwaitamm/breakpoint.hpp
+++ b/adw/include/adwaitamm/breakpoint.hpp
@@ -21,22 +21,11 @@
namespace Adwaita
{
+ enum struct LengthType;
+ enum struct RatioType;
+
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.
diff --git a/adw/include/adwaitamm/enums.hpp b/adw/include/adwaitamm/enums.hpp
index 9bc9f0e..2fca425 100644
--- a/adw/include/adwaitamm/enums.hpp
+++ b/adw/include/adwaitamm/enums.hpp
@@ -29,12 +29,27 @@ namespace Adwaita
ForceDark,
};
+ enum struct LengthType
+ {
+ MinWidth,
+ MaxWidth,
+ MinHeight,
+ MaxHeight,
+ };
+
+ enum struct RatioType
+ {
+ MinAspectRatio,
+ MaxAspectRatio
+ };
+
enum struct ResponseAppearance
{
Default,
Suggested,
- Destructive,
+ Destructive,
};
+
} // namespace Adwaita
namespace Glib
@@ -50,6 +65,8 @@ namespace Glib
VALUE_SPECIALIZATION(AccentColor);
VALUE_SPECIALIZATION(ColorScheme);
+ VALUE_SPECIALIZATION(LengthType);
+ VALUE_SPECIALIZATION(RatioType);
VALUE_SPECIALIZATION(ResponseAppearance);
#undef VALUE_SPECIALIZATION
diff --git a/adw/src/breakpoint.cpp b/adw/src/breakpoint.cpp
index a34fcf7..3907a15 100644
--- a/adw/src/breakpoint.cpp
+++ b/adw/src/breakpoint.cpp
@@ -1,5 +1,6 @@
#include "adwaitamm/breakpoint.hpp"
+#include "adwaitamm/enums.hpp"
#include "adwaitamm/helpers/properties.hpp"
#include <glibmm/class.h>
@@ -10,6 +11,7 @@
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/wrap.h>
+
#include <gtkmm/buildable.h>
#include <glib-object.h>
@@ -20,14 +22,6 @@
namespace Adwaita
{
- static_assert(static_cast<int>(BreakpointCondition::LengthType::min_width) == ADW_BREAKPOINT_CONDITION_MIN_WIDTH);
- static_assert(static_cast<int>(BreakpointCondition::LengthType::max_width) == ADW_BREAKPOINT_CONDITION_MAX_WIDTH);
- static_assert(static_cast<int>(BreakpointCondition::LengthType::min_height) == ADW_BREAKPOINT_CONDITION_MIN_HEIGHT);
- static_assert(static_cast<int>(BreakpointCondition::LengthType::max_height) == ADW_BREAKPOINT_CONDITION_MAX_HEIGHT);
-
- static_assert(static_cast<int>(BreakpointCondition::RatioType::min_aspect_ratio) == ADW_BREAKPOINT_CONDITION_MIN_ASPECT_RATIO);
- static_assert(static_cast<int>(BreakpointCondition::RatioType::max_aspect_ratio) == ADW_BREAKPOINT_CONDITION_MAX_ASPECT_RATIO);
-
BreakpointCondition::BreakpointCondition(BreakpointCondition const & other)
: BreakpointCondition{adw_breakpoint_condition_copy(other.m_object)}
{
diff --git a/adw/src/enums.cpp b/adw/src/enums.cpp
index 9da6bc1..9891845 100644
--- a/adw/src/enums.cpp
+++ b/adw/src/enums.cpp
@@ -33,6 +33,14 @@ namespace Adwaita
static_assert(matches<ColorScheme::PreferDark, ADW_COLOR_SCHEME_PREFER_DARK>);
static_assert(matches<ColorScheme::ForceDark, ADW_COLOR_SCHEME_FORCE_DARK>);
+ static_assert(matches<LengthType::MinWidth, ADW_BREAKPOINT_CONDITION_MIN_WIDTH>);
+ static_assert(matches<LengthType::MaxWidth, ADW_BREAKPOINT_CONDITION_MAX_WIDTH>);
+ static_assert(matches<LengthType::MinHeight, ADW_BREAKPOINT_CONDITION_MIN_HEIGHT>);
+ static_assert(matches<LengthType::MaxHeight, ADW_BREAKPOINT_CONDITION_MAX_HEIGHT>);
+
+ static_assert(matches<RatioType::MinAspectRatio, ADW_BREAKPOINT_CONDITION_MIN_ASPECT_RATIO>);
+ static_assert(matches<RatioType::MaxAspectRatio, ADW_BREAKPOINT_CONDITION_MAX_ASPECT_RATIO>);
+
static_assert(matches<ResponseAppearance::Default, ADW_RESPONSE_DEFAULT>);
static_assert(matches<ResponseAppearance::Suggested, ADW_RESPONSE_SUGGESTED>);
static_assert(matches<ResponseAppearance::Destructive, ADW_RESPONSE_DESTRUCTIVE>);
@@ -49,6 +57,8 @@ namespace Glib
VALUE_SPECIALIZATION(AccentColor, accent_color)
VALUE_SPECIALIZATION(ColorScheme, color_scheme)
+ VALUE_SPECIALIZATION(LengthType, breakpoint_condition)
+ VALUE_SPECIALIZATION(RatioType, breakpoint_condition)
VALUE_SPECIALIZATION(ResponseAppearance, response_appearance)
#undef VALUE_SPECIALIZATION