aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/lltextbox.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/llui/lltextbox.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/lltextbox.cpp95
1 files changed, 47 insertions, 48 deletions
diff --git a/linden/indra/llui/lltextbox.cpp b/linden/indra/llui/lltextbox.cpp
index 9ad7849..0f411b8 100644
--- a/linden/indra/llui/lltextbox.cpp
+++ b/linden/indra/llui/lltextbox.cpp
@@ -34,6 +34,8 @@
34#include "lluictrlfactory.h" 34#include "lluictrlfactory.h"
35#include "llfocusmgr.h" 35#include "llfocusmgr.h"
36 36
37static LLRegisterWidget<LLTextBox> r("text");
38
37LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& text, 39LLTextBox::LLTextBox(const LLString& name, const LLRect& rect, const LLString& text,
38 const LLFontGL* font, BOOL mouse_opaque) 40 const LLFontGL* font, BOOL mouse_opaque)
39: LLUICtrl(name, rect, mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ), 41: LLUICtrl(name, rect, mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ),
@@ -212,7 +214,7 @@ void LLTextBox::setLineLengths()
212 LLString::size_type cur = 0; 214 LLString::size_type cur = 0;
213 LLString::size_type len = mText.getWString().size(); 215 LLString::size_type len = mText.getWString().size();
214 216
215 while (cur < len) 217 while (cur < len)
216 { 218 {
217 LLString::size_type end = mText.getWString().find('\n', cur); 219 LLString::size_type end = mText.getWString().find('\n', cur);
218 LLString::size_type runLen; 220 LLString::size_type runLen;
@@ -323,63 +325,60 @@ BOOL LLTextBox::setTextArg( const LLString& key, const LLStringExplicit& text )
323 325
324void LLTextBox::draw() 326void LLTextBox::draw()
325{ 327{
326 if( getVisible() ) 328 if (mBorderVisible)
327 { 329 {
328 if (mBorderVisible) 330 gl_rect_2d_offset_local(getLocalRect(), 2, FALSE);
329 { 331 }
330 gl_rect_2d_offset_local(getLocalRect(), 2, FALSE);
331 }
332 332
333 if( mBorderDropShadowVisible ) 333 if( mBorderDropShadowVisible )
334 { 334 {
335 static LLColor4 color_drop_shadow = LLUI::sColorsGroup->getColor("ColorDropShadow"); 335 static LLColor4 color_drop_shadow = LLUI::sColorsGroup->getColor("ColorDropShadow");
336 static S32 drop_shadow_tooltip = LLUI::sConfigGroup->getS32("DropShadowTooltip"); 336 static S32 drop_shadow_tooltip = LLUI::sConfigGroup->getS32("DropShadowTooltip");
337 gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0, 337 gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
338 color_drop_shadow, drop_shadow_tooltip); 338 color_drop_shadow, drop_shadow_tooltip);
339 } 339 }
340
341 if (mBackgroundVisible)
342 {
343 LLRect r( 0, getRect().getHeight(), getRect().getWidth(), 0 );
344 gl_rect_2d( r, mBackgroundColor );
345 }
346 340
347 S32 text_x = 0; 341 if (mBackgroundVisible)
348 switch( mHAlign ) 342 {
349 { 343 LLRect r( 0, getRect().getHeight(), getRect().getWidth(), 0 );
350 case LLFontGL::LEFT: 344 gl_rect_2d( r, mBackgroundColor );
351 text_x = mHPad; 345 }
352 break;
353 case LLFontGL::HCENTER:
354 text_x = getRect().getWidth() / 2;
355 break;
356 case LLFontGL::RIGHT:
357 text_x = getRect().getWidth() - mHPad;
358 break;
359 }
360 346
361 S32 text_y = getRect().getHeight() - mVPad; 347 S32 text_x = 0;
348 switch( mHAlign )
349 {
350 case LLFontGL::LEFT:
351 text_x = mHPad;
352 break;
353 case LLFontGL::HCENTER:
354 text_x = getRect().getWidth() / 2;
355 break;
356 case LLFontGL::RIGHT:
357 text_x = getRect().getWidth() - mHPad;
358 break;
359 }
362 360
363 if ( getEnabled() ) 361 S32 text_y = getRect().getHeight() - mVPad;
362
363 if ( getEnabled() )
364 {
365 if(mHasHover)
364 { 366 {
365 if(mHasHover) 367 drawText( text_x, text_y, mHoverColor );
366 {
367 drawText( text_x, text_y, mHoverColor );
368 }
369 else
370 {
371 drawText( text_x, text_y, mTextColor );
372 }
373 } 368 }
374 else 369 else
375 { 370 {
376 drawText( text_x, text_y, mDisabledColor ); 371 drawText( text_x, text_y, mTextColor );
377 } 372 }
373 }
374 else
375 {
376 drawText( text_x, text_y, mDisabledColor );
377 }
378 378
379 if (sDebugRects) 379 if (sDebugRects)
380 { 380 {
381 drawDebugRect(); 381 drawDebugRect();
382 }
383 } 382 }
384 383
385 mHasHover = FALSE; // This is reset every frame. 384 mHasHover = FALSE; // This is reset every frame.