diff options
Diffstat (limited to 'indra/llui/llscrollbar.cpp')
-rw-r--r-- | indra/llui/llscrollbar.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index fda4a750cd..d0eec387bd 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -73,7 +73,7 @@ LLScrollbar::LLScrollbar(const Params & p) mDocPos( p.doc_pos ), mPageSize( p.page_size ), mStepSize( p.step_size ), - mDocChanged(FALSE), + mDocChanged(false), mDragStartX( 0 ), mDragStartY( 0 ), mHoverGlowStrength(0.15f), @@ -113,7 +113,8 @@ LLScrollbar::LLScrollbar(const Params & p) up_btn.tab_stop(false); up_btn.follows.flags = (mOrientation == VERTICAL ? (FOLLOWS_RIGHT | FOLLOWS_TOP) : (FOLLOWS_LEFT | FOLLOWS_BOTTOM)); - addChild(LLUICtrlFactory::create<LLButton>(up_btn)); + mLineUpBtn = LLUICtrlFactory::create<LLButton>(up_btn); + addChild(mLineUpBtn); LLButton::Params down_btn(mOrientation == VERTICAL ? p.down_button : p.right_button); down_btn.name(std::string("Line Down")); @@ -123,7 +124,8 @@ LLScrollbar::LLScrollbar(const Params & p) down_btn.mouse_held_callback.function(boost::bind(&LLScrollbar::onLineDownBtnPressed, this, _2)); down_btn.tab_stop(false); - addChild(LLUICtrlFactory::create<LLButton>(down_btn)); + mLineDownBtn = LLUICtrlFactory::create<LLButton>(down_btn); + addChild(mLineDownBtn); } @@ -136,19 +138,19 @@ void LLScrollbar::setDocParams( S32 size, S32 pos ) { mDocSize = size; setDocPos(pos); - mDocChanged = TRUE; + mDocChanged = true; updateThumbRect(); } // returns true if document position really changed -bool LLScrollbar::setDocPos(S32 pos, BOOL update_thumb) +bool LLScrollbar::setDocPos(S32 pos, bool update_thumb) { pos = llclamp(pos, 0, getDocPosMax()); if (pos != mDocPos) { mDocPos = pos; - mDocChanged = TRUE; + mDocChanged = true; if( mChangeCallback ) { @@ -170,7 +172,7 @@ void LLScrollbar::setDocSize(S32 size) { mDocSize = size; setDocPos(mDocPos); - mDocChanged = TRUE; + mDocChanged = true; updateThumbRect(); } @@ -182,7 +184,7 @@ void LLScrollbar::setPageSize( S32 page_size ) { mPageSize = page_size; setDocPos(mDocPos); - mDocChanged = TRUE; + mDocChanged = true; updateThumbRect(); } @@ -238,10 +240,10 @@ void LLScrollbar::updateThumbRect() } } -BOOL LLScrollbar::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleMouseDown(S32 x, S32 y, MASK mask) { // Check children first - BOOL handled_by_child = LLView::childrenHandleMouseDown(x, y, mask) != NULL; + bool handled_by_child = LLView::childrenHandleMouseDown(x, y, mask) != NULL; if( !handled_by_child ) { if( mThumbRect.pointInRect(x,y) ) @@ -279,16 +281,16 @@ BOOL LLScrollbar::handleMouseDown(S32 x, S32 y, MASK mask) } } - return TRUE; + return true; } -BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleHover(S32 x, S32 y, MASK mask) { // Note: we don't bother sending the event to the children (the arrow buttons) // because they'll capture the mouse whenever they need hover events. - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { S32 height = getRect().getHeight(); @@ -329,7 +331,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) S32 new_pos = llclamp( S32(variable_lines - ratio * variable_lines + 0.5f), 0, variable_lines ); // Note: we do not call updateThumbRect() here. Instead we let the thumb and the document go slightly // out of sync (less than a line's worth) to make the thumb feel responsive. - changeLine( new_pos - mDocPos, FALSE ); + changeLine( new_pos - mDocPos, false ); } } @@ -373,7 +375,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) // Note: we do not call updateThumbRect() here. Instead we let the thumb and the document go slightly // out of sync (less than a line's worth) to make the thumb feel responsive. - changeLine( new_pos - mDocPos, FALSE ); + changeLine( new_pos - mDocPos, false ); } } @@ -382,7 +384,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; - handled = TRUE; + handled = true; } else { @@ -394,31 +396,31 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) { getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; - handled = TRUE; + handled = true; } - mDocChanged = FALSE; + mDocChanged = false; return handled; } // end handleHover -BOOL LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks) +bool LLScrollbar::handleScrollWheel(S32 x, S32 y, S32 clicks) { - BOOL handled = changeLine( clicks * mStepSize, TRUE ); + bool handled = changeLine( clicks * mStepSize, true ); return handled; } -BOOL LLScrollbar::handleScrollHWheel(S32 x, S32 y, S32 clicks) +bool LLScrollbar::handleScrollHWheel(S32 x, S32 y, S32 clicks) { - BOOL handled = FALSE; + bool handled = false; if (LLScrollbar::HORIZONTAL == mOrientation) { - handled = changeLine(clicks * mStepSize, TRUE); + handled = changeLine(clicks * mStepSize, true); } return handled; } -BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string &tooltip_msg) { // enable this to get drag and drop to control scrollbars @@ -434,19 +436,19 @@ BOOL LLScrollbar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // : F32(pos - SCROLLBAR_SIZE) / usable_track_length; // S32 new_pos = (VERTICAL == mOrientation) ? llclamp( S32(variable_lines - ratio * variable_lines + 0.5f), 0, variable_lines ) // : llclamp( S32(ratio * variable_lines + 0.5f), 0, variable_lines ); - // changeLine( new_pos - mDocPos, TRUE ); + // changeLine( new_pos - mDocPos, true ); //} - //return TRUE; - return FALSE; + //return true; + return false; } -BOOL LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if( hasMouseCapture() ) { gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + handled = true; } else { @@ -457,33 +459,31 @@ BOOL LLScrollbar::handleMouseUp(S32 x, S32 y, MASK mask) return handled; } -BOOL LLScrollbar::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLScrollbar::handleDoubleClick(S32 x, S32 y, MASK mask) { // just treat a double click as a second click return handleMouseDown(x, y, mask); } -void LLScrollbar::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLScrollbar::reshape(S32 width, S32 height, bool called_from_parent) { if (width == getRect().getWidth() && height == getRect().getHeight()) return; LLView::reshape( width, height, called_from_parent ); - LLButton* up_button = getChild<LLButton>("Line Up"); - LLButton* down_button = getChild<LLButton>("Line Down"); if (mOrientation == VERTICAL) { - up_button->reshape(up_button->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); - down_button->reshape(down_button->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); - up_button->setOrigin(0, getRect().getHeight() - up_button->getRect().getHeight()); - down_button->setOrigin(0, 0); + mLineUpBtn->reshape(mLineUpBtn->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); + mLineDownBtn->reshape(mLineDownBtn->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness)); + mLineUpBtn->setOrigin(0, getRect().getHeight() - mLineUpBtn->getRect().getHeight()); + mLineDownBtn->setOrigin(0, 0); } else { - up_button->reshape(llmin(getRect().getWidth() / 2, mThickness), up_button->getRect().getHeight()); - down_button->reshape(llmin(getRect().getWidth() / 2, mThickness), down_button->getRect().getHeight()); - up_button->setOrigin(0, 0); - down_button->setOrigin(getRect().getWidth() - down_button->getRect().getWidth(), 0); + mLineUpBtn->reshape(llmin(getRect().getWidth() / 2, mThickness), mLineUpBtn->getRect().getHeight()); + mLineDownBtn->reshape(llmin(getRect().getWidth() / 2, mThickness), mLineDownBtn->getRect().getHeight()); + mLineUpBtn->setOrigin(0, 0); + mLineDownBtn->setOrigin(getRect().getWidth() - mLineDownBtn->getRect().getWidth(), 0); } updateThumbRect(); } @@ -495,14 +495,14 @@ void LLScrollbar::draw() if(mBGVisible) { - gl_rect_2d(getLocalRect(), mBGColor.get(), TRUE); + gl_rect_2d(getLocalRect(), mBGColor.get(), true); } S32 local_mouse_x; S32 local_mouse_y; LLUI::getInstance()->getMousePositionLocal(this, &local_mouse_x, &local_mouse_y); - BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this; - BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); + bool other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this; + bool hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); if (hovered) { mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLSmoothInterpolation::getInterpolant(0.05f)); @@ -519,9 +519,9 @@ void LLScrollbar::draw() gl_rect_2d(mOrientation == HORIZONTAL ? mThickness : 0, mOrientation == VERTICAL ? getRect().getHeight() - 2 * mThickness : getRect().getHeight(), mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * mThickness : getRect().getWidth(), - mOrientation == VERTICAL ? mThickness : 0, mTrackColor.get(), TRUE); + mOrientation == VERTICAL ? mThickness : 0, mTrackColor.get(), true); - gl_rect_2d(mThumbRect, mThumbColor.get(), TRUE); + gl_rect_2d(mThumbRect, mThumbColor.get(), true); } else @@ -580,7 +580,7 @@ void LLScrollbar::draw() } // end draw -bool LLScrollbar::changeLine( S32 delta, BOOL update_thumb ) +bool LLScrollbar::changeLine( S32 delta, bool update_thumb ) { return setDocPos(mDocPos + delta, update_thumb); } @@ -591,35 +591,35 @@ void LLScrollbar::setValue(const LLSD& value) } -BOOL LLScrollbar::handleKeyHere(KEY key, MASK mask) +bool LLScrollbar::handleKeyHere(KEY key, MASK mask) { if (getDocPosMax() == 0 && !getVisible()) { - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; switch( key ) { case KEY_HOME: setDocPos( 0 ); - handled = TRUE; + handled = true; break; case KEY_END: setDocPos( getDocPosMax() ); - handled = TRUE; + handled = true; break; case KEY_DOWN: setDocPos( getDocPos() + mStepSize ); - handled = TRUE; + handled = true; break; case KEY_UP: setDocPos( getDocPos() - mStepSize ); - handled = TRUE; + handled = true; break; case KEY_PAGE_DOWN: @@ -638,7 +638,7 @@ void LLScrollbar::pageUp(S32 overlap) { if (mDocSize > mPageSize) { - changeLine( -(mPageSize - overlap), TRUE ); + changeLine( -(mPageSize - overlap), true ); } } @@ -646,18 +646,18 @@ void LLScrollbar::pageDown(S32 overlap) { if (mDocSize > mPageSize) { - changeLine( mPageSize - overlap, TRUE ); + changeLine( mPageSize - overlap, true ); } } void LLScrollbar::onLineUpBtnPressed( const LLSD& data ) { - changeLine( -mStepSize, TRUE ); + changeLine( -mStepSize, true ); } void LLScrollbar::onLineDownBtnPressed( const LLSD& data ) { - changeLine( mStepSize, TRUE ); + changeLine( mStepSize, true ); } void LLScrollbar::setThickness(S32 thickness) |