Panda3D
|
00001 // Filename: pgFrameStyle.I 00002 // Created by: drose (03Jul01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: PGFrameStyle::Constructor 00018 // Access: Published 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE PGFrameStyle:: 00022 PGFrameStyle() { 00023 _type = T_none; 00024 _color.set(1.0f, 1.0f, 1.0f, 1.0f); 00025 _width.set(0.1f, 0.1f); 00026 _uv_width.set(0.1f, 0.1f); 00027 _visible_scale.set(1.0f, 1.0f); 00028 } 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Function: PGFrameStyle::Copy Constructor 00032 // Access: Published 00033 // Description: 00034 //////////////////////////////////////////////////////////////////// 00035 INLINE PGFrameStyle:: 00036 PGFrameStyle(const PGFrameStyle ©) : 00037 _type(copy._type), 00038 _color(copy._color), 00039 _texture(copy._texture), 00040 _width(copy._width), 00041 _uv_width(copy._uv_width), 00042 _visible_scale(copy._visible_scale) 00043 { 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: PGFrameStyle::Copy Assignment Operator 00048 // Access: Published 00049 // Description: 00050 //////////////////////////////////////////////////////////////////// 00051 INLINE void PGFrameStyle:: 00052 operator = (const PGFrameStyle ©) { 00053 _type = copy._type; 00054 _color = copy._color; 00055 _texture = copy._texture; 00056 _width = copy._width; 00057 _uv_width = copy._uv_width; 00058 _visible_scale = copy._visible_scale; 00059 } 00060 00061 //////////////////////////////////////////////////////////////////// 00062 // Function: PGFrameStyle::Destructor 00063 // Access: Published 00064 // Description: 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE PGFrameStyle:: 00067 ~PGFrameStyle() { 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: PGFrameStyle::set_type 00072 // Access: Published 00073 // Description: Sets the basic type of frame. 00074 //////////////////////////////////////////////////////////////////// 00075 INLINE void PGFrameStyle:: 00076 set_type(PGFrameStyle::Type type) { 00077 _type = type; 00078 } 00079 00080 //////////////////////////////////////////////////////////////////// 00081 // Function: PGFrameStyle::get_type 00082 // Access: Published 00083 // Description: Returns the basic type of frame. 00084 //////////////////////////////////////////////////////////////////// 00085 INLINE PGFrameStyle::Type PGFrameStyle:: 00086 get_type() const { 00087 return _type; 00088 } 00089 00090 //////////////////////////////////////////////////////////////////// 00091 // Function: PGFrameStyle::set_color 00092 // Access: Published 00093 // Description: Sets the dominant color of the frame. 00094 //////////////////////////////////////////////////////////////////// 00095 INLINE void PGFrameStyle:: 00096 set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) { 00097 set_color(LColor(r, g, b, a)); 00098 } 00099 00100 //////////////////////////////////////////////////////////////////// 00101 // Function: PGFrameStyle::set_color 00102 // Access: Published 00103 // Description: Sets the dominant color of the frame. 00104 //////////////////////////////////////////////////////////////////// 00105 INLINE void PGFrameStyle:: 00106 set_color(const LColor &color) { 00107 _color = color; 00108 } 00109 00110 //////////////////////////////////////////////////////////////////// 00111 // Function: PGFrameStyle::set_color 00112 // Access: Published 00113 // Description: Returns the dominant color of the frame. 00114 //////////////////////////////////////////////////////////////////// 00115 INLINE LColor PGFrameStyle:: 00116 get_color() const { 00117 return _color; 00118 } 00119 00120 //////////////////////////////////////////////////////////////////// 00121 // Function: PGFrameStyle::set_texture 00122 // Access: Published 00123 // Description: Specifies a texture that should be applied to the 00124 // frame. 00125 //////////////////////////////////////////////////////////////////// 00126 INLINE void PGFrameStyle:: 00127 set_texture(Texture *texture) { 00128 _texture = texture; 00129 } 00130 00131 //////////////////////////////////////////////////////////////////// 00132 // Function: PGFrameStyle::has_texture 00133 // Access: Published 00134 // Description: Returns true if a texture has been applied to the 00135 // frame. 00136 //////////////////////////////////////////////////////////////////// 00137 INLINE bool PGFrameStyle:: 00138 has_texture() const { 00139 return !_texture.is_null(); 00140 } 00141 00142 //////////////////////////////////////////////////////////////////// 00143 // Function: PGFrameStyle::get_texture 00144 // Access: Published 00145 // Description: Returns the texture that has been applied to the 00146 // frame, or NULL if no texture has been applied. 00147 //////////////////////////////////////////////////////////////////// 00148 INLINE Texture *PGFrameStyle:: 00149 get_texture() const { 00150 return _texture; 00151 } 00152 00153 //////////////////////////////////////////////////////////////////// 00154 // Function: PGFrameStyle::clear_texture 00155 // Access: Published 00156 // Description: Removes the texture from the frame. 00157 //////////////////////////////////////////////////////////////////// 00158 INLINE void PGFrameStyle:: 00159 clear_texture() { 00160 _texture.clear(); 00161 } 00162 00163 //////////////////////////////////////////////////////////////////// 00164 // Function: PGFrameStyle::set_width 00165 // Access: Published 00166 // Description: Sets the width parameter, which has meaning only for 00167 // certain frame types. For instance, this is the width 00168 // of the bevel for T_bevel_in or T_bevel_out. The 00169 // units are in screen units. 00170 //////////////////////////////////////////////////////////////////// 00171 INLINE void PGFrameStyle:: 00172 set_width(PN_stdfloat x, PN_stdfloat y) { 00173 set_width(LVecBase2(x, y)); 00174 } 00175 00176 //////////////////////////////////////////////////////////////////// 00177 // Function: PGFrameStyle::set_width 00178 // Access: Published 00179 // Description: Sets the width parameter, which has meaning only for 00180 // certain frame types. For instance, this is the width 00181 // of the bevel for T_bevel_in or T_bevel_out. The 00182 // units are in screen units. 00183 //////////////////////////////////////////////////////////////////// 00184 INLINE void PGFrameStyle:: 00185 set_width(const LVecBase2 &width) { 00186 _width = width; 00187 } 00188 00189 //////////////////////////////////////////////////////////////////// 00190 // Function: PGFrameStyle::get_width 00191 // Access: Published 00192 // Description: Returns the width parameter, which has meaning only 00193 // for certain frame types. For instance, this is the 00194 // width of the bevel for T_bevel_in or T_bevel_out. 00195 // The units are in screen units. 00196 //////////////////////////////////////////////////////////////////// 00197 INLINE const LVecBase2 &PGFrameStyle:: 00198 get_width() const { 00199 return _width; 00200 } 00201 00202 //////////////////////////////////////////////////////////////////// 00203 // Function: PGFrameStyle::set_uv_width 00204 // Access: Published 00205 // Description: Sets the uv_width parameter, which indicates the 00206 // amount of the texture that is consumed by the inner 00207 // bevel--the width in texture space of the amount 00208 // indicated by set_width. 00209 //////////////////////////////////////////////////////////////////// 00210 INLINE void PGFrameStyle:: 00211 set_uv_width(PN_stdfloat u, PN_stdfloat v) { 00212 set_uv_width(LVecBase2(u, v)); 00213 } 00214 00215 //////////////////////////////////////////////////////////////////// 00216 // Function: PGFrameStyle::set_uv_width 00217 // Access: Published 00218 // Description: Sets the uv_width parameter, which indicates the 00219 // amount of the texture that is consumed by the inner 00220 // bevel--the width in texture space of the amount 00221 // indicated by set_width. 00222 //////////////////////////////////////////////////////////////////// 00223 INLINE void PGFrameStyle:: 00224 set_uv_width(const LVecBase2 &uv_width) { 00225 _uv_width = uv_width; 00226 } 00227 00228 //////////////////////////////////////////////////////////////////// 00229 // Function: PGFrameStyle::get_uv_width 00230 // Access: Published 00231 // Description: See set_uv_width(). 00232 //////////////////////////////////////////////////////////////////// 00233 INLINE const LVecBase2 &PGFrameStyle:: 00234 get_uv_width() const { 00235 return _uv_width; 00236 } 00237 00238 //////////////////////////////////////////////////////////////////// 00239 // Function: PGFrameStyle::set_visible_scale 00240 // Access: Published 00241 // Description: Sets a scale factor on the visible representation of 00242 // the frame, in the X and Y directions. If this scale 00243 // factor is other than 1, it will affect the size of 00244 // the visible frame representation within the actual 00245 // frame border. 00246 //////////////////////////////////////////////////////////////////// 00247 INLINE void PGFrameStyle:: 00248 set_visible_scale(PN_stdfloat x, PN_stdfloat y) { 00249 set_visible_scale(LVecBase2(x, y)); 00250 } 00251 00252 //////////////////////////////////////////////////////////////////// 00253 // Function: PGFrameStyle::set_visible_scale 00254 // Access: Published 00255 // Description: Sets a scale factor on the visible representation of 00256 // the frame, in the X and Y directions. If this scale 00257 // factor is other than 1, it will affect the size of 00258 // the visible frame representation within the actual 00259 // frame border. 00260 //////////////////////////////////////////////////////////////////// 00261 INLINE void PGFrameStyle:: 00262 set_visible_scale(const LVecBase2 &visible_scale) { 00263 _visible_scale = visible_scale; 00264 } 00265 00266 //////////////////////////////////////////////////////////////////// 00267 // Function: PGFrameStyle::get_visible_scale 00268 // Access: Published 00269 // Description: Returns the scale factor on the visible 00270 // representation of the frame, in the X and Y 00271 // directions. If this scale factor is other than 1, it 00272 // will affect the size of the visible frame 00273 // representation within the actual frame border. 00274 //////////////////////////////////////////////////////////////////// 00275 INLINE const LVecBase2 &PGFrameStyle:: 00276 get_visible_scale() const { 00277 return _visible_scale; 00278 } 00279 00280 //////////////////////////////////////////////////////////////////// 00281 // Function: PGFrameStyle ostream output 00282 // Description: 00283 //////////////////////////////////////////////////////////////////// 00284 INLINE ostream & 00285 operator << (ostream &out, const PGFrameStyle &pfs) { 00286 pfs.output(out); 00287 return out; 00288 }