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>
189 template <
typename T>
196 template <
typename T>
203 template <
typename T>
211 template <
typename T>
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";
277namespace armarx::RemoteGui
286 tab->internalSetHidden(
name, hidden);
292 tab->internalSetDisabled(
name, disabled);
298 return tab->getWidgetState(
name).hidden;
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);
void setValue(const T &val, std::string const &name)
T internalGetValue(std::string const &name) const
void internalSetDisabled(std::string const &name, bool disabled)
bool hasValueChanged(std::string const &name)
RemoteGui::WidgetState & getWidgetState(std::string const &name)
bool getButtonClicked(std::string const &name)
void internalSetHidden(std::string const &name, bool hidden)
ValueProxy< T > getValue(std::string const &name)
void internalSetValue(std::string const &name, T const &value)
ButtonProxy getButton(std::string const &name)
bool internalButtonClicked(std::string const &name) const
WidgetProxy(TabProxy *tab, std::string const &name)
void set(std::atomic< T1 > const &value)
T getAndReturnValue(ValueMap const &values, std::string const &name)
ValueVariant makeValue(bool value)
std::map< std::string, ValueVariant > ValueMap
std::enable_if_t< meta::cfg::gui_definition_enabled_v< T >, void > getValueFromMap(T &cfg, RemoteGui::ValueMap const &values, std::string const &name)
bool buttonClicked(RemoteGui::ValueMap const &newValues, RemoteGui::ValueMap const &oldValues, std::string const &name)