CPanel.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.1.1 $Rev: 1869 $
41 */
42 //==============================================================================
43 
44 //------------------------------------------------------------------------------
45 #ifndef CPanelH
46 #define CPanelH
47 //------------------------------------------------------------------------------
48 #include "widgets/CGenericWidget.h"
49 //------------------------------------------------------------------------------
50 
51 //------------------------------------------------------------------------------
52 namespace chai3d {
53 //------------------------------------------------------------------------------
54 
55 //==============================================================================
62 //==============================================================================
63 
64 //==============================================================================
79 //==============================================================================
80 class cPanel : public cGenericWidget
81 {
82  //--------------------------------------------------------------------------
83  // CONSTRUCTOR & DESTRUCTOR:
84  //--------------------------------------------------------------------------
85 
86 public:
87 
89  cPanel();
90 
92  virtual ~cPanel() {};
93 
94 
95  //--------------------------------------------------------------------------
96  // PUBLIC METHODS:
97  //--------------------------------------------------------------------------
98 
99 public:
100 
102  virtual cPanel* copy(const bool a_duplicateMaterialData = false,
103  const bool a_duplicateTextureData = false,
104  const bool a_duplicateMeshData = false,
105  const bool a_buildCollisionDetector = false);
106 
108  virtual void set(const double& a_width,
109  const double& a_height,
110  const double& a_radiusTopLeft = 0,
111  const double& a_radiusTopRight = 0,
112  const double& a_radiusBottomLeft = 0,
113  const double& a_radiusBottomRight = 0);
114 
116  virtual void setSize(const double& a_width,
117  const double& a_height);
118 
120  virtual void setCornerRadius(const double& a_radiusTopLeft = 0,
121  const double& a_radiusTopRight = 0,
122  const double& a_radiusBottomLeft = 0,
123  const double& a_radiusBottomRight = 0);
124 
126  virtual void setColor(const cColorf& a_panelColor);
127 
129  virtual void setCornerColors(const cColorf& a_panelColorTopLeft,
130  const cColorf& a_panelColorTopRight,
131  const cColorf& a_panelColorBottomLeft,
132  const cColorf& a_panelColorBottomRight);
133 
135  virtual void setPanelColorVerticalGradient(cColorf a_topColor,
136  cColorf a_bottomColor);
137 
139  virtual void setHorizontalLinearGradient(cColorf a_leftColor,
140  cColorf a_rightColor);
141 
143  inline cColorf getColorTopLeft() const { return (m_panelColorTopLeft); }
144 
146  inline cColorf getColorTopRight() const { return (m_panelColorTopRight); }
147 
149  inline cColorf getColorBottomLeft() const { return (m_panelColorBottomLeft); }
150 
153 
155  void setPanelEnabled(const bool a_enabled) { m_panelEnabled = a_enabled; }
156 
158  bool getPanelEnabled() {return (m_panelEnabled); }
159 
160 
161  //--------------------------------------------------------------------------
162  // VIRTUAL PUBLIC METHODS:
163  //--------------------------------------------------------------------------
164 
165 public:
166 
168  void setTransparencyLevel(const float a_level,
169  const bool a_applyToTextures = false,
170  const bool a_affectChildren = false);
171 
172 
173  //--------------------------------------------------------------------------
174  // PROTECTED MEMBERS:
175  //--------------------------------------------------------------------------
176 
177 protected:
178 
181 
184 
187 
190 
193 
196 
197 
198  //--------------------------------------------------------------------------
199  // PROTECTED METHODS:
200  //--------------------------------------------------------------------------
201 
202 protected:
203 
205  virtual void updatePanelMesh();
206 
208  void copyPanelProperties(cPanel* a_obj,
209  const bool a_duplicateMaterialData,
210  const bool a_duplicateTextureData,
211  const bool a_duplicateMeshData,
212  const bool a_buildCollisionDetector);
213 
214 
215  //--------------------------------------------------------------------------
216  // PROTECTED MEMBERS:
217  //--------------------------------------------------------------------------
218 
219 protected:
220 
223 
226 
229 
232 };
233 
234 //------------------------------------------------------------------------------
235 } // namespace chai3d
236 //------------------------------------------------------------------------------
237 
238 //------------------------------------------------------------------------------
239 #endif
240 //------------------------------------------------------------------------------
virtual ~cPanel()
Destructor of cPanel.
Definition: CPanel.h:92
void setPanelEnabled(const bool a_enabled)
This method enables or disables the modeling of the panel.
Definition: CPanel.h:155
This class implements a 2D panel widget.
Definition: CPanel.h:80
virtual cPanel * 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: CPanel.cpp:398
virtual void updatePanelMesh()
This method updates the mesh model of this panel.
Definition: CPanel.cpp:353
cColorf getColorTopLeft() const
This method returns the color at top left corner of this panel.
Definition: CPanel.h:143
double m_panelRadiusTopRight
Radius of top right corner of this panel.
Definition: CPanel.h:183
virtual void setHorizontalLinearGradient(cColorf a_leftColor, cColorf a_rightColor)
This method sets a horizontal gradient color.
Definition: CPanel.cpp:272
virtual void setSize(const double &a_width, const double &a_height)
This method sets the width and height of this panel.
Definition: CPanel.cpp:142
cColorf m_panelColorTopLeft
Panel color at top left corner.
Definition: CPanel.h:222
void copyPanelProperties(cPanel *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 panel to another.
Definition: CPanel.cpp:429
virtual void setCornerColors(const cColorf &a_panelColorTopLeft, const cColorf &a_panelColorTopRight, const cColorf &a_panelColorBottomLeft, const cColorf &a_panelColorBottomRight)
This method sets different colors for all four corners of the panel.
Definition: CPanel.cpp:225
Implements a base class for widgets.
cColorf m_panelColorTopRight
Panel color at top right corner.
Definition: CPanel.h:225
void setTransparencyLevel(const float a_level, const bool a_applyToTextures=false, const bool a_affectChildren=false)
This method assigns a transparency level to this panel.
Definition: CPanel.cpp:294
bool getPanelEnabled()
This method returns true is this panel is enabled, false otherwise.
Definition: CPanel.h:158
This class implements a base class for widgets.
Definition: CGenericWidget.h:77
virtual void setCornerRadius(const double &a_radiusTopLeft=0, const double &a_radiusTopRight=0, const double &a_radiusBottomLeft=0, const double &a_radiusBottomRight=0)
This method sets the radius for each corner of this panel.
Definition: CPanel.cpp:169
cColorf getColorBottomRight() const
This method returns the color at to left corner of this panel.
Definition: CPanel.h:152
cColorf m_panelColorBottomRight
Panel color at bottom right corner.
Definition: CPanel.h:231
double m_panelRadiusBottomRight
Radius of bottom right corner of this panel.
Definition: CPanel.h:189
int m_numPanelSegmentsPerCorner
Number of segments used to render each corner of thispanel.
Definition: CPanel.h:192
bool m_panelEnabled
If true, panel is enabled. false otherwise.
Definition: CPanel.h:195
virtual void set(const double &a_width, const double &a_height, const double &a_radiusTopLeft=0, const double &a_radiusTopRight=0, const double &a_radiusBottomLeft=0, const double &a_radiusBottomRight=0)
This method sets the width, height, and radius of each corner of this panel.
Definition: CPanel.cpp:107
double m_panelRadiusBottomLeft
Radius of bottom left corner of this panel.
Definition: CPanel.h:186
This class defines a color using a GLfloat representation for each component.
Definition: CColor.h:138
virtual void setColor(const cColorf &a_panelColor)
This method sets the panel color.
Definition: CPanel.cpp:202
cPanel()
Constructor of cPanel.
Definition: CPanel.cpp:63
Definition: CAudioBuffer.cpp:56
cColorf getColorTopRight() const
This method returns the color at top right corner of this panel.
Definition: CPanel.h:146
cColorf m_panelColorBottomLeft
Panel color at bottom left corner.
Definition: CPanel.h:228
double m_panelRadiusTopLeft
Radius of top left corner of this panel.
Definition: CPanel.h:180
virtual void setPanelColorVerticalGradient(cColorf a_topColor, cColorf a_bottomColor)
This method sets a vertical gradient color.
Definition: CPanel.cpp:250
cColorf getColorBottomLeft() const
This method returns the color at to left corner of this panel.
Definition: CPanel.h:149