summaryrefslogtreecommitdiffhomepage
path: root/editor/inspect.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-02-24 07:17:20 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-02-24 07:17:20 +0100
commit87c89034894eae06c68e261f5a48c36b8f676b0d (patch)
tree4af67599ac9bac4faccb7ecdeb5debe0622a6dbe /editor/inspect.hpp
parentbad2f1a530b82879dab4c4cff065aab6b1f711c8 (diff)
wip
Diffstat (limited to 'editor/inspect.hpp')
-rw-r--r--editor/inspect.hpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/editor/inspect.hpp b/editor/inspect.hpp
index 5cb71303..7edfd6d1 100644
--- a/editor/inspect.hpp
+++ b/editor/inspect.hpp
@@ -1,4 +1,6 @@
#pragma once
+#include <cstddef>
+#include <utility>
namespace floormat::entities {
struct erased_accessor;
@@ -18,13 +20,21 @@ private:
T value;
};
-enum class field_repr : unsigned char { input, slider, drag, };
+enum class field_repr : unsigned char { input, slider, drag, cbx, };
template<typename T> using field_repr_input = field_repr_<T, field_repr, field_repr::input>;
template<typename T> using field_repr_slider = field_repr_<T, field_repr, field_repr::slider>;
template<typename T> using field_repr_drag = field_repr_<T, field_repr, field_repr::drag>;
+template<typename T> using field_repr_cbx = field_repr_<T, field_repr, field_repr::cbx>;
-template<typename T> void inspect_field(void* datum, const entities::erased_accessor& accessor);
+template<typename T> void inspect_field(void* datum, const entities::erased_accessor& accessor,
+ const ArrayView<const std::pair<StringView, std::size_t>>& list);
template<typename T> void inspect_type(T& x);
+template<typename T> requires std::is_enum_v<T> void inspect_field(void* datum, const entities::erased_accessor& accessor,
+ const ArrayView<const std::pair<StringView, std::size_t>>& list)
+{
+ inspect_field<field_repr_cbx<std::underlying_type_t<T>>>(datum, accessor, list);
+}
+
} // namespace floormat::entities