aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llscrollbar.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/llscrollbar.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/llscrollbar.cpp48
1 files changed, 21 insertions, 27 deletions
diff --git a/linden/indra/llui/llscrollbar.cpp b/linden/indra/llui/llscrollbar.cpp
index ec46551..cf64742 100644
--- a/linden/indra/llui/llscrollbar.cpp
+++ b/linden/indra/llui/llscrollbar.cpp
@@ -46,6 +46,7 @@
46#include "llwindow.h" 46#include "llwindow.h"
47#include "llglheaders.h" 47#include "llglheaders.h"
48#include "llcontrol.h" 48#include "llcontrol.h"
49#include "llglimmediate.h"
49 50
50LLScrollbar::LLScrollbar( 51LLScrollbar::LLScrollbar(
51 const LLString& name, LLRect rect, 52 const LLString& name, LLRect rect,
@@ -92,7 +93,7 @@ LLScrollbar::LLScrollbar(
92 93
93 if( LLScrollbar::VERTICAL == mOrientation ) 94 if( LLScrollbar::VERTICAL == mOrientation )
94 { 95 {
95 line_up_rect.setLeftTopAndSize( 0, mRect.getHeight(), SCROLLBAR_SIZE, SCROLLBAR_SIZE ); 96 line_up_rect.setLeftTopAndSize( 0, getRect().getHeight(), SCROLLBAR_SIZE, SCROLLBAR_SIZE );
96 line_up_img="UIImgBtnScrollUpOutUUID"; 97 line_up_img="UIImgBtnScrollUpOutUUID";
97 line_up_selected_img="UIImgBtnScrollUpInUUID"; 98 line_up_selected_img="UIImgBtnScrollUpInUUID";
98 99
@@ -107,7 +108,7 @@ LLScrollbar::LLScrollbar(
107 line_up_img="UIImgBtnScrollLeftOutUUID"; 108 line_up_img="UIImgBtnScrollLeftOutUUID";
108 line_up_selected_img="UIImgBtnScrollLeftInUUID"; 109 line_up_selected_img="UIImgBtnScrollLeftInUUID";
109 110
110 line_down_rect.setOriginAndSize( mRect.getWidth() - SCROLLBAR_SIZE, 0, SCROLLBAR_SIZE, SCROLLBAR_SIZE ); 111 line_down_rect.setOriginAndSize( getRect().getWidth() - SCROLLBAR_SIZE, 0, SCROLLBAR_SIZE, SCROLLBAR_SIZE );
111 line_down_img="UIImgBtnScrollRightOutUUID"; 112 line_down_img="UIImgBtnScrollRightOutUUID";
112 line_down_selected_img="UIImgBtnScrollRightInUUID"; 113 line_down_selected_img="UIImgBtnScrollRightInUUID";
113 } 114 }
@@ -210,7 +211,7 @@ void LLScrollbar::updateThumbRect()
210 211
211 const S32 THUMB_MIN_LENGTH = 16; 212 const S32 THUMB_MIN_LENGTH = 16;
212 213
213 S32 window_length = (mOrientation == LLScrollbar::HORIZONTAL) ? mRect.getWidth() : mRect.getHeight(); 214 S32 window_length = (mOrientation == LLScrollbar::HORIZONTAL) ? getRect().getWidth() : getRect().getHeight();
214 S32 thumb_bg_length = window_length - 2 * SCROLLBAR_SIZE; 215 S32 thumb_bg_length = window_length - 2 * SCROLLBAR_SIZE;
215 S32 visible_lines = llmin( mDocSize, mPageSize ); 216 S32 visible_lines = llmin( mDocSize, mPageSize );
216 S32 thumb_length = mDocSize ? llmax( visible_lines * thumb_bg_length / mDocSize, THUMB_MIN_LENGTH ) : thumb_bg_length; 217 S32 thumb_length = mDocSize ? llmax( visible_lines * thumb_bg_length / mDocSize, THUMB_MIN_LENGTH ) : thumb_bg_length;
@@ -300,8 +301,8 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask)
300 BOOL handled = FALSE; 301 BOOL handled = FALSE;
301 if( hasMouseCapture() ) 302 if( hasMouseCapture() )
302 { 303 {
303 S32 height = mRect.getHeight(); 304 S32 height = getRect().getHeight();
304 S32 width = mRect.getWidth(); 305 S32 width = getRect().getWidth();
305 306
306 if( VERTICAL == mOrientation ) 307 if( VERTICAL == mOrientation )
307 { 308 {
@@ -408,13 +409,13 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask)
408 409
409 mDocChanged = FALSE; 410 mDocChanged = FALSE;
410 return handled; 411 return handled;
411} 412} // end handleHover
412 413
413 414
414BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks) 415BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks)
415{ 416{
416 BOOL handled = FALSE; 417 BOOL handled = FALSE;
417 if( getVisible() && mRect.localPointInRect( x, y ) ) 418 if( getVisible() && getRect().localPointInRect( x, y ) )
418 { 419 {
419 if( getEnabled() ) 420 if( getEnabled() )
420 { 421 {
@@ -427,7 +428,7 @@ BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks)
427} 428}
428 429
429BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, 430BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
430 EDragAndDropType cargo_type, void *carge_data, EAcceptance *accept, LLString &tooltip_msg) 431 EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, LLString &tooltip_msg)
431{ 432{
432 // enable this to get drag and drop to control scrollbars 433 // enable this to get drag and drop to control scrollbars
433 //if (!drop) 434 //if (!drop)
@@ -436,7 +437,7 @@ BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
436 // S32 variable_lines = getDocPosMax(); 437 // S32 variable_lines = getDocPosMax();
437 // S32 pos = (VERTICAL == mOrientation) ? y : x; 438 // S32 pos = (VERTICAL == mOrientation) ? y : x;
438 // S32 thumb_length = (VERTICAL == mOrientation) ? mThumbRect.getHeight() : mThumbRect.getWidth(); 439 // S32 thumb_length = (VERTICAL == mOrientation) ? mThumbRect.getHeight() : mThumbRect.getWidth();
439 // S32 thumb_track_length = (VERTICAL == mOrientation) ? (mRect.getHeight() - 2 * SCROLLBAR_SIZE) : (mRect.getWidth() - 2 * SCROLLBAR_SIZE); 440 // S32 thumb_track_length = (VERTICAL == mOrientation) ? (getRect().getHeight() - 2 * SCROLLBAR_SIZE) : (getRect().getWidth() - 2 * SCROLLBAR_SIZE);
440 // S32 usable_track_length = thumb_track_length - thumb_length; 441 // S32 usable_track_length = thumb_track_length - thumb_length;
441 // F32 ratio = (VERTICAL == mOrientation) ? F32(pos - SCROLLBAR_SIZE - thumb_length) / usable_track_length 442 // F32 ratio = (VERTICAL == mOrientation) ? F32(pos - SCROLLBAR_SIZE - thumb_length) / usable_track_length
442 // : F32(pos - SCROLLBAR_SIZE) / usable_track_length; 443 // : F32(pos - SCROLLBAR_SIZE) / usable_track_length;
@@ -485,7 +486,7 @@ void LLScrollbar::draw()
485 486
486 screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &local_mouse_x, &local_mouse_y); 487 screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &local_mouse_x, &local_mouse_y);
487 BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this; 488 BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this;
488 BOOL hovered = mEnabled && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); 489 BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
489 if (hovered) 490 if (hovered)
490 { 491 {
491 mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f)); 492 mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f));
@@ -504,8 +505,8 @@ void LLScrollbar::draw()
504 if (!rounded_rect_imagep) 505 if (!rounded_rect_imagep)
505 { 506 {
506 gl_rect_2d(mOrientation == HORIZONTAL ? SCROLLBAR_SIZE : 0, 507 gl_rect_2d(mOrientation == HORIZONTAL ? SCROLLBAR_SIZE : 0,
507 mOrientation == VERTICAL ? mRect.getHeight() - 2 * SCROLLBAR_SIZE : mRect.getHeight(), 508 mOrientation == VERTICAL ? getRect().getHeight() - 2 * SCROLLBAR_SIZE : getRect().getHeight(),
508 mOrientation == HORIZONTAL ? mRect.getWidth() - 2 * SCROLLBAR_SIZE : mRect.getWidth(), 509 mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * SCROLLBAR_SIZE : getRect().getWidth(),
509 mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0, mTrackColor, TRUE); 510 mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0, mTrackColor, TRUE);
510 511
511 gl_rect_2d(mThumbRect, mThumbColor, TRUE); 512 gl_rect_2d(mThumbRect, mThumbColor, TRUE);
@@ -518,8 +519,8 @@ void LLScrollbar::draw()
518 mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0, 519 mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0,
519 16, 520 16,
520 16, 521 16,
521 mOrientation == HORIZONTAL ? mRect.getWidth() - 2 * SCROLLBAR_SIZE : mRect.getWidth(), 522 mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * SCROLLBAR_SIZE : getRect().getWidth(),
522 mOrientation == VERTICAL ? mRect.getHeight() - 2 * SCROLLBAR_SIZE : mRect.getHeight(), 523 mOrientation == VERTICAL ? getRect().getHeight() - 2 * SCROLLBAR_SIZE : getRect().getHeight(),
523 rounded_rect_imagep, 524 rounded_rect_imagep,
524 mTrackColor, 525 mTrackColor,
525 TRUE); 526 TRUE);
@@ -538,10 +539,10 @@ void LLScrollbar::draw()
538 rounded_rect_imagep, mThumbColor ); 539 rounded_rect_imagep, mThumbColor );
539 if (mCurGlowStrength > 0.01f) 540 if (mCurGlowStrength > 0.01f)
540 { 541 {
541 glBlendFunc(GL_SRC_ALPHA, GL_ONE); 542 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE);
542 gl_draw_scaled_image_with_border(mThumbRect.mLeft, mThumbRect.mBottom, 16, 16, mThumbRect.getWidth(), mThumbRect.getHeight(), 543 gl_draw_scaled_image_with_border(mThumbRect.mLeft, mThumbRect.mBottom, 16, 16, mThumbRect.getWidth(), mThumbRect.getHeight(),
543 rounded_rect_imagep, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength), TRUE); 544 rounded_rect_imagep, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength), TRUE);
544 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 545 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
545 } 546 }
546 } 547 }
547 548
@@ -553,7 +554,8 @@ void LLScrollbar::draw()
553 // Draw children 554 // Draw children
554 LLView::draw(); 555 LLView::draw();
555 } 556 }
556} 557} // end draw
558
557 559
558void LLScrollbar::changeLine( S32 delta, BOOL update_thumb ) 560void LLScrollbar::changeLine( S32 delta, BOOL update_thumb )
559{ 561{
@@ -579,21 +581,12 @@ void LLScrollbar::setValue(const LLSD& value)
579 setDocPos((S32) value.asInteger()); 581 setDocPos((S32) value.asInteger());
580} 582}
581 583
582EWidgetType LLScrollbar::getWidgetType() const
583{
584 return WIDGET_TYPE_SCROLLBAR;
585}
586
587LLString LLScrollbar::getWidgetTag() const
588{
589 return LL_SCROLLBAR_TAG;
590}
591 584
592BOOL LLScrollbar::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) 585BOOL LLScrollbar::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
593{ 586{
594 BOOL handled = FALSE; 587 BOOL handled = FALSE;
595 588
596 if( getVisible() && mEnabled && !called_from_parent ) 589 if( getVisible() && getEnabled() && !called_from_parent )
597 { 590 {
598 switch( key ) 591 switch( key )
599 { 592 {
@@ -661,3 +654,4 @@ void LLScrollbar::onLineDownBtnPressed( void* userdata )
661 self->changeLine( self->mStepSize, TRUE ); 654 self->changeLine( self->mStepSize, TRUE );
662} 655}
663 656
657