diff options
Diffstat (limited to 'indra/llui/lltabcontainer.cpp')
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 192 |
1 files changed, 96 insertions, 96 deletions
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 6aeae0f291..772dcdf119 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; @@ -232,7 +232,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), @@ -306,14 +306,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) @@ -341,7 +341,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) @@ -383,11 +383,11 @@ bool LLTabContainer::addChild(LLView* view, S32 tab_group) } } -BOOL LLTabContainer::postBuild() +bool LLTabContainer::postBuild() { selectFirstTab(); - return TRUE; + return true; } // virtual @@ -431,7 +431,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 ); @@ -459,7 +459,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 ); } } @@ -478,7 +478,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(); @@ -504,14 +504,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 ); } } } @@ -541,11 +541,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) { @@ -604,7 +604,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(); } } @@ -617,10 +617,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) { @@ -663,10 +663,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; @@ -710,11 +710,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); @@ -727,15 +727,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) { @@ -772,25 +772,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); } } @@ -803,21 +803,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; @@ -830,24 +830,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; @@ -858,9 +858,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()) { @@ -901,7 +901,7 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag 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()) @@ -964,9 +964,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); @@ -1030,10 +1030,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; @@ -1255,7 +1255,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) @@ -1305,7 +1305,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child) LLPanel* panelp = getPanelByIndex(mCurrentTabIdx); if (panelp) { - panelp->setFocus(TRUE); + panelp->setFocus(true); } } @@ -1324,7 +1324,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()) { @@ -1453,10 +1453,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()) @@ -1468,16 +1468,16 @@ 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) @@ -1490,11 +1490,11 @@ void LLTabContainer::selectPrevTab() } 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) @@ -1506,23 +1506,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); @@ -1536,16 +1536,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); @@ -1554,7 +1554,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) { @@ -1581,11 +1581,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) @@ -1617,11 +1617,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++; @@ -1630,36 +1630,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 ) @@ -1809,7 +1809,7 @@ void LLTabContainer::onTabBtn( const LLSD& data, LLPanel* panel ) if (tuple) { - tuple->mTabPanel->setFocus(TRUE); + tuple->mTabPanel->setFocus(true); } } @@ -1819,7 +1819,7 @@ void LLTabContainer::onNextBtn( const LLSD& data ) { scrollNext(); } - mScrolled = FALSE; + mScrolled = false; if(mCurrentTabIdx < mTabList.size()-1) { @@ -1838,7 +1838,7 @@ void LLTabContainer::onNextBtnHeld( const LLSD& data ) { selectNextTab(); } - mScrolled = TRUE; + mScrolled = true; } } @@ -1848,7 +1848,7 @@ void LLTabContainer::onPrevBtn( const LLSD& data ) { scrollPrev(); } - mScrolled = FALSE; + mScrolled = false; if(mCurrentTabIdx > 0) { @@ -1877,7 +1877,7 @@ void LLTabContainer::onPrevBtnHeld( const LLSD& data ) { selectPrevTab(); } - mScrolled = TRUE; + mScrolled = true; } } @@ -2007,21 +2007,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); } @@ -2086,7 +2086,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(); @@ -2097,7 +2097,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 @@ -2129,7 +2129,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) @@ -2195,9 +2195,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(); } |