My Project
Loading...
Searching...
No Matches
CDial.h
Go to the documentation of this file.
1//==============================================================================
2/*
3 Software License Agreement (BSD License)
4 Copyright (c) 2003-2024, CHAI3D
5 (www.chai3d.org)
6
7 All rights reserved.
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
12
13 * Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15
16 * Redistributions in binary form must reproduce the above
17 copyright notice, this list of conditions and the following
18 disclaimer in the documentation and/or other materials provided
19 with the distribution.
20
21 * Neither the name of CHAI3D nor the names of its contributors may
22 be used to endorse or promote products derived from this software
23 without specific prior written permission.
24
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 POSSIBILITY OF SUCH DAMAGE.
37
38 \author <http://www.chai3d.org>
39 \author Francois Conti
40 \version 3.3.0
41*/
42//==============================================================================
43
44//------------------------------------------------------------------------------
45#ifndef CDialH
46#define CDialH
47//------------------------------------------------------------------------------
49//------------------------------------------------------------------------------
50
51//------------------------------------------------------------------------------
52namespace chai3d {
53//------------------------------------------------------------------------------
54
55//==============================================================================
62//==============================================================================
63
64//==============================================================================
75//==============================================================================
76class cDial : public cGenericWidget
77{
78 //--------------------------------------------------------------------------
79 // CONSTRUCTOR & DESTRUCTOR:
80 //--------------------------------------------------------------------------
81
82public:
83
85 cDial();
86
88 virtual ~cDial() {};
89
90
91 //--------------------------------------------------------------------------
92 // PUBLIC MEMBERS:
93 //--------------------------------------------------------------------------
94
95public:
96
99
102
103
104 //--------------------------------------------------------------------------
105 // PUBLIC METHODS:
106 //--------------------------------------------------------------------------
107
108public:
109
111 virtual std::string getClassName() { return ("Bitmap"); }
112
114 virtual cDial* copy(const bool a_duplicateMaterialData = false,
115 const bool a_duplicateTextureData = false,
116 const bool a_duplicateMeshData = false,
117 const bool a_buildCollisionDetector = false);
118
120 void setSize(const double a_size);
121
123 void setNumIncrements(const int a_numIncrements);
124
126 inline int getNumIncrements() const { return (m_numIncrements); }
127
129 void setRange(const double a_minValue, const double a_maxValue);
130
132 inline double getRangeMin() const { return (m_minValue); }
133
135 inline double getRangeMax() const { return (m_maxValue); }
136
138 void setValue(const double a_value);
139
141 void setValue0(const double a_value0);
142
144 inline double getValue0() const { return (m_value0); }
145
147 void setValue1(const double a_value1);
148
150 inline double getValue1() const { return (m_value1); }
151
153 virtual void setValues(const double a_value0,
154 const double a_value1);
155
157 inline void setSingleIncrementDisplay(const bool a_singleIncrementDisplay) { m_flagSingleIncrementDisplay = a_singleIncrementDisplay; }
158
161
162
163 //--------------------------------------------------------------------------
164 // PROTECTED MEMBERS:
165 //--------------------------------------------------------------------------
166
167protected:
168
171
174
177
179 double m_value0;
180
182 double m_value1;
183
186
187
188 //--------------------------------------------------------------------------
189 // PROTECTED METHODS:
190 //--------------------------------------------------------------------------
191
192protected:
193
195 virtual void updateDialMesh();
196
198 virtual void updateBoundaryBox();
199
201 void copyDialProperties(cDial* a_obj,
202 const bool a_duplicateMaterialData,
203 const bool a_duplicateTextureData,
204 const bool a_duplicateMeshData,
205 const bool a_buildCollisionDetector);
206};
207
208//------------------------------------------------------------------------------
209} // namespace chai3d
210//------------------------------------------------------------------------------
211
212//------------------------------------------------------------------------------
213#endif
214//------------------------------------------------------------------------------
Implements a base class for widgets.
This class implements a 2D dial widget.
Definition CDial.h:77
double m_maxValue
Range - maximum value.
Definition CDial.h:176
void setRange(const double a_minValue, const double a_maxValue)
This method sets the range of input values which command the increment lines.
Definition CDial.cpp:127
double m_value1
Value 1.
Definition CDial.h:182
cColorf m_colorActive
Color of activated increment lines.
Definition CDial.h:98
void setSize(const double a_size)
This method sets the size of the dial.
Definition CDial.cpp:342
virtual void updateBoundaryBox()
This method update the bounding box of this dial.
Definition CDial.cpp:422
void setNumIncrements(const int a_numIncrements)
This method sets the number of increments. The value can range from 2 to 200.
Definition CDial.cpp:105
double getValue0() const
This method returns the first value displayed by the dial.
Definition CDial.h:144
double m_value0
Value 0.
Definition CDial.h:179
virtual void updateDialMesh()
This method updates the mesh model of this dial.
Definition CDial.cpp:361
void setSingleIncrementDisplay(const bool a_singleIncrementDisplay)
This method enables or disables the single colored line increment that is used to display the value.
Definition CDial.h:157
void setValue1(const double a_value1)
This method sets the second value to the dial.
Definition CDial.cpp:305
bool getSingleIncrementDisplay() const
This method returns the status about the display mode.
Definition CDial.h:160
void copyDialProperties(cDial *a_obj, const bool a_duplicateMaterialData, const bool a_duplicateTextureData, const bool a_duplicateMeshData, const bool a_buildCollisionDetector)
This method copies all properties of this object to another.
Definition CDial.cpp:473
bool m_flagSingleIncrementDisplay
If true, then the single segment display is activated.
Definition CDial.h:185
cDial()
Constructor of cDial.
Definition CDial.cpp:57
double getRangeMin() const
This method returns the minimum input value from the range.
Definition CDial.h:132
virtual void setValues(const double a_value0, const double a_value1)
This method sets both values to be displayed by the dial.
Definition CDial.cpp:323
double getValue1() const
This method returns the second value displayed by the dial.
Definition CDial.h:150
virtual cDial * copy(const bool a_duplicateMaterialData=false, const bool a_duplicateTextureData=false, const bool a_duplicateMeshData=false, const bool a_buildCollisionDetector=false)
This method creates a copy of itself.
Definition CDial.cpp:442
void setValue(const double a_value)
This method sets a value to the dial to be displayed.
Definition CDial.cpp:153
int getNumIncrements() const
This method returns the number of increments.
Definition CDial.h:126
double getRangeMax() const
This method returns the maximum input possible from the range.
Definition CDial.h:135
double m_minValue
Range - minimum value.
Definition CDial.h:173
int m_numIncrements
Number of increments.
Definition CDial.h:170
cColorf m_colorInactive
Color of inactivated increment lines.
Definition CDial.h:101
virtual ~cDial()
Destructor of cDial.
Definition CDial.h:88
void setValue0(const double a_value0)
This method sets the first value to the dial.
Definition CDial.cpp:208
virtual std::string getClassName()
This method returns the name of the object class.
Definition CDial.h:111
This class implements a base class for widgets.
Definition CGenericWidget.h:78
Definition CAudioBuffer.cpp:57
This class defines a color using a GLfloat representation for each component.
Definition CColor.h:139