DefaultWidgetDescriptions.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarXGui::ArmarXObjects::DefaultWidgetDescriptions
17 * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18 * @date 2017
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25#include <cmath>
26
27#include <ArmarXGui/interface/WidgetDescription.h>
28
30{
31 //base widgets
32 HBoxLayoutPtr makeHBoxLayout(std::vector<WidgetPtr> elements);
33 VBoxLayoutPtr makeVBoxLayout(std::vector<WidgetPtr> elements);
34
35 FormLayoutElementPtr makeFormLayoutElement(WidgetPtr child, bool spanning = false);
36 FormLayoutElementPtr makeSpanningFormLayoutElement(WidgetPtr child);
37 FormLayoutElementPtr
38 makeFormLayoutElement(std::string name, WidgetPtr child, bool spanning = false);
39 FormLayoutElementPtr makeFormLayoutElement(WidgetPtr labelWidget, WidgetPtr child);
40
41 FormLayoutPtr makeFormLayout(std::vector<std::pair<std::string, WidgetPtr>> elements);
42 FormLayoutPtr makeFormLayout(std::vector<WidgetPtr> elements);
43
44 GroupBoxPtr makeGroupBox(std::string label, WidgetPtr child, bool framed = false);
45
47
48 HSpacerPtr makeHSpacer();
49 VSpacerPtr makeVSpacer();
50 HLinePtr makeHLine();
51 VLinePtr makeVLine();
52 LabelPtr makeLabel(std::string text);
53
54 CheckBoxPtr makeCheckBox(std::string name, bool defaultValue, std::string label);
55 CheckBoxPtr makeCheckBox(std::string name, bool defaultValue = false);
56
57 IntSpinBoxPtr
58 makeIntSpinBox(std::string name, int min = 0, int max = 100, int defaultValue = 0);
59 FloatSpinBoxPtr makeFloatSpinBox(std::string name,
60 float min = 0,
61 float max = 100,
62 float defaultValue = 0,
63 int steps = 100,
64 int decimals = 3);
65 DoubleSpinBoxPtr makeDoubleSpinBox(std::string name,
66 double min = 0,
67 double max = 100,
68 double defaultValue = 0,
69 int steps = 100,
70 int decimals = 3);
71
72 IntSliderPtr makeIntSlider(std::string name, int min = 0, int max = 100, int defaultValue = 0);
73 FloatSliderPtr
74 makeFloatSlider(std::string name, float min = 0, float max = 100, float defaultValue = 0);
75 DoubleSliderPtr
76 makeDoubleSlider(std::string name, double min = 0, double max = 100, double defaultValue = 0);
77
78 StringComboBoxPtr
79 makeStringComboBox(std::string name, std::vector<std::string> options, long defaultIndex = 0);
80
81 LineEditPtr makeLineEdit(std::string name, std::string defaultValue = "");
82 FloatLineEditPtr makeFloatLineEdit(std::string name, float defaultValue = 0);
83 DoubleLineEditPtr makeDoubleLineEdit(std::string name, double defaultValue = 0);
84
85 //more complex widgets
86 /**
87 * @brief Values will have the names namePrefix{X,Y,Z,Roll,Pitch,Yaw}
88 */
89 HBoxLayoutPtr makeXYZRollPitchYawWidget(const std::string& namePrefix = "",
90 float initX = 0,
91 float initY = 0,
92 float initZ = 0,
93 float initRoll = 0,
94 float initPitch = 0,
95 float initYaw = 0,
96 FloatRange rangeX = {-25000, 25000},
97 FloatRange rangeY = {-25000, 25000},
98 FloatRange rangeZ = {-0, 25000},
99 FloatRange rangeRoll = {-M_PI, M_PI},
100 FloatRange rangePitch = {-M_PI, M_PI},
101 FloatRange rangeYaw = {-M_PI, M_PI});
102
103 inline HBoxLayoutPtr
104 makeXYZRollPitchYawWidget(const std::string& namePrefix,
105 FloatRange rangeLin,
106 FloatRange rangeAng)
107 {
108 return makeXYZRollPitchYawWidget(namePrefix,
109 0,
110 0,
111 0,
112 0,
113 0,
114 0,
115 rangeLin,
116 rangeLin,
117 rangeLin,
118 rangeAng,
119 rangeAng,
120 rangeAng);
121 }
122} // namespace armarx::WidgetDescription
#define M_PI
Definition MathTools.h:17
StringComboBoxPtr makeStringComboBox(std::string name, std::vector< std::string > options, long defaultIndex)
IntSpinBoxPtr makeIntSpinBox(std::string name, int min, int max, int defaultValue)
LineEditPtr makeLineEdit(std::string name, std::string defaultValue)
DoubleSliderPtr makeDoubleSlider(std::string name, double min, double max, double defaultValue)
DoubleLineEditPtr makeDoubleLineEdit(std::string name, double defaultValue)
FloatSpinBoxPtr makeFloatSpinBox(std::string name, float min, float max, float defaultValue, int steps, int decimals)
WidgetPtr makeFrame(WidgetPtr child)
HBoxLayoutPtr makeHBoxLayout(std::vector< WidgetPtr > elements)
DoubleSpinBoxPtr makeDoubleSpinBox(std::string name, double min, double max, double defaultValue, int steps, int decimals)
FloatSliderPtr makeFloatSlider(std::string name, float min, float max, float defaultValue)
CheckBoxPtr makeCheckBox(std::string name, bool defaultValue, std::string label)
GroupBoxPtr makeGroupBox(std::string label, WidgetPtr child, bool framed)
LabelPtr makeLabel(std::string text)
FormLayoutPtr makeFormLayout(std::vector< std::pair< std::string, WidgetPtr > > elements)
FloatLineEditPtr makeFloatLineEdit(std::string name, float defaultValue)
VBoxLayoutPtr makeVBoxLayout(std::vector< WidgetPtr > elements)
::IceInternal::Handle<::armarx::WidgetDescription::Widget > WidgetPtr
FormLayoutElementPtr makeSpanningFormLayoutElement(WidgetPtr child)
IntSliderPtr makeIntSlider(std::string name, int min, int max, int defaultValue)
FormLayoutElementPtr makeFormLayoutElement(WidgetPtr labelWidget, WidgetPtr child)
HBoxLayoutPtr makeXYZRollPitchYawWidget(const std::string &namePrefix, float initX, float initY, float initZ, float initRoll, float initPitch, float initYaw, FloatRange rangeX, FloatRange rangeY, FloatRange rangeZ, FloatRange rangeRoll, FloatRange rangePitch, FloatRange rangeYaw)
Values will have the names namePrefix{X,Y,Z,Roll,Pitch,Yaw}.
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)