diff options
author | Roxie Linden <roxie@lindenlab.com> | 2024-06-13 14:59:28 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-06-13 14:59:28 -0700 |
commit | 5e60392c273f0c9c5efa765a05414c618381780a (patch) | |
tree | d1eedbb1dfa86e66532a6d8746b7a81e5a444d3a /indra/llui/lltabcontainer.cpp | |
parent | 0f3c3563b0861e8ea82b201aab8343d99f993bbc (diff) | |
parent | 100ebbab2437de7f5d124a0d7b8279a7a7b57656 (diff) |
Merge branch 'develop' of github.com:secondlife/viewer into roxie/webrtc-voice
Diffstat (limited to 'indra/llui/lltabcontainer.cpp')
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 78c4f3c03c..06f584d372 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -75,7 +75,7 @@ public: mTabContainer(c), mTabPanel(p), mButton(b), - mOldState(FALSE), + mOldState(false), mPlaceholderText(placeholder), mPadding(0), mVisible(true) @@ -84,7 +84,7 @@ public: LLTabContainer* mTabContainer; LLPanel* mTabPanel; LLButton* mButton; - BOOL mOldState; + bool mOldState; LLTextBox* mPlaceholderText; S32 mPadding; @@ -233,7 +233,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) : LLPanel(p), mCurrentTabIdx(-1), mTabsHidden(p.hide_tabs), - mScrolled(FALSE), + mScrolled(false), mScrollPos(0), mScrollPosPixels(0), mMaxScrollPos(0), @@ -308,14 +308,14 @@ void LLTabContainer::setValue(const LLSD& value) } //virtual -void LLTabContainer::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLTabContainer::reshape(S32 width, S32 height, bool called_from_parent) { LLPanel::reshape( width, height, called_from_parent ); updateMaxScrollPos(); } //virtual -LLView* LLTabContainer::getChildView(const std::string& name, BOOL recurse) const +LLView* LLTabContainer::getChildView(const std::string& name, bool recurse) const { tuple_list_t::const_iterator itor; for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) @@ -343,7 +343,7 @@ LLView* LLTabContainer::getChildView(const std::string& name, BOOL recurse) cons } //virtual -LLView* LLTabContainer::findChildView(const std::string& name, BOOL recurse) const +LLView* LLTabContainer::findChildView(const std::string& name, bool recurse) const { tuple_list_t::const_iterator itor; for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) @@ -385,11 +385,11 @@ bool LLTabContainer::addChild(LLView* view, S32 tab_group) } } -BOOL LLTabContainer::postBuild() +bool LLTabContainer::postBuild() { selectFirstTab(); - return TRUE; + return true; } // virtual @@ -433,7 +433,7 @@ void LLTabContainer::draw() setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLSmoothInterpolation::getInterpolant(0.08f))); - BOOL has_scroll_arrows = !mHideScrollArrows && !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); + bool has_scroll_arrows = !mHideScrollArrows && !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); if (!mIsVertical) { mJumpPrevArrowBtn->setVisible( has_scroll_arrows ); @@ -461,7 +461,7 @@ void LLTabContainer::draw() for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( FALSE ); + tuple->mButton->setVisible( false ); } } @@ -480,7 +480,7 @@ void LLTabContainer::draw() for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( TRUE ); + tuple->mButton->setVisible( true ); } S32 max_scroll_visible = getTabCount() - getMaxScrollPos() + getScrollPos(); @@ -506,14 +506,14 @@ void LLTabContainer::draw() { if( tuple->mButton->getFlashing() ) { - mPrevArrowBtn->setFlashing( TRUE ); + mPrevArrowBtn->setFlashing( true ); } } else if( max_scroll_visible < idx ) { if( tuple->mButton->getFlashing() ) { - mNextArrowBtn->setFlashing( TRUE ); + mNextArrowBtn->setFlashing( true ); } } } @@ -543,11 +543,11 @@ void LLTabContainer::draw() // virtual -BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) +bool LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) { static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); - BOOL handled = FALSE; - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); + bool handled = false; + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); if (has_scroll_arrows) { @@ -606,7 +606,7 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) index = llclamp(index, 0, tab_count-1); LLButton* tab_button = getTab(index)->mButton; gFocusMgr.setMouseCapture(this); - tab_button->setFocus(TRUE); + tab_button->setFocus(true); mMouseDownTimer.start(); } } @@ -619,10 +619,10 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) } // virtual -BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask ) +bool LLTabContainer::handleHover( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); + bool handled = false; + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); if (has_scroll_arrows) { @@ -665,10 +665,10 @@ BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask ) } // virtual -BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) +bool LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) { - BOOL handled = FALSE; - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); + bool handled = false; + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); S32 local_x = x - getRect().mLeft; S32 local_y = y - getRect().mBottom; @@ -712,11 +712,11 @@ BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) { if (cur_panel) { - if (!cur_panel->focusFirstItem(FALSE)) + if (!cur_panel->focusFirstItem(false)) { // if nothing in the panel gets focus, make sure the new tab does // otherwise the last tab might keep focus - getTab(getCurrentPanelIndex())->mButton->setFocus(TRUE); + getTab(getCurrentPanelIndex())->mButton->setFocus(true); } } gFocusMgr.setMouseCapture(NULL); @@ -729,15 +729,15 @@ BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) } // virtual -BOOL LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask) +bool LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask) { static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); - BOOL handled = LLPanel::handleToolTip( x, y, mask); + bool handled = LLPanel::handleToolTip( x, y, mask); if (!handled && getTabCount() > 0 && !getTabsHidden()) { LLTabTuple* firsttuple = getTab(0); - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); LLRect clip; if (mIsVertical) { @@ -774,25 +774,25 @@ BOOL LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask) } // virtual -BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) +bool LLTabContainer::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; if (key == KEY_LEFT && mask == MASK_ALT) { selectPrevTab(); - handled = TRUE; + handled = true; } else if (key == KEY_RIGHT && mask == MASK_ALT) { selectNextTab(); - handled = TRUE; + handled = true; } if (handled) { if (getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } } @@ -805,21 +805,21 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) { case KEY_UP: selectPrevTab(); - handled = TRUE; + handled = true; break; case KEY_DOWN: selectNextTab(); - handled = TRUE; + handled = true; break; case KEY_LEFT: - handled = TRUE; + handled = true; break; case KEY_RIGHT: if (getTabPosition() == LEFT && getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } - handled = TRUE; + handled = true; break; default: break; @@ -832,24 +832,24 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) case KEY_UP: if (getTabPosition() == BOTTOM && getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } - handled = TRUE; + handled = true; break; case KEY_DOWN: if (getTabPosition() == TOP && getCurrentPanel()) { - getCurrentPanel()->setFocus(TRUE); + getCurrentPanel()->setFocus(true); } - handled = TRUE; + handled = true; break; case KEY_LEFT: selectPrevTab(); - handled = TRUE; + handled = true; break; case KEY_RIGHT: selectNextTab(); - handled = TRUE; + handled = true; break; default: break; @@ -860,9 +860,9 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) } // virtual -BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) +bool LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) { - BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); + bool has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); if(mOpenTabsOnDragAndDrop && !getTabsHidden()) { @@ -903,7 +903,7 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDra for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( TRUE ); + tuple->mButton->setVisible( true ); S32 local_x = x - tuple->mButton->getRect().mLeft; S32 local_y = y - tuple->mButton->getRect().mBottom; if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) @@ -966,9 +966,9 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) const std::string& label = panel.label.isProvided() ? panel.label() : panel.panel()->getLabel(); - BOOL select = panel.select_tab(); + bool select = panel.select_tab(); S32 indent = panel.indent(); - BOOL placeholder = panel.is_placeholder; + bool placeholder = panel.is_placeholder; eInsertionPoint insertion_point = panel.insert_at(); static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); @@ -1031,10 +1031,10 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) } child->setFollowsAll(); child->translate( tab_panel_rect.mLeft - child->getRect().mLeft, tab_panel_rect.mBottom - child->getRect().mBottom); - child->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), TRUE ); + child->reshape( tab_panel_rect.getWidth(), tab_panel_rect.getHeight(), true ); // add this child later - child->setVisible( FALSE ); // Will be made visible when selected + child->setVisible( false ); // Will be made visible when selected mTotalTabWidth += button_width; @@ -1256,7 +1256,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) } } - BOOL has_focus = gFocusMgr.childHasKeyboardFocus(this); + bool has_focus = gFocusMgr.childHasKeyboardFocus(this); // If the tab being deleted is the selected one, select a different tab. for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) @@ -1298,7 +1298,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) if (mCurrentTabIdx >= (S32)mTabList.size()) { - mCurrentTabIdx = mTabList.size()-1; + mCurrentTabIdx = static_cast<S32>(mTabList.size()) - 1; } selectTab(mCurrentTabIdx); if (has_focus) @@ -1306,7 +1306,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) LLPanel* panelp = getPanelByIndex(mCurrentTabIdx); if (panelp) { - panelp->setFocus(TRUE); + panelp->setFocus(true); } } @@ -1325,7 +1325,7 @@ void LLTabContainer::unlockTabs() mLockedTabCount = 0; } -void LLTabContainer::enableTabButton(S32 which, BOOL enable) +void LLTabContainer::enableTabButton(S32 which, bool enable) { if (which >= 0 && which < (S32)mTabList.size()) { @@ -1377,7 +1377,7 @@ S32 LLTabContainer::getCurrentPanelIndex() S32 LLTabContainer::getTabCount() { - return mTabList.size(); + return static_cast<S32>(mTabList.size()); } LLPanel* LLTabContainer::getPanelByIndex(S32 index) @@ -1444,7 +1444,7 @@ void LLTabContainer::selectFirstTab() void LLTabContainer::selectLastTab() { - selectTab( mTabList.size()-1 ); + selectTab(static_cast<S32>(mTabList.size()) - 1); } void LLTabContainer::selectNextTab() @@ -1454,10 +1454,10 @@ void LLTabContainer::selectNextTab() return; } - BOOL tab_has_focus = FALSE; + bool tab_has_focus = false; if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus()) { - tab_has_focus = TRUE; + tab_has_focus = true; } S32 idx = mCurrentTabIdx+1; if (idx >= (S32)mTabList.size()) @@ -1469,33 +1469,33 @@ void LLTabContainer::selectNextTab() if (tab_has_focus) { - mTabList[idx]->mButton->setFocus(TRUE); + mTabList[idx]->mButton->setFocus(true); } } void LLTabContainer::selectPrevTab() { - BOOL tab_has_focus = FALSE; + bool tab_has_focus = false; if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus()) { - tab_has_focus = TRUE; + tab_has_focus = true; } S32 idx = mCurrentTabIdx-1; if (idx < 0) - idx = mTabList.size()-1; + idx = static_cast<S32>(mTabList.size()) - 1; while (!selectTab(idx) && idx != mCurrentTabIdx) { idx = idx - 1; if (idx < 0) - idx = mTabList.size()-1; + idx = static_cast<S32>(mTabList.size()) - 1; } if (tab_has_focus) { - mTabList[idx]->mButton->setFocus(TRUE); + mTabList[idx]->mButton->setFocus(true); } } -BOOL LLTabContainer::selectTabPanel(LLPanel* child) +bool LLTabContainer::selectTabPanel(LLPanel* child) { S32 idx = 0; for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) @@ -1507,23 +1507,23 @@ BOOL LLTabContainer::selectTabPanel(LLPanel* child) } idx++; } - return FALSE; + return false; } -BOOL LLTabContainer::selectTab(S32 which) +bool LLTabContainer::selectTab(S32 which) { if (which >= getTabCount() || which < 0) - return FALSE; + return false; LLTabTuple* selected_tuple = getTab(which); if (!selected_tuple) - return FALSE; + return false; LLSD cbdata; if (selected_tuple->mTabPanel) cbdata = selected_tuple->mTabPanel->getName(); - BOOL result = FALSE; + bool result = false; if (!mValidateSignal || (*mValidateSignal)(this, cbdata)) { result = setTab(which); @@ -1537,16 +1537,16 @@ BOOL LLTabContainer::selectTab(S32 which) } // private -BOOL LLTabContainer::setTab(S32 which) +bool LLTabContainer::setTab(S32 which) { static LLUICachedControl<S32> tabcntr_arrow_btn_size ("UITabCntrArrowBtnSize", 0); LLTabTuple* selected_tuple = getTab(which); if (!selected_tuple) { - return FALSE; + return false; } - BOOL is_visible = FALSE; + bool is_visible = false; if( selected_tuple->mButton->getEnabled() && selected_tuple->mVisible ) { setCurrentPanelIndex(which); @@ -1555,7 +1555,7 @@ BOOL LLTabContainer::setTab(S32 which) for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { LLTabTuple* tuple = *iter; - BOOL is_selected = ( tuple == selected_tuple ); + bool is_selected = ( tuple == selected_tuple ); // Although the selected tab must be complete, we may have hollow LLTabTuple tucked in the list if (tuple && tuple->mButton) { @@ -1582,11 +1582,11 @@ BOOL LLTabContainer::setTab(S32 which) if( i >= getScrollPos() && i <= getScrollPos() + num_visible) { setCurrentPanelIndex(which); - is_visible = TRUE; + is_visible = true; } else { - is_visible = FALSE; + is_visible = false; } } else if (!mHideScrollArrows && getMaxScrollPos() > 0) @@ -1618,11 +1618,11 @@ BOOL LLTabContainer::setTab(S32 which) setScrollPos(llclamp(getScrollPos(), min_scroll_pos, i)); setScrollPos(llmin(getScrollPos(), getMaxScrollPos())); } - is_visible = TRUE; + is_visible = true; } else { - is_visible = TRUE; + is_visible = true; } } i++; @@ -1631,36 +1631,36 @@ BOOL LLTabContainer::setTab(S32 which) if (mIsVertical && getCurrentPanelIndex() >= 0) { LLTabTuple* tuple = getTab(getCurrentPanelIndex()); - tuple->mTabPanel->setVisible( TRUE ); - tuple->mButton->setToggleState( TRUE ); + tuple->mTabPanel->setVisible( true ); + tuple->mButton->setToggleState( true ); } return is_visible; } -BOOL LLTabContainer::selectTabByName(const std::string& name) +bool LLTabContainer::selectTabByName(const std::string& name) { LLPanel* panel = getPanelByName(name); if (!panel) { LL_WARNS() << "LLTabContainer::selectTabByName(" << name << ") failed" << LL_ENDL; - return FALSE; + return false; } - BOOL result = selectTabPanel(panel); + bool result = selectTabPanel(panel); return result; } -BOOL LLTabContainer::getTabPanelFlashing(LLPanel *child) +bool LLTabContainer::getTabPanelFlashing(LLPanel *child) { LLTabTuple* tuple = getTabByPanel(child); if( tuple ) { return tuple->mButton->getFlashing(); } - return FALSE; + return false; } -void LLTabContainer::setTabPanelFlashing(LLPanel* child, BOOL state ) +void LLTabContainer::setTabPanelFlashing(LLPanel* child, bool state ) { LLTabTuple* tuple = getTabByPanel(child); if( tuple ) @@ -1810,7 +1810,7 @@ void LLTabContainer::onTabBtn( const LLSD& data, LLPanel* panel ) if (tuple) { - tuple->mTabPanel->setFocus(TRUE); + tuple->mTabPanel->setFocus(true); } } @@ -1820,7 +1820,7 @@ void LLTabContainer::onNextBtn( const LLSD& data ) { scrollNext(); } - mScrolled = FALSE; + mScrolled = false; if(mCurrentTabIdx < mTabList.size()-1) { @@ -1839,7 +1839,7 @@ void LLTabContainer::onNextBtnHeld( const LLSD& data ) { selectNextTab(); } - mScrolled = TRUE; + mScrolled = true; } } @@ -1849,7 +1849,7 @@ void LLTabContainer::onPrevBtn( const LLSD& data ) { scrollPrev(); } - mScrolled = FALSE; + mScrolled = false; if(mCurrentTabIdx > 0) { @@ -1878,7 +1878,7 @@ void LLTabContainer::onPrevBtnHeld( const LLSD& data ) { selectPrevTab(); } - mScrolled = TRUE; + mScrolled = true; } } @@ -2008,21 +2008,21 @@ void LLTabContainer::initButtons() } } - mPrevArrowBtn->setTabStop(FALSE); + mPrevArrowBtn->setTabStop(false); addChild(mPrevArrowBtn); - mNextArrowBtn->setTabStop(FALSE); + mNextArrowBtn->setTabStop(false); addChild(mNextArrowBtn); if (mJumpPrevArrowBtn) { - mJumpPrevArrowBtn->setTabStop(FALSE); + mJumpPrevArrowBtn->setTabStop(false); addChild(mJumpPrevArrowBtn); } if (mJumpNextArrowBtn) { - mJumpNextArrowBtn->setTabStop(FALSE); + mJumpNextArrowBtn->setTabStop(false); addChild(mJumpNextArrowBtn); } @@ -2087,7 +2087,7 @@ void LLTabContainer::insertTuple(LLTabTuple * tuple, eInsertionPoint insertion_p void LLTabContainer::updateMaxScrollPos() { static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); - BOOL no_scroll = TRUE; + bool no_scroll = true; if (mIsVertical) { S32 tab_total_height = (BTN_HEIGHT + tabcntrv_pad) * getTabCount(); @@ -2098,7 +2098,7 @@ void LLTabContainer::updateMaxScrollPos() S32 available_height_with_arrows = getRect().getHeight() - 2*(tabcntrv_arrow_btn_size + 3*tabcntrv_pad) - mNextArrowBtn->getRect().mBottom; S32 additional_needed = tab_total_height - available_height_with_arrows; setMaxScrollPos((S32) ceil(additional_needed / float(BTN_HEIGHT + tabcntrv_pad) ) ); - no_scroll = FALSE; + no_scroll = false; } } else @@ -2130,7 +2130,7 @@ void LLTabContainer::updateMaxScrollPos() } // in case last tab doesn't actually fit on screen, make it the last scrolling position setMaxScrollPos(llmin(getMaxScrollPos(), getTabCount() - 1)); - no_scroll = FALSE; + no_scroll = false; } } if (no_scroll) @@ -2196,9 +2196,9 @@ void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible ) } if( foundTab ) - this->setVisible( TRUE ); + this->setVisible( true ); else - this->setVisible( FALSE ); + this->setVisible( false ); updateMaxScrollPos(); } |