Widgets.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string>
5#include <vector>
6
8{
9
10 /*
11 * This is a RemoteGui client library which avoids including unnecessary headers.
12 * The RemoteGui Ice interface now includes a bunch of C++ header files which
13 * slow down compilation dramatically. To avoid this, this client library uses
14 * private implementation to prevent the inclusion of the header file.
15 * Please do not include any boost, Eigen, Simox or other headers in this file
16 * since this would destroy the whole purpose why this library exists.
17 */
18
19 struct WidgetImpl;
20
21 struct Widget
22 {
23 Widget(void* iceWidget);
24
25 void setName(std::string const& name);
26 std::string const& getName() const;
27
28 std::shared_ptr<WidgetImpl> impl;
29 };
30
31 struct Label : Widget
32 {
33 Label();
34
35 Label(std::string const& text);
36
37 void setText(std::string const& text);
38 };
39
41 {
42 LineEdit();
43
44 std::string getValue();
45 void setValue(std::string const& text);
46
47 bool hasValueChanged() const;
48 };
49
51 {
52 ComboBox();
53
54 void addOption(std::string const& option);
55
56 void addOptions(std::initializer_list<std::string> options);
57
58 void setOptions(std::vector<std::string> const& options);
59
60 void setValue(std::string const& newValue);
61 std::string getValue() const;
62
63 bool hasValueChanged() const;
64
65 void setIndex(int index);
66 int getIndex() const;
67 };
68
70 {
71 IntSpinBox();
72
73 void setRange(int min, int max);
74
75 int getValue() const;
76 void setValue(int newValue);
77
78 bool hasValueChanged() const;
79 };
80
82 {
83 IntSlider();
84
85 void setRange(int min, int max);
86
87 int getValue() const;
88 void setValue(int newValue);
89
90 bool hasValueChanged() const;
91 };
92
94 {
96
97 void setRange(float min, float max);
98 void setSteps(int steps);
99 void setDecimals(int decimals);
100
101 float getValue() const;
102 void setValue(float newValue);
103
104 bool hasValueChanged() const;
105 };
106
108 {
109 FloatSlider();
110
111 void setRange(float min, float max);
112 void setSteps(int steps);
113
114 float getValue() const;
115 void setValue(float newValue);
116
117 bool hasValueChanged() const;
118 };
119
120 struct Button : Widget
121 {
122 Button();
123
124 void setLabel(std::string const& label);
125
126 bool wasClicked() const;
127 };
128
130 {
131 CheckBox();
132
133 bool getValue() const;
134 void setValue(bool newValue);
135
136 bool hasValueChanged() const;
137 };
138
140 {
141 ToggleButton();
142
143 void setLabel(std::string const& label);
144
145 bool getValue() const;
146 void setValue(bool newValue);
147
148 bool hasValueChanged() const;
149 };
150
152 {
153 using Widget::Widget;
154
155 void addChild(Widget const& child);
156
157 void addChildren(std::initializer_list<Widget> children);
158 };
159
161 {
162 HBoxLayout();
163
164 HBoxLayout(std::initializer_list<Widget> children);
165 };
166
168 {
169 VBoxLayout();
170
171 VBoxLayout(std::initializer_list<Widget> children);
172 };
173
174 struct Pos
175 {
176 int row;
178 };
179
180 struct Span
181 {
182 int rows;
184 };
185
187 {
188 GridLayout();
189
190 GridLayout& add(Widget const& child, Pos pos, Span span = Span{1, 1});
191 };
192
194 {
195 GroupBox();
196
197 GroupBox(std::initializer_list<Widget> children);
198
199 void setLabel(std::string const& text);
200
201 void setCollapsed(bool collapsed);
202 };
203
205 {
206 VSpacer();
207 };
208
210 {
211 HSpacer();
212 };
213
214
215} // namespace armarx::RemoteGui::Client
uint8_t index
#define option(type, fn)
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
std::vector< T > min(const std::vector< T > &v1, const std::vector< T > &v2)
void setLabel(std::string const &label)
Definition Widgets.cpp:123
void addOption(std::string const &option)
Definition Widgets.cpp:164
void setValue(std::string const &newValue)
Definition Widgets.cpp:197
void setOptions(std::vector< std::string > const &options)
Definition Widgets.cpp:186
void addOptions(std::initializer_list< std::string > options)
Definition Widgets.cpp:177
void addChild(Widget const &child)
Definition Widgets.cpp:95
void addChildren(std::initializer_list< Widget > children)
Definition Widgets.cpp:101
void setRange(float min, float max)
Definition Widgets.cpp:375
void setRange(float min, float max)
Definition Widgets.cpp:330
GridLayout & add(Widget const &child, Pos pos, Span span=Span{1, 1})
Definition Widgets.cpp:438
void setLabel(std::string const &text)
Definition Widgets.cpp:420
void setCollapsed(bool collapsed)
Definition Widgets.cpp:427
void setRange(int min, int max)
Definition Widgets.cpp:299
void setRange(int min, int max)
Definition Widgets.cpp:51
void setText(std::string const &text)
Definition Widgets.cpp:40
void setValue(std::string const &text)
Definition Widgets.cpp:147
void setLabel(std::string const &label)
Definition Widgets.cpp:269
std::string const & getName() const
Definition Widgets.cpp:25
void setName(std::string const &name)
Definition Widgets.cpp:19
std::shared_ptr< WidgetImpl > impl
Definition Widgets.h:28