7 template<
class T,
class =
void>
13 template<
class VarName,
class CL,
class MT, MT CL::* ptr>
14 std::vector<RemoteGui::WidgetPtr>
16 const boost::hana::pair<VarName, boost::hana::struct_detail::member_ptr<MT CL::*, ptr>>&,
17 const std::string& prefix,
22 const auto varname = hana::to<char const*>(VarName{});
23 const auto& var = val.*ptr;
28 return {def_create::create(var, prefix, varname)};
32 return elem_create::create(var, prefix, varname);
36 static_assert(!std::is_same_v<MT, MT>,
"this member type is not handeled!");
47 std::enable_if_t<meta::cfg::gui_definition_enabled_v<T>>
50 template<
class Overr
ideLayoutT = undefined_t>
51 static auto create(
const T& val,
const std::string& prefix,
const std::string& name)
60 namespace hana = boost::hana;
61 static constexpr
auto accessors = hana::accessors<T>();
63 auto [widget, addChildren] = [&]
65 static constexpr
bool grpbox = std::is_same_v<layout_t, RemoteGui::GroupBox>;
66 static constexpr
bool sgrid = std::is_same_v<layout_t, RemoteGui::SimpleGridLayout>;
67 static constexpr
bool vbox = std::is_same_v<layout_t, RemoteGui::VBoxLayout>;
68 static constexpr
bool hbox = std::is_same_v<layout_t, RemoteGui::HBoxLayout>;
70 if constexpr(grpbox || sgrid)
72 RemoteGui::SimpleGridLayoutPtr l =
new RemoteGui::SimpleGridLayout;
74 auto add = [l](
const auto & cs)
78 l->children.emplace_back(
new RemoteGui::Widget);
79 l->children.emplace_back(cs.front());
83 l->children.insert(l->children.end(), cs.begin(), cs.end());
92 return std::make_pair(l, add);
95 else if constexpr(vbox || hbox)
98 auto add = [l](
const auto & cs)
100 l->children.insert(l->children.end(), cs.begin(), cs.end());
102 return std::make_pair(l, add);
106 static_assert(!std::is_same_v<T, T>,
"the given type for config_layout can't be used");
110 hana::for_each(accessors, [&, addChildren=std::ref(addChildren)](
auto & e)
114 if constexpr(!elem_det::no_remote_gui)
126 static auto create(
const T& val,
const std::string& prefix,
const std::string& name)
128 return create<>(val, prefix, name);