Impl.h
Go to the documentation of this file.
1#pragma once
2
3/*
4 * Do not include this header file in your source file!
5 * Use the other headers. Otherwise, your compile times will suffer.
6 */
7
8// This is the convoluted header, we want to avoid
9#include <memory>
10#include <vector>
11
12#include <ArmarXGui/interface/RemoteGuiInterface.h>
14
16{
18 {
19 RemoteGui::WidgetPtr desc;
21 std::vector<std::shared_ptr<WidgetImpl>> children;
22
23 template <typename ValueT>
24 void
25 setValue(ValueT const& newValue)
26 {
27 desc->defaultValue = makeValue(newValue);
28
29 if (tab)
30 {
31 tab->getValue<ValueT>(desc->name).set(newValue);
32 }
33 }
34
35 template <typename ValueT>
36 auto
37 getValue() const
38 {
39 if (tab)
40 {
41 return tab->getValue<ValueT>(desc->name).get();
42 }
43 else
44 {
45 throw std::runtime_error(
46 "Tab is not initialized. Call Tab::create before getting stuff!");
47 }
48 }
49
50 bool
52 {
53 return tab->hasValueChanged(desc->name);
54 }
55
56 void
57 addChild(std::shared_ptr<WidgetImpl> const& child)
58 {
59 desc->children.push_back(child->desc);
60 children.push_back(child);
61 }
62 };
63
68
69} // namespace armarx::RemoteGui::Client
ValueVariant makeValue(bool value)
Definition Storage.cpp:144
RemoteGui::TabProxy proxy
Definition Impl.h:66
void setValue(ValueT const &newValue)
Definition Impl.h:25
RemoteGui::WidgetPtr desc
Definition Impl.h:19
std::vector< std::shared_ptr< WidgetImpl > > children
Definition Impl.h:21
RemoteGui::TabProxy * tab
Definition Impl.h:20
void addChild(std::shared_ptr< WidgetImpl > const &child)
Definition Impl.h:57