CLevel.h
Go to the documentation of this file.
1 //==============================================================================
2 /*
3  Software License Agreement (BSD License)
4  Copyright (c) 2003-2016, 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.2.0 $Rev: 2167 $
41 */
42 //==============================================================================
43 
44 //------------------------------------------------------------------------------
45 #ifndef CLevelH
46 #define CLevelH
47 //------------------------------------------------------------------------------
48 #include "widgets/CGenericWidget.h"
49 //------------------------------------------------------------------------------
50 
51 //------------------------------------------------------------------------------
52 namespace chai3d {
53 //------------------------------------------------------------------------------
54 
55 //==============================================================================
62 //==============================================================================
63 
64 //==============================================================================
75 //==============================================================================
76 class cLevel : public cGenericWidget
77 {
78  //--------------------------------------------------------------------------
79  // CONSTRUCTOR & DESTRUCTOR:
80  //--------------------------------------------------------------------------
81 
82 public:
83 
85  cLevel();
86 
88  virtual ~cLevel() {};
89 
90 
91  //--------------------------------------------------------------------------
92  // PUBLIC MEMBERS:
93  //--------------------------------------------------------------------------
94 
95 public:
96 
99 
102 
103 
104  //--------------------------------------------------------------------------
105  // PUBLIC METHODS:
106  //--------------------------------------------------------------------------
107 
108 public:
109 
111  virtual cLevel* copy(const bool a_duplicateMaterialData = false,
112  const bool a_duplicateTextureData = false,
113  const bool a_duplicateMeshData = false,
114  const bool a_buildCollisionDetector = false);
115 
117  void setWidth(const double a_width);
118 
120  void setNumIncrements(const int a_numIncrements);
121 
123  inline int getNumIncrements() const { return (m_numIncrements); }
124 
126  void setRange(const double a_minValue, const double a_maxValue);
127 
129  inline double getRangeMin() const { return (m_minValue); }
130 
132  inline double getRangeMax() const { return (m_maxValue); }
133 
135  void setValue(const double a_value);
136 
138  double getValue() const { return (m_value); }
139 
141  inline void setSingleIncrementDisplay(const bool a_singleIncrementDisplay) { m_flagSingleIncrementDisplay = a_singleIncrementDisplay; }
142 
144  inline bool getSingleIncrementDisplay() const { return (m_flagSingleIncrementDisplay); }
145 
146 
147  //--------------------------------------------------------------------------
148  // PROTECTED MEMBERS:
149  //--------------------------------------------------------------------------
150 
151 protected:
152 
155 
157  double m_minValue;
158 
160  double m_maxValue;
161 
163  double m_value;
164 
167 
168 
169  //--------------------------------------------------------------------------
170  // PROTECTED VIRTUAL METHODS:
171  //--------------------------------------------------------------------------
172 
173 protected:
174 
176  virtual void updateLevelMesh();
177 
179  void copyLevelProperties(cLevel* a_obj,
180  const bool a_duplicateMaterialData,
181  const bool a_duplicateTextureData,
182  const bool a_duplicateMeshData,
183  const bool a_buildCollisionDetector);
184 };
185 
186 //------------------------------------------------------------------------------
187 } // namespace chai3d
188 //------------------------------------------------------------------------------
189 
190 //------------------------------------------------------------------------------
191 #endif
192 //------------------------------------------------------------------------------
double m_value
Current value.
Definition: CLevel.h:163
void setWidth(const double a_width)
This method sets the width of this cLevel widget.
Definition: CLevel.cpp:99
This class implements a 2D level display widget.
Definition: CLevel.h:76
double getValue() const
This method returns the current value displayed by the level.
Definition: CLevel.h:138
int m_numIncrements
Number of increments.
Definition: CLevel.h:154
virtual void updateLevelMesh()
This method updates the mesh model.
Definition: CLevel.cpp:218
virtual cLevel * 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: CLevel.cpp:274
void setSingleIncrementDisplay(const bool a_singleIncrementDisplay)
This method enables or disables the use of single colored line increments to display the value...
Definition: CLevel.h:141
cColorf m_colorInactive
Color of inactivated increment lines.
Definition: CLevel.h:101
void setNumIncrements(const int a_numIncrements)
This method sets the number of increments. This value can range from 2 to 200.
Definition: CLevel.cpp:120
int getNumIncrements() const
This method returns the number of increments.
Definition: CLevel.h:123
Implements a base class for widgets.
double m_maxValue
Range - maximum value.
Definition: CLevel.h:160
bool m_flagSingleIncrementDisplay
If true, then the single segment display is activated.
Definition: CLevel.h:166
This class implements a base class for widgets.
Definition: CGenericWidget.h:77
cLevel()
Constructor of cLevel.
Definition: CLevel.cpp:57
void setRange(const double a_minValue, const double a_maxValue)
This method sets the range of input values which command the increment lines.
Definition: CLevel.cpp:142
void copyLevelProperties(cLevel *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: CLevel.cpp:305
This class defines a color using a GLfloat representation for each component.
Definition: CColor.h:138
double getRangeMin() const
This method returns the minimum value of the range.
Definition: CLevel.h:129
void setValue(const double a_value)
This method sets a value to be displayed by the level.
Definition: CLevel.cpp:168
Definition: CAudioBuffer.cpp:56
cColorf m_colorActive
Color of activated increment lines.
Definition: CLevel.h:88
bool getSingleIncrementDisplay() const
This method returns the status about the display mode.
Definition: CLevel.h:144
virtual ~cLevel()
Destructor of cLevel.
Definition: CLevel.h:88
double getRangeMax() const
This method returns the maximum value of the range.
Definition: CLevel.h:132
double m_minValue
Range - minimum value.
Definition: CLevel.h:157