My Project
Loading...
Searching...
No Matches
CPanel.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 CPanelH
46#define CPanelH
47//------------------------------------------------------------------------------
49//------------------------------------------------------------------------------
50
51//------------------------------------------------------------------------------
52namespace chai3d {
53//------------------------------------------------------------------------------
54
55//==============================================================================
62//==============================================================================
63
64//==============================================================================
79//==============================================================================
80class cPanel : public cGenericWidget
81{
82 //--------------------------------------------------------------------------
83 // CONSTRUCTOR & DESTRUCTOR:
84 //--------------------------------------------------------------------------
85
86public:
87
89 cPanel();
90
92 virtual ~cPanel() {};
93
94
95 //--------------------------------------------------------------------------
96 // PUBLIC METHODS:
97 //--------------------------------------------------------------------------
98
99public:
100
102 virtual std::string getClassName() { return ("Panel"); }
103
105 virtual cPanel* copy(const bool a_duplicateMaterialData = false,
106 const bool a_duplicateTextureData = false,
107 const bool a_duplicateMeshData = false,
108 const bool a_buildCollisionDetector = false);
109
111 virtual void set(const double& a_width,
112 const double& a_height,
113 const double& a_radiusTopLeft = 0,
114 const double& a_radiusTopRight = 0,
115 const double& a_radiusBottomLeft = 0,
116 const double& a_radiusBottomRight = 0);
117
119 virtual void setSize(const double& a_width,
120 const double& a_height);
121
123 virtual void setCornerRadius(const double& a_radiusTopLeft = 0,
124 const double& a_radiusTopRight = 0,
125 const double& a_radiusBottomLeft = 0,
126 const double& a_radiusBottomRight = 0);
127
129 virtual void setColor(const cColorf& a_panelColor);
130
132 virtual void setCornerColors(const cColorf& a_panelColorTopLeft,
133 const cColorf& a_panelColorTopRight,
134 const cColorf& a_panelColorBottomLeft,
135 const cColorf& a_panelColorBottomRight);
136
138 virtual void setPanelColorVerticalGradient(cColorf a_topColor,
139 cColorf a_bottomColor);
140
142 virtual void setHorizontalLinearGradient(cColorf a_leftColor,
143 cColorf a_rightColor);
144
146 inline cColorf getColorTopLeft() const { return (m_panelColorTopLeft); }
147
149 inline cColorf getColorTopRight() const { return (m_panelColorTopRight); }
150
153
156
158 void setShowPanel(const bool a_showPanel) { m_showPanel = a_showPanel; updatePanelMesh(); }
159
161 bool getShowPanel() { return (m_showPanel); }
162
163
164 //--------------------------------------------------------------------------
165 // VIRTUAL PUBLIC METHODS: MARGINS
166 //--------------------------------------------------------------------------
167
168public:
169
171 virtual void setMargins(const double a_marginTop,
172 const double a_marginBottom,
173 const double a_marginLeft,
174 const double a_marginRight);
175
177 virtual void setMarginTop(const double a_marginTop);
178
180 virtual double getMarginTop() { return (m_marginTop); }
181
183 virtual void setMarginBottom(const double a_marginBottom);
184
186 virtual double getMarginBottom() { return (m_marginBottom); }
187
189 virtual void setMarginLeft(const double a_marginLeft);
190
192 virtual double getMarginLeft() { return (m_marginLeft); }
193
195 virtual void setMarginRight(const double a_marginRight);
196
198 virtual double getMarginRight() { return (m_marginRight); }
199
200 //--------------------------------------------------------------------------
201 // VIRTUAL PUBLIC METHODS:
202 //--------------------------------------------------------------------------
203
204public:
205
207 void setTransparencyLevel(const float a_level,
208 const bool a_applyToVertices = false,
209 const bool a_applyToTextures = false,
210 const bool a_affectChildren = false,
211 const bool a_affectComponents = true);
212
213
214 //--------------------------------------------------------------------------
215 // PROTECTED MEMBERS:
216 //--------------------------------------------------------------------------
217
218protected:
219
222
225
228
231
234
237
240
243
246
249
250
251 //--------------------------------------------------------------------------
252 // PROTECTED METHODS:
253 //--------------------------------------------------------------------------
254
255protected:
256
258 virtual void updatePanelMesh();
259
261 void copyPanelProperties(cPanel* a_obj,
262 const bool a_duplicateMaterialData,
263 const bool a_duplicateTextureData,
264 const bool a_duplicateMeshData,
265 const bool a_buildCollisionDetector);
266
267
268 //--------------------------------------------------------------------------
269 // PROTECTED MEMBERS:
270 //--------------------------------------------------------------------------
271
272protected:
273
276
279
282
285};
286
287//------------------------------------------------------------------------------
288} // namespace chai3d
289//------------------------------------------------------------------------------
290
291//------------------------------------------------------------------------------
292#endif
293//------------------------------------------------------------------------------
Implements a base class for widgets.
This class implements a base class for widgets.
Definition CGenericWidget.h:78
This class implements a 2D panel widget.
Definition CPanel.h:81
virtual double getMarginLeft()
This method returns the value of the left margin.
Definition CPanel.h:192
cColorf getColorTopRight() const
This method returns the color at top right corner of this panel.
Definition CPanel.h:149
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:543
cColorf m_panelColorTopLeft
Panel color at top left corner.
Definition CPanel.h:275
cColorf m_panelColorBottomLeft
Panel color at bottom left corner.
Definition CPanel.h:281
virtual double getMarginBottom()
This method returns the value of the bottom margin.
Definition CPanel.h:186
void setShowPanel(const bool a_showPanel)
This method enables or disables the modeling of the panel.
Definition CPanel.h:158
cColorf m_panelColorTopRight
Panel color at top right corner.
Definition CPanel.h:278
double m_marginRight
Right margin that is used to render internal content.
Definition CPanel.h:239
virtual double getMarginTop()
This method returns the value of the top margin.
Definition CPanel.h:180
virtual void setPanelColorVerticalGradient(cColorf a_topColor, cColorf a_bottomColor)
This method sets a vertical gradient color.
Definition CPanel.cpp:299
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:113
virtual ~cPanel()
Destructor of cPanel.
Definition CPanel.h:92
int m_numPanelSegmentsPerCorner
Number of segments used to render each corner of thispanel.
Definition CPanel.h:233
virtual void setColor(const cColorf &a_panelColor)
This method sets the panel color.
Definition CPanel.cpp:233
cColorf getColorTopLeft() const
This method returns the color at top left corner of this panel.
Definition CPanel.h:146
virtual double getMarginRight()
This method returns the value of the right margin.
Definition CPanel.h:198
double m_panelRadiusTopRight
Radius of top right corner of this panel.
Definition CPanel.h:224
bool getShowPanel()
This method returns true is this panel is enabled, false otherwise.
Definition CPanel.h:161
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:512
virtual void setSize(const double &a_width, const double &a_height)
This method sets the width and height of this panel.
Definition CPanel.cpp:159
virtual void setMarginTop(const double a_marginTop)
This method assigns a top margin value.
Definition CPanel.cpp:413
virtual void setMarginLeft(const double a_marginLeft)
This method assigns a left margin value.
Definition CPanel.cpp:441
void setTransparencyLevel(const float a_level, const bool a_applyToVertices=false, const bool a_applyToTextures=false, const bool a_affectChildren=false, const bool a_affectComponents=true)
This method assigns a transparency level to this panel.
Definition CPanel.cpp:354
cPanel()
Constructor of cPanel.
Definition CPanel.cpp:63
cColorf m_panelColorBottomRight
Panel color at bottom right corner.
Definition CPanel.h:284
double m_panelRadiusBottomLeft
Radius of bottom left corner of this panel.
Definition CPanel.h:227
cColorf getColorBottomRight() const
This method returns the color at to left corner of this panel.
Definition CPanel.h:155
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:265
double m_panelRadiusTopLeft
Radius of top left corner of this panel.
Definition CPanel.h:221
virtual void updatePanelMesh()
This method updates the mesh model of this panel.
Definition CPanel.cpp:467
double m_marginTop
Top margin that is used to render internal content.
Definition CPanel.h:242
virtual std::string getClassName()
This method returns the name of the object class.
Definition CPanel.h:102
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:392
bool m_showPanel
If true, panel is enabled for display. false otherwise.
Definition CPanel.h:248
double m_marginLeft
Left margin that is used to render internal content.
Definition CPanel.h:236
cColorf getColorBottomLeft() const
This method returns the color at to left corner of this panel.
Definition CPanel.h:152
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:192
virtual void setMarginRight(const double a_marginRight)
This method assigns a right margin value.
Definition CPanel.cpp:455
virtual void setMarginBottom(const double a_marginBottom)
This method assigns a bottom margin value.
Definition CPanel.cpp:427
double m_marginBottom
Bottom margin that is used to render internal content.
Definition CPanel.h:245
double m_panelRadiusBottomRight
Radius of bottom right corner of this panel.
Definition CPanel.h:230
virtual void setHorizontalLinearGradient(cColorf a_leftColor, cColorf a_rightColor)
This method sets a horizontal gradient color.
Definition CPanel.cpp:330
Definition CAudioBuffer.cpp:57
This class defines a color using a GLfloat representation for each component.
Definition CColor.h:139