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.2.0 $Rev: 2167 $
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 setShowPanel(const bool a_showPanel) { m_showPanel = a_showPanel; updatePanelMesh(); }
156 
158  bool getShowPanel() { return (m_showPanel); }
159 
160 
161  //--------------------------------------------------------------------------
162  // VIRTUAL PUBLIC METHODS: MARGINS
163  //--------------------------------------------------------------------------
164 
165 public:
166 
168  virtual void setMargins(const double a_marginTop,
169  const double a_marginBottom,
170  const double a_marginLeft,
171  const double a_marginRight);
172 
174  virtual void setMarginTop(const double a_marginTop);
175 
177  virtual double getMarginTop() { return (m_marginTop); }
178 
180  virtual void setMarginBottom(const double a_marginBottom);
181 
183  virtual double getMarginBottom() { return (m_marginBottom); }
184 
186  virtual void setMarginLeft(const double a_marginLeft);
187 
189  virtual double getMarginLeft() { return (m_marginLeft); }
190 
192  virtual void setMarginRight(const double a_marginRight);
193 
195  virtual double getMarginRight() { return (m_marginRight); }
196 
197  //--------------------------------------------------------------------------
198  // VIRTUAL PUBLIC METHODS:
199  //--------------------------------------------------------------------------
200 
201 public:
202 
204  void setTransparencyLevel(const float a_level,
205  const bool a_applyToVertices = false,
206  const bool a_applyToTextures = false,
207  const bool a_affectChildren = false);
208 
209 
210  //--------------------------------------------------------------------------
211  // PROTECTED MEMBERS:
212  //--------------------------------------------------------------------------
213 
214 protected:
215 
218 
221 
224 
227 
230 
232  double m_marginLeft;
233 
236 
238  double m_marginTop;
239 
242 
245 
246 
247  //--------------------------------------------------------------------------
248  // PROTECTED METHODS:
249  //--------------------------------------------------------------------------
250 
251 protected:
252 
254  virtual void updatePanelMesh();
255 
257  void copyPanelProperties(cPanel* a_obj,
258  const bool a_duplicateMaterialData,
259  const bool a_duplicateTextureData,
260  const bool a_duplicateMeshData,
261  const bool a_buildCollisionDetector);
262 
263 
264  //--------------------------------------------------------------------------
265  // PROTECTED MEMBERS:
266  //--------------------------------------------------------------------------
267 
268 protected:
269 
272 
275 
278 
281 };
282 
283 //------------------------------------------------------------------------------
284 } // namespace chai3d
285 //------------------------------------------------------------------------------
286 
287 //------------------------------------------------------------------------------
288 #endif
289 //------------------------------------------------------------------------------
virtual ~cPanel()
Destructor of cPanel.
Definition: CPanel.h:92
virtual double getMarginBottom()
This method returns the value of the bottom margin.
Definition: CPanel.h:183
void setTransparencyLevel(const float a_level, const bool a_applyToVertices=false, const bool a_applyToTextures=false, const bool a_affectChildren=false)
This method assigns a transparency level to this panel.
Definition: CPanel.cpp:301
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:491
virtual void updatePanelMesh()
This method updates the mesh model of this panel.
Definition: CPanel.cpp:446
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:220
double m_marginTop
Top margin that is used to render internal content.
Definition: CPanel.h:238
virtual void setHorizontalLinearGradient(cColorf a_leftColor, cColorf a_rightColor)
This method sets a horizontal gradient color.
Definition: CPanel.cpp:278
virtual void setSize(const double &a_width, const double &a_height)
This method sets the width and height of this panel.
Definition: CPanel.cpp:148
cColorf m_panelColorTopLeft
Panel color at top left corner.
Definition: CPanel.h:271
virtual void setMarginBottom(const double a_marginBottom)
This method assigns a bottom margin value.
Definition: CPanel.cpp:406
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:522
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:231
double m_marginRight
Right margin that is used to render internal content.
Definition: CPanel.h:235
Implements a base class for widgets.
bool getShowPanel()
This method returns true is this panel is enabled, false otherwise.
Definition: CPanel.h:158
double m_marginBottom
Bottom margin that is used to render internal content.
Definition: CPanel.h:241
cColorf m_panelColorTopRight
Panel color at top right corner.
Definition: CPanel.h:274
double m_marginLeft
Left margin that is used to render internal content.
Definition: CPanel.h:232
virtual double getMarginLeft()
This method returns the value of the left margin.
Definition: CPanel.h:189
virtual void setMarginLeft(const double a_marginLeft)
This method assigns a left margin value.
Definition: CPanel.cpp:420
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:175
cColorf getColorBottomRight() const
This method returns the color at to left corner of this panel.
Definition: CPanel.h:152
void setShowPanel(const bool a_showPanel)
This method enables or disables the modeling of the panel.
Definition: CPanel.h:155
cColorf m_panelColorBottomRight
Panel color at bottom right corner.
Definition: CPanel.h:280
double m_panelRadiusBottomRight
Radius of bottom right corner of this panel.
Definition: CPanel.h:226
int m_numPanelSegmentsPerCorner
Number of segments used to render each corner of thispanel.
Definition: CPanel.h:229
double m_panelRadiusBottomLeft
Radius of bottom left corner of this panel.
Definition: CPanel.h:223
virtual void setMarginRight(const double a_marginRight)
This method assigns a right margin value.
Definition: CPanel.cpp:434
virtual double getMarginTop()
This method returns the value of the top margin.
Definition: CPanel.h:177
This class defines a color using a GLfloat representation for each component.
Definition: CColor.h:138
bool m_showPanel
If true, panel is enabled for display. false otherwise.
Definition: CPanel.h:244
virtual void setColor(const cColorf &a_panelColor)
This method sets the panel color.
Definition: CPanel.cpp:208
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
virtual double getMarginRight()
This method returns the value of the right margin.
Definition: CPanel.h:195
cColorf m_panelColorBottomLeft
Panel color at bottom left corner.
Definition: CPanel.h:277
double m_panelRadiusTopLeft
Radius of top left corner of this panel.
Definition: CPanel.h:217
virtual void setMarginTop(const double a_marginTop)
This method assigns a top margin value.
Definition: CPanel.cpp:392
virtual void setPanelColorVerticalGradient(cColorf a_topColor, cColorf a_bottomColor)
This method sets a vertical gradient color.
Definition: CPanel.cpp:256
virtual void setMargins(const double a_marginTop, const double a_marginBottom, const double a_marginLeft, const double a_marginRight)
This method assigns margin values to this widget.
Definition: CPanel.cpp:371
cColorf getColorBottomLeft() const
This method returns the color at to left corner of this panel.
Definition: CPanel.h:149