3 #include <ArmarXGui/interface/RemoteGuiInterface.h>
21 TabProxy(RemoteGuiInterfacePrx
const& remoteGui, std::string
const& tabId);
27 remoteGui->removeTab(tabId);
33 void getValue(
T& val, std::string
const& name);
35 void getValue(std::atomic<T>& val, std::string
const& name);
38 void setValue(
const T& val, std::string
const& name);
40 void setValue(
const std::atomic<T>& val, std::string
const& name);
57 RemoteGuiInterfacePrx remoteGui;
64 RemoteGui::WidgetStateMap currentWidgetStates;
65 RemoteGui::WidgetStateMap oldWidgetStates;
66 RemoteGui::WidgetStateMap newWidgetStates;
67 RemoteGui::WidgetState& getNewWidgetState(std::string
const& name);
69 bool valuesChanged =
false;
70 bool widgetChanged =
false;
101 template <
typename T1 = T, std::enable_if_t<std::is_trivially_copyable_v<T1>,
int> = 0>
102 void set(std::atomic<T1>
const&
value);
111 using ValueProxy::ValueProxy;
119 : remoteGui(remoteGui)
122 currentValues = remoteGui->getValues(tabId);
123 oldValues = currentValues;
124 newValues = currentValues;
126 currentWidgetStates = remoteGui->getWidgetStates(tabId);
127 oldWidgetStates = currentWidgetStates;
128 newWidgetStates = currentWidgetStates;
134 oldValues = currentValues;
135 currentValues = remoteGui->getValues(tabId);
136 newValues = currentValues;
137 valuesChanged =
false;
140 currentWidgetStates = remoteGui->getWidgetStates(tabId);
141 oldWidgetStates = currentWidgetStates;
142 newWidgetStates = currentWidgetStates;
143 widgetChanged =
false;
151 remoteGui->setValues(tabId, dirtyValues);
156 remoteGui->setWidgetStates(tabId, newWidgetStates);
160 template <
typename T>
166 template <
typename T>
172 template <
typename T>
176 val.store(getValue<T>(name).get());
179 template <
typename T>
182 getValue<T>(name).set(val);
184 template <
typename T>
190 template <
typename T>
194 return RemoteGui::getAndReturnValue<T>(currentValues, name);
197 template <
typename T>
201 T currentValue = internalGetValue<T>(name);
202 if (currentValue !=
value)
204 valuesChanged =
true;
217 RemoteGui::WidgetState& state = getNewWidgetState(name);
218 if (state.hidden != hidden)
220 widgetChanged =
true;
222 state.hidden = hidden;
227 RemoteGui::WidgetState& state = getNewWidgetState(name);
228 if (state.disabled != disabled)
230 widgetChanged =
true;
232 state.disabled = disabled;
237 auto iter = currentWidgetStates.find(name);
238 if (iter == currentWidgetStates.end())
240 throw LocalException(
"No widget with name '") << name <<
"' found";
245 inline RemoteGui::WidgetState& TabProxy::getNewWidgetState(std::string
const& name)
247 auto iter = newWidgetStates.find(name);
248 if (iter == newWidgetStates.end())
250 throw LocalException(
"No widget with name '") << name <<
"' in NewWidgetStates found";
264 inline void WidgetProxy::setHidden(
bool hidden)
269 inline void WidgetProxy::setDisabled(
bool disabled)
271 tab->internalSetDisabled(name, disabled);
274 inline bool WidgetProxy::isHidden()
const
276 return tab->getWidgetState(name).hidden;
279 inline bool WidgetProxy::isDisabled()
const
281 return tab->getWidgetState(name).disabled;
287 template <
typename T>
291 return tab->internalGetValue<
T>(name);
294 template <
typename T>
299 return static_cast<T2
>(get());
302 template <
typename T>
314 template <
typename T>
318 tab->internalSetValue<
T>(name,
value);
322 template<
typename T1,
typename std::enable_if_t<std::is_trivially_copyable_v<T1>,
int>>
334 return tab->internalButtonClicked(name);