Panda3D
 All Classes Functions Variables Enumerations
pgFrameStyle.I
1 // Filename: pgFrameStyle.I
2 // Created by: drose (03Jul01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: PGFrameStyle::Constructor
18 // Access: Published
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE PGFrameStyle::
22 PGFrameStyle() {
23  _type = T_none;
24  _color.set(1.0f, 1.0f, 1.0f, 1.0f);
25  _width.set(0.1f, 0.1f);
26  _uv_width.set(0.1f, 0.1f);
27  _visible_scale.set(1.0f, 1.0f);
28 }
29 
30 ////////////////////////////////////////////////////////////////////
31 // Function: PGFrameStyle::Copy Constructor
32 // Access: Published
33 // Description:
34 ////////////////////////////////////////////////////////////////////
35 INLINE PGFrameStyle::
36 PGFrameStyle(const PGFrameStyle &copy) :
37  _type(copy._type),
38  _color(copy._color),
39  _texture(copy._texture),
40  _width(copy._width),
41  _uv_width(copy._uv_width),
42  _visible_scale(copy._visible_scale)
43 {
44 }
45 
46 ////////////////////////////////////////////////////////////////////
47 // Function: PGFrameStyle::Copy Assignment Operator
48 // Access: Published
49 // Description:
50 ////////////////////////////////////////////////////////////////////
51 INLINE void PGFrameStyle::
52 operator = (const PGFrameStyle &copy) {
53  _type = copy._type;
54  _color = copy._color;
55  _texture = copy._texture;
56  _width = copy._width;
57  _uv_width = copy._uv_width;
58  _visible_scale = copy._visible_scale;
59 }
60 
61 ////////////////////////////////////////////////////////////////////
62 // Function: PGFrameStyle::Destructor
63 // Access: Published
64 // Description:
65 ////////////////////////////////////////////////////////////////////
66 INLINE PGFrameStyle::
67 ~PGFrameStyle() {
68 }
69 
70 ////////////////////////////////////////////////////////////////////
71 // Function: PGFrameStyle::set_type
72 // Access: Published
73 // Description: Sets the basic type of frame.
74 ////////////////////////////////////////////////////////////////////
75 INLINE void PGFrameStyle::
76 set_type(PGFrameStyle::Type type) {
77  _type = type;
78 }
79 
80 ////////////////////////////////////////////////////////////////////
81 // Function: PGFrameStyle::get_type
82 // Access: Published
83 // Description: Returns the basic type of frame.
84 ////////////////////////////////////////////////////////////////////
85 INLINE PGFrameStyle::Type PGFrameStyle::
86 get_type() const {
87  return _type;
88 }
89 
90 ////////////////////////////////////////////////////////////////////
91 // Function: PGFrameStyle::set_color
92 // Access: Published
93 // Description: Sets the dominant color of the frame.
94 ////////////////////////////////////////////////////////////////////
95 INLINE void PGFrameStyle::
96 set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
97  set_color(LColor(r, g, b, a));
98 }
99 
100 ////////////////////////////////////////////////////////////////////
101 // Function: PGFrameStyle::set_color
102 // Access: Published
103 // Description: Sets the dominant color of the frame.
104 ////////////////////////////////////////////////////////////////////
105 INLINE void PGFrameStyle::
107  _color = color;
108 }
109 
110 ////////////////////////////////////////////////////////////////////
111 // Function: PGFrameStyle::set_color
112 // Access: Published
113 // Description: Returns the dominant color of the frame.
114 ////////////////////////////////////////////////////////////////////
115 INLINE LColor PGFrameStyle::
116 get_color() const {
117  return _color;
118 }
119 
120 ////////////////////////////////////////////////////////////////////
121 // Function: PGFrameStyle::set_texture
122 // Access: Published
123 // Description: Specifies a texture that should be applied to the
124 // frame.
125 ////////////////////////////////////////////////////////////////////
126 INLINE void PGFrameStyle::
127 set_texture(Texture *texture) {
128  _texture = texture;
129 }
130 
131 ////////////////////////////////////////////////////////////////////
132 // Function: PGFrameStyle::has_texture
133 // Access: Published
134 // Description: Returns true if a texture has been applied to the
135 // frame.
136 ////////////////////////////////////////////////////////////////////
137 INLINE bool PGFrameStyle::
138 has_texture() const {
139  return !_texture.is_null();
140 }
141 
142 ////////////////////////////////////////////////////////////////////
143 // Function: PGFrameStyle::get_texture
144 // Access: Published
145 // Description: Returns the texture that has been applied to the
146 // frame, or NULL if no texture has been applied.
147 ////////////////////////////////////////////////////////////////////
148 INLINE Texture *PGFrameStyle::
149 get_texture() const {
150  return _texture;
151 }
152 
153 ////////////////////////////////////////////////////////////////////
154 // Function: PGFrameStyle::clear_texture
155 // Access: Published
156 // Description: Removes the texture from the frame.
157 ////////////////////////////////////////////////////////////////////
158 INLINE void PGFrameStyle::
160  _texture.clear();
161 }
162 
163 ////////////////////////////////////////////////////////////////////
164 // Function: PGFrameStyle::set_width
165 // Access: Published
166 // Description: Sets the width parameter, which has meaning only for
167 // certain frame types. For instance, this is the width
168 // of the bevel for T_bevel_in or T_bevel_out. The
169 // units are in screen units.
170 ////////////////////////////////////////////////////////////////////
171 INLINE void PGFrameStyle::
172 set_width(PN_stdfloat x, PN_stdfloat y) {
173  set_width(LVecBase2(x, y));
174 }
175 
176 ////////////////////////////////////////////////////////////////////
177 // Function: PGFrameStyle::set_width
178 // Access: Published
179 // Description: Sets the width parameter, which has meaning only for
180 // certain frame types. For instance, this is the width
181 // of the bevel for T_bevel_in or T_bevel_out. The
182 // units are in screen units.
183 ////////////////////////////////////////////////////////////////////
184 INLINE void PGFrameStyle::
185 set_width(const LVecBase2 &width) {
186  _width = width;
187 }
188 
189 ////////////////////////////////////////////////////////////////////
190 // Function: PGFrameStyle::get_width
191 // Access: Published
192 // Description: Returns the width parameter, which has meaning only
193 // for certain frame types. For instance, this is the
194 // width of the bevel for T_bevel_in or T_bevel_out.
195 // The units are in screen units.
196 ////////////////////////////////////////////////////////////////////
197 INLINE const LVecBase2 &PGFrameStyle::
198 get_width() const {
199  return _width;
200 }
201 
202 ////////////////////////////////////////////////////////////////////
203 // Function: PGFrameStyle::set_uv_width
204 // Access: Published
205 // Description: Sets the uv_width parameter, which indicates the
206 // amount of the texture that is consumed by the inner
207 // bevel--the width in texture space of the amount
208 // indicated by set_width.
209 ////////////////////////////////////////////////////////////////////
210 INLINE void PGFrameStyle::
211 set_uv_width(PN_stdfloat u, PN_stdfloat v) {
212  set_uv_width(LVecBase2(u, v));
213 }
214 
215 ////////////////////////////////////////////////////////////////////
216 // Function: PGFrameStyle::set_uv_width
217 // Access: Published
218 // Description: Sets the uv_width parameter, which indicates the
219 // amount of the texture that is consumed by the inner
220 // bevel--the width in texture space of the amount
221 // indicated by set_width.
222 ////////////////////////////////////////////////////////////////////
223 INLINE void PGFrameStyle::
224 set_uv_width(const LVecBase2 &uv_width) {
225  _uv_width = uv_width;
226 }
227 
228 ////////////////////////////////////////////////////////////////////
229 // Function: PGFrameStyle::get_uv_width
230 // Access: Published
231 // Description: See set_uv_width().
232 ////////////////////////////////////////////////////////////////////
233 INLINE const LVecBase2 &PGFrameStyle::
234 get_uv_width() const {
235  return _uv_width;
236 }
237 
238 ////////////////////////////////////////////////////////////////////
239 // Function: PGFrameStyle::set_visible_scale
240 // Access: Published
241 // Description: Sets a scale factor on the visible representation of
242 // the frame, in the X and Y directions. If this scale
243 // factor is other than 1, it will affect the size of
244 // the visible frame representation within the actual
245 // frame border.
246 ////////////////////////////////////////////////////////////////////
247 INLINE void PGFrameStyle::
248 set_visible_scale(PN_stdfloat x, PN_stdfloat y) {
250 }
251 
252 ////////////////////////////////////////////////////////////////////
253 // Function: PGFrameStyle::set_visible_scale
254 // Access: Published
255 // Description: Sets a scale factor on the visible representation of
256 // the frame, in the X and Y directions. If this scale
257 // factor is other than 1, it will affect the size of
258 // the visible frame representation within the actual
259 // frame border.
260 ////////////////////////////////////////////////////////////////////
261 INLINE void PGFrameStyle::
262 set_visible_scale(const LVecBase2 &visible_scale) {
263  _visible_scale = visible_scale;
264 }
265 
266 ////////////////////////////////////////////////////////////////////
267 // Function: PGFrameStyle::get_visible_scale
268 // Access: Published
269 // Description: Returns the scale factor on the visible
270 // representation of the frame, in the X and Y
271 // directions. If this scale factor is other than 1, it
272 // will affect the size of the visible frame
273 // representation within the actual frame border.
274 ////////////////////////////////////////////////////////////////////
275 INLINE const LVecBase2 &PGFrameStyle::
277  return _visible_scale;
278 }
279 
280 ////////////////////////////////////////////////////////////////////
281 // Function: PGFrameStyle ostream output
282 // Description:
283 ////////////////////////////////////////////////////////////////////
284 INLINE ostream &
285 operator << (ostream &out, const PGFrameStyle &pfs) {
286  pfs.output(out);
287  return out;
288 }
void set_texture(Texture *texture)
Specifies a texture that should be applied to the frame.
Definition: pgFrameStyle.I:127
const LVecBase2 & get_uv_width() const
See set_uv_width().
Definition: pgFrameStyle.I:234
void set_visible_scale(PN_stdfloat x, PN_stdfloat y)
Sets a scale factor on the visible representation of the frame, in the X and Y directions.
Definition: pgFrameStyle.I:248
void set_width(PN_stdfloat x, PN_stdfloat y)
Sets the width parameter, which has meaning only for certain frame types.
Definition: pgFrameStyle.I:172
Type get_type() const
Returns the basic type of frame.
Definition: pgFrameStyle.I:86
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:75
void set_type(Type type)
Sets the basic type of frame.
Definition: pgFrameStyle.I:76
void set_uv_width(PN_stdfloat u, PN_stdfloat v)
Sets the uv_width parameter, which indicates the amount of the texture that is consumed by the inner ...
Definition: pgFrameStyle.I:211
bool has_texture() const
Returns true if a texture has been applied to the frame.
Definition: pgFrameStyle.I:138
LColor get_color() const
Returns the dominant color of the frame.
Definition: pgFrameStyle.I:116
const LVecBase2 & get_width() const
Returns the width parameter, which has meaning only for certain frame types.
Definition: pgFrameStyle.I:198
void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a)
Sets the dominant color of the frame.
Definition: pgFrameStyle.I:96
This is the base class for all two-component vectors and points.
Definition: lvecBase2.h:105
Texture * get_texture() const
Returns the texture that has been applied to the frame, or NULL if no texture has been applied...
Definition: pgFrameStyle.I:149
const LVecBase2 & get_visible_scale() const
Returns the scale factor on the visible representation of the frame, in the X and Y directions...
Definition: pgFrameStyle.I:276
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
void clear_texture()
Removes the texture from the frame.
Definition: pgFrameStyle.I:159