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 <ArmarXGui/interface/WidgetDescription.h>
26 
27 #include <cmath>
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 makeFormLayoutElement(std::string name, WidgetPtr child, bool spanning = false);
38  FormLayoutElementPtr makeFormLayoutElement(WidgetPtr labelWidget, WidgetPtr child);
39 
40  FormLayoutPtr makeFormLayout(std::vector<std::pair<std::string, WidgetPtr>> elements);
41  FormLayoutPtr makeFormLayout(std::vector<WidgetPtr> elements);
42 
43  GroupBoxPtr makeGroupBox(std::string label, WidgetPtr child, bool framed = false);
44 
46 
47  HSpacerPtr makeHSpacer();
48  VSpacerPtr makeVSpacer();
49  HLinePtr makeHLine();
50  VLinePtr makeVLine();
51  LabelPtr makeLabel(std::string text);
52 
53  CheckBoxPtr makeCheckBox(std::string name, bool defaultValue, std::string label);
54  CheckBoxPtr makeCheckBox(std::string name, bool defaultValue = false);
55 
56  IntSpinBoxPtr makeIntSpinBox(std::string name, int min = 0, int max = 100, int defaultValue = 0);
57  FloatSpinBoxPtr makeFloatSpinBox(std::string name, float min = 0, float max = 100, float defaultValue = 0, int steps = 100, int decimals = 3);
58  DoubleSpinBoxPtr makeDoubleSpinBox(std::string name, double min = 0, double max = 100, double defaultValue = 0, int steps = 100, int decimals = 3);
59 
60  IntSliderPtr makeIntSlider(std::string name, int min = 0, int max = 100, int defaultValue = 0);
61  FloatSliderPtr makeFloatSlider(std::string name, float min = 0, float max = 100, float defaultValue = 0);
62  DoubleSliderPtr makeDoubleSlider(std::string name, double min = 0, double max = 100, double defaultValue = 0);
63 
64  StringComboBoxPtr makeStringComboBox(std::string name, std::vector<std::string> options, long defaultIndex = 0);
65 
66  LineEditPtr makeLineEdit(std::string name, std::string defaultValue = "");
67  FloatLineEditPtr makeFloatLineEdit(std::string name, float defaultValue = 0);
68  DoubleLineEditPtr makeDoubleLineEdit(std::string name, double defaultValue = 0);
69 
70  //more complex widgets
71  /**
72  * @brief Values will have the names namePrefix{X,Y,Z,Roll,Pitch,Yaw}
73  */
74  HBoxLayoutPtr makeXYZRollPitchYawWidget(
75  const std::string& namePrefix = "",
76  float initX = 0,
77  float initY = 0,
78  float initZ = 0,
79  float initRoll = 0,
80  float initPitch = 0,
81  float initYaw = 0,
82  FloatRange rangeX = { -25000, 25000},
83  FloatRange rangeY = { -25000, 25000},
84  FloatRange rangeZ = { -0, 25000},
85  FloatRange rangeRoll = { -M_PI, M_PI},
86  FloatRange rangePitch = { -M_PI, M_PI},
87  FloatRange rangeYaw = { -M_PI, M_PI});
88 
89  inline HBoxLayoutPtr makeXYZRollPitchYawWidget(
90  const std::string& namePrefix,
91  FloatRange rangeLin,
92  FloatRange rangeAng)
93  {
94  return makeXYZRollPitchYawWidget(namePrefix, 0, 0, 0, 0, 0, 0, rangeLin, rangeLin, rangeLin, rangeAng, rangeAng, rangeAng);
95  }
96 }
armarx::WidgetDescription::makeSpanningFormLayoutElement
FormLayoutElementPtr makeSpanningFormLayoutElement(WidgetPtr child)
Definition: DefaultWidgetDescriptions.cpp:78
armarx::WidgetDescription::makeVSpacer
VSpacerPtr makeVSpacer()
Definition: DefaultWidgetDescriptions.cpp:125
armarx::WidgetDescription::makeGroupBox
GroupBoxPtr makeGroupBox(std::string label, WidgetPtr child, bool framed)
Definition: DefaultWidgetDescriptions.cpp:105
armarx::WidgetDescription::makeDoubleSlider
DoubleSliderPtr makeDoubleSlider(std::string name, double min, double max, double defaultValue)
Definition: DefaultWidgetDescriptions.cpp:216
armarx::WidgetDescription::makeHBoxLayout
HBoxLayoutPtr makeHBoxLayout(std::vector< WidgetPtr > elements)
Definition: DefaultWidgetDescriptions.cpp:30
armarx::max
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
Definition: VectorHelpers.h:267
armarx::WidgetDescription::makeFloatSlider
FloatSliderPtr makeFloatSlider(std::string name, float min, float max, float defaultValue)
Definition: DefaultWidgetDescriptions.cpp:206
armarx::WidgetDescription::makeHLine
HLinePtr makeHLine()
Definition: DefaultWidgetDescriptions.cpp:130
armarx::WidgetDescription::makeFloatSpinBox
FloatSpinBoxPtr makeFloatSpinBox(std::string name, float min, float max, float defaultValue, int steps, int decimals)
Definition: DefaultWidgetDescriptions.cpp:172
armarx::WidgetDescription::makeLabel
LabelPtr makeLabel(std::string text)
Definition: DefaultWidgetDescriptions.cpp:140
armarx::WidgetDescription::makeDoubleLineEdit
DoubleLineEditPtr makeDoubleLineEdit(std::string name, double defaultValue)
Definition: DefaultWidgetDescriptions.cpp:251
armarx::WidgetDescription::makeFrame
WidgetPtr makeFrame(WidgetPtr child)
Definition: DefaultWidgetDescriptions.cpp:114
armarx::WidgetDescription
Definition: DefaultWidgetDescriptions.cpp:27
M_PI
#define M_PI
Definition: MathTools.h:17
armarx::WidgetDescription::makeIntSlider
IntSliderPtr makeIntSlider(std::string name, int min, int max, int defaultValue)
Definition: DefaultWidgetDescriptions.cpp:196
armarx::WidgetDescription::makeFormLayoutElement
FormLayoutElementPtr makeFormLayoutElement(WidgetPtr labelWidget, WidgetPtr child)
Definition: DefaultWidgetDescriptions.cpp:44
armarx::WidgetDescription::makeVLine
VLinePtr makeVLine()
Definition: DefaultWidgetDescriptions.cpp:135
armarx::WidgetDescription::makeFloatLineEdit
FloatLineEditPtr makeFloatLineEdit(std::string name, float defaultValue)
Definition: DefaultWidgetDescriptions.cpp:243
armarx::WidgetDescription::makeFormLayout
FormLayoutPtr makeFormLayout(std::vector< std::pair< std::string, WidgetPtr > > elements)
Definition: DefaultWidgetDescriptions.cpp:83
armarx::WidgetDescription::makeXYZRollPitchYawWidget
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}.
Definition: DefaultWidgetDescriptions.cpp:260
armarx::WidgetDescription::makeIntSpinBox
IntSpinBoxPtr makeIntSpinBox(std::string name, int min, int max, int defaultValue)
Definition: DefaultWidgetDescriptions.cpp:162
armarx::WidgetDescription::makeDoubleSpinBox
DoubleSpinBoxPtr makeDoubleSpinBox(std::string name, double min, double max, double defaultValue, int steps, int decimals)
Definition: DefaultWidgetDescriptions.cpp:184
armarx::WidgetDescription::WidgetPtr
::IceInternal::Handle<::armarx::WidgetDescription::Widget > WidgetPtr
Definition: NJointControllerBase.h:66
armarx::min
std::vector< T > min(const std::vector< T > &v1, const std::vector< T > &v2)
Definition: VectorHelpers.h:294
armarx::WidgetDescription::makeStringComboBox
StringComboBoxPtr makeStringComboBox(std::string name, std::vector< std::string > options, long defaultIndex)
Definition: DefaultWidgetDescriptions.cpp:226
armarx::WidgetDescription::makeCheckBox
CheckBoxPtr makeCheckBox(std::string name, bool defaultValue, std::string label)
Definition: DefaultWidgetDescriptions.cpp:145
armarx::WidgetDescription::makeHSpacer
HSpacerPtr makeHSpacer()
Definition: DefaultWidgetDescriptions.cpp:120
armarx::WidgetDescription::makeLineEdit
LineEditPtr makeLineEdit(std::string name, std::string defaultValue)
Definition: DefaultWidgetDescriptions.cpp:235
armarx::WidgetDescription::makeVBoxLayout
VBoxLayoutPtr makeVBoxLayout(std::vector< WidgetPtr > elements)
Definition: DefaultWidgetDescriptions.cpp:37