aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llviewborder.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llui/llviewborder.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/llviewborder.cpp96
1 files changed, 32 insertions, 64 deletions
diff --git a/linden/indra/llui/llviewborder.cpp b/linden/indra/llui/llviewborder.cpp
index b70edec..6c2d9fa 100644
--- a/linden/indra/llui/llviewborder.cpp
+++ b/linden/indra/llui/llviewborder.cpp
@@ -1,6 +1,5 @@
1/** 1/**
2 * @file llviewborder.cpp 2 * @file llviewborder.cpp
3 * @brief LLViewBorder base class
4 * 3 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$ 4 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 * 5 *
@@ -29,19 +28,9 @@
29 * $/LicenseInfo$ 28 * $/LicenseInfo$
30 */ 29 */
31 30
32// A customizable decorative border. Does not interact with mouse events.
33
34#include "linden_common.h" 31#include "linden_common.h"
35
36#include "llviewborder.h" 32#include "llviewborder.h"
37 33#include "llglimmediate.h"
38#include "llgl.h"
39#include "llui.h"
40#include "llimagegl.h"
41//#include "llviewerimagelist.h"
42#include "llcontrol.h"
43#include "llglheaders.h"
44#include "v2math.h"
45#include "llfocusmgr.h" 34#include "llfocusmgr.h"
46 35
47LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bevel, EStyle style, S32 width ) 36LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bevel, EStyle style, S32 width )
@@ -53,7 +42,6 @@ LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bev
53 mHighlightDark( LLUI::sColorsGroup->getColor( "DefaultHighlightDark" ) ), 42 mHighlightDark( LLUI::sColorsGroup->getColor( "DefaultHighlightDark" ) ),
54 mShadowLight( LLUI::sColorsGroup->getColor( "DefaultShadowLight" ) ), 43 mShadowLight( LLUI::sColorsGroup->getColor( "DefaultShadowLight" ) ),
55 mShadowDark( LLUI::sColorsGroup->getColor( "DefaultShadowDark" ) ), 44 mShadowDark( LLUI::sColorsGroup->getColor( "DefaultShadowDark" ) ),
56// mKeyboardFocusColor(LLUI::sColorsGroup->getColor( "FocusColor" ) ),
57 mBorderWidth( width ), 45 mBorderWidth( width ),
58 mTexture( NULL ), 46 mTexture( NULL ),
59 mHasKeyboardFocus( FALSE ) 47 mHasKeyboardFocus( FALSE )
@@ -61,12 +49,6 @@ LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bev
61 setFollowsAll(); 49 setFollowsAll();
62} 50}
63 51
64// virtual
65BOOL LLViewBorder::isCtrl() const
66{
67 return FALSE;
68}
69
70void LLViewBorder::setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light ) 52void LLViewBorder::setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light )
71{ 53{
72 mShadowDark = shadow_dark; 54 mShadowDark = shadow_dark;
@@ -160,15 +142,15 @@ void LLViewBorder::drawOnePixelLines()
160 } 142 }
161 143
162 S32 left = 0; 144 S32 left = 0;
163 S32 top = mRect.getHeight(); 145 S32 top = getRect().getHeight();
164 S32 right = mRect.getWidth(); 146 S32 right = getRect().getWidth();
165 S32 bottom = 0; 147 S32 bottom = 0;
166 148
167 glColor4fv( top_color.mV ); 149 gGL.color4fv( top_color.mV );
168 gl_line_2d(left, bottom, left, top); 150 gl_line_2d(left, bottom, left, top);
169 gl_line_2d(left, top, right, top); 151 gl_line_2d(left, top, right, top);
170 152
171 glColor4fv( bottom_color.mV ); 153 gGL.color4fv( bottom_color.mV );
172 gl_line_2d(right, top, right, bottom); 154 gl_line_2d(right, top, right, bottom);
173 gl_line_2d(left, bottom, right, bottom); 155 gl_line_2d(left, bottom, right, bottom);
174 156
@@ -219,24 +201,24 @@ void LLViewBorder::drawTwoPixelLines()
219 } 201 }
220 202
221 S32 left = 0; 203 S32 left = 0;
222 S32 top = mRect.getHeight(); 204 S32 top = getRect().getHeight();
223 S32 right = mRect.getWidth(); 205 S32 right = getRect().getWidth();
224 S32 bottom = 0; 206 S32 bottom = 0;
225 207
226 // draw borders 208 // draw borders
227 glColor3fv( top_out_color ); 209 gGL.color3fv( top_out_color );
228 gl_line_2d(left, bottom, left, top-1); 210 gl_line_2d(left, bottom, left, top-1);
229 gl_line_2d(left, top-1, right, top-1); 211 gl_line_2d(left, top-1, right, top-1);
230 212
231 glColor3fv( top_in_color ); 213 gGL.color3fv( top_in_color );
232 gl_line_2d(left+1, bottom+1, left+1, top-2); 214 gl_line_2d(left+1, bottom+1, left+1, top-2);
233 gl_line_2d(left+1, top-2, right-1, top-2); 215 gl_line_2d(left+1, top-2, right-1, top-2);
234 216
235 glColor3fv( bottom_out_color ); 217 gGL.color3fv( bottom_out_color );
236 gl_line_2d(right-1, top-1, right-1, bottom); 218 gl_line_2d(right-1, top-1, right-1, bottom);
237 gl_line_2d(left, bottom, right, bottom); 219 gl_line_2d(left, bottom, right, bottom);
238 220
239 glColor3fv( bottom_in_color ); 221 gGL.color3fv( bottom_in_color );
240 gl_line_2d(right-2, top-2, right-2, bottom+1); 222 gl_line_2d(right-2, top-2, right-2, bottom+1);
241 gl_line_2d(left+1, bottom+1, right-1, bottom+1); 223 gl_line_2d(left+1, bottom+1, right-1, bottom+1);
242} 224}
@@ -247,27 +229,27 @@ void LLViewBorder::drawTextures()
247 229
248 llassert( FALSE ); // TODO: finish implementing 230 llassert( FALSE ); // TODO: finish implementing
249 231
250 glColor4fv(UI_VERTEX_COLOR.mV); 232 gGL.color4fv(UI_VERTEX_COLOR.mV);
251 233
252 mTexture->bind(); 234 mTexture->bind();
253 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); 235 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
254 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); 236 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
255 237
256 drawTextureTrapezoid( 0.f, mBorderWidth, mRect.getWidth(), 0, 0 ); 238 drawTextureTrapezoid( 0.f, mBorderWidth, getRect().getWidth(), 0, 0 );
257 drawTextureTrapezoid( 90.f, mBorderWidth, mRect.getHeight(), (F32)mRect.getWidth(),0 ); 239 drawTextureTrapezoid( 90.f, mBorderWidth, getRect().getHeight(), (F32)getRect().getWidth(),0 );
258 drawTextureTrapezoid( 180.f, mBorderWidth, mRect.getWidth(), (F32)mRect.getWidth(),(F32)mRect.getHeight() ); 240 drawTextureTrapezoid( 180.f, mBorderWidth, getRect().getWidth(), (F32)getRect().getWidth(),(F32)getRect().getHeight() );
259 drawTextureTrapezoid( 270.f, mBorderWidth, mRect.getHeight(), 0, (F32)mRect.getHeight() ); 241 drawTextureTrapezoid( 270.f, mBorderWidth, getRect().getHeight(), 0, (F32)getRect().getHeight() );
260} 242}
261 243
262 244
263void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y ) 245void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y )
264{ 246{
265 glPushMatrix(); 247 gGL.pushMatrix();
266 { 248 {
267 glTranslatef(start_x, start_y, 0.f); 249 gGL.translatef(start_x, start_y, 0.f);
268 glRotatef( degrees, 0, 0, 1 ); 250 glRotatef( degrees, 0, 0, 1 );
269 251
270 glBegin(GL_QUADS); 252 gGL.begin(GL_QUADS);
271 { 253 {
272 // width, width /---------\ length-width, width // 254 // width, width /---------\ length-width, width //
273 // / \ // 255 // / \ //
@@ -275,24 +257,24 @@ void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32
275 // /---------------\ // 257 // /---------------\ //
276 // 0,0 length, 0 // 258 // 0,0 length, 0 //
277 259
278 glTexCoord2f( 0, 0 ); 260 gGL.texCoord2f( 0, 0 );
279 glVertex2i( 0, 0 ); 261 gGL.vertex2i( 0, 0 );
280 262
281 glTexCoord2f( (GLfloat)length, 0 ); 263 gGL.texCoord2f( (GLfloat)length, 0 );
282 glVertex2i( length, 0 ); 264 gGL.vertex2i( length, 0 );
283 265
284 glTexCoord2f( (GLfloat)(length - width), (GLfloat)width ); 266 gGL.texCoord2f( (GLfloat)(length - width), (GLfloat)width );
285 glVertex2i( length - width, width ); 267 gGL.vertex2i( length - width, width );
286 268
287 glTexCoord2f( (GLfloat)width, (GLfloat)width ); 269 gGL.texCoord2f( (GLfloat)width, (GLfloat)width );
288 glVertex2i( width, width ); 270 gGL.vertex2i( width, width );
289 } 271 }
290 glEnd(); 272 gGL.end();
291 } 273 }
292 glPopMatrix(); 274 gGL.popMatrix();
293} 275}
294 276
295bool LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style) 277BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style)
296{ 278{
297 if (node->hasAttribute("bevel_style")) 279 if (node->hasAttribute("bevel_style"))
298 { 280 {
@@ -316,25 +298,11 @@ bool LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel
316 { 298 {
317 bevel_style = LLViewBorder::BEVEL_BRIGHT; 299 bevel_style = LLViewBorder::BEVEL_BRIGHT;
318 } 300 }
319 return true; 301 return TRUE;
320 } 302 }
321 return false; 303 return FALSE;
322}
323
324void LLViewBorder::setValue(const LLSD& val)
325{
326 setRect(LLRect(val));
327}
328
329EWidgetType LLViewBorder::getWidgetType() const
330{
331 return WIDGET_TYPE_VIEW_BORDER;
332} 304}
333 305
334LLString LLViewBorder::getWidgetTag() const
335{
336 return LL_VIEW_BORDER_TAG;
337}
338 306
339// static 307// static
340LLView* LLViewBorder::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) 308LLView* LLViewBorder::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)