5 #include <ArmarXGui/interface/RemoteGuiInterface.h>
21 TabProxy(RemoteGuiInterfacePrx
const& remoteGui, std::string
const& tabId);
29 remoteGui->removeTab(tabId);
35 void getValue(
T& val, std::string
const& name);
37 void getValue(std::atomic<T>& val, std::string
const& name);
40 void setValue(
const T& val, std::string
const& name);
42 void setValue(
const std::atomic<T>& val, std::string
const& name);
60 RemoteGuiInterfacePrx remoteGui;
67 RemoteGui::WidgetStateMap currentWidgetStates;
68 RemoteGui::WidgetStateMap oldWidgetStates;
69 RemoteGui::WidgetStateMap newWidgetStates;
70 RemoteGui::WidgetState& getNewWidgetState(std::string
const& name);
72 bool valuesChanged =
false;
73 bool widgetChanged =
false;
105 template <
typename T1 = T, std::enable_if_t<std::is_trivially_copyable_v<T1>,
int> = 0>
106 void set(std::atomic<T1>
const&
value);
114 using ValueProxy::ValueProxy;
123 remoteGui(remoteGui), tabId(tabId)
125 currentValues = remoteGui->getValues(tabId);
126 oldValues = currentValues;
127 newValues = currentValues;
129 currentWidgetStates = remoteGui->getWidgetStates(tabId);
130 oldWidgetStates = currentWidgetStates;
131 newWidgetStates = currentWidgetStates;
138 oldValues = currentValues;
139 currentValues = remoteGui->getValues(tabId);
140 newValues = currentValues;
141 valuesChanged =
false;
144 currentWidgetStates = remoteGui->getWidgetStates(tabId);
145 oldWidgetStates = currentWidgetStates;
146 newWidgetStates = currentWidgetStates;
147 widgetChanged =
false;
156 remoteGui->setValues(tabId, dirtyValues);
161 remoteGui->setWidgetStates(tabId, newWidgetStates);
165 template <
typename T>
173 template <
typename T>
181 template <
typename T>
186 val.store(getValue<T>(name).get());
189 template <
typename T>
193 getValue<T>(name).set(val);
196 template <
typename T>
203 template <
typename T>
208 return RemoteGui::getAndReturnValue<T>(currentValues, name);
211 template <
typename T>
216 T currentValue = internalGetValue<T>(name);
217 if (currentValue !=
value)
219 valuesChanged =
true;
234 RemoteGui::WidgetState& state = getNewWidgetState(name);
235 if (state.hidden != hidden)
237 widgetChanged =
true;
239 state.hidden = hidden;
245 RemoteGui::WidgetState& state = getNewWidgetState(name);
246 if (state.disabled != disabled)
248 widgetChanged =
true;
250 state.disabled = disabled;
253 inline RemoteGui::WidgetState&
256 auto iter = currentWidgetStates.find(name);
257 if (iter == currentWidgetStates.end())
259 throw LocalException(
"No widget with name '") << name <<
"' found";
264 inline RemoteGui::WidgetState&
265 TabProxy::getNewWidgetState(std::string
const& name)
267 auto iter = newWidgetStates.find(name);
268 if (iter == newWidgetStates.end())
270 throw LocalException(
"No widget with name '") << name <<
"' in NewWidgetStates found";
284 WidgetProxy::setHidden(
bool hidden)
290 WidgetProxy::setDisabled(
bool disabled)
292 tab->internalSetDisabled(name, disabled);
296 WidgetProxy::isHidden()
const
298 return tab->getWidgetState(name).hidden;
302 WidgetProxy::isDisabled()
const
304 return tab->getWidgetState(name).disabled;
311 template <
typename T>
316 return tab->internalGetValue<
T>(name);
319 template <
typename T>
325 return static_cast<T2
>(get());
328 template <
typename T>
341 template <
typename T>
346 tab->internalSetValue<
T>(name,
value);
349 template <
typename T>
350 template <
typename T1,
typename std::enable_if_t<std::is_trivially_copyable_v<T1>,
int>>
365 return tab->internalButtonClicked(name);