diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-08-26 20:47:27 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-08-26 20:47:27 +0000 |
commit | af98aad98d43ec8b128ecac3089426d6ae6edc3f (patch) | |
tree | 5971f87afc04580df470a003793dcc8c974e29a7 /indra/llui | |
parent | 6a364e6f32c12c1ab2c0f33e8ef07d885a8765a2 (diff) |
svn merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1471 https://svn.aws.productengine.com/secondlife/pe/stable-1@1476 -> viewer-2.0.0-3
EXT-65 EXT-270 EXT-359 EXT-361 EXT-367 EXT-367 EXT-368 EXT-455 EXT-468 EXT-530 EXT-539 EXT-540 EXT-542 EXT-545 EXT-555 EXT-557 EXT-558 EXT-559 EXT-559 EXT-560 EXT-561 EXT-562 EXT-563 EXT-564 EXT-566 EXT-568 EXT-569 EXT-570 EXT-571 EXT-581 EXT-590 EXT-594 EXT-596 EXT-597 EXT-601 EXT-602 EXT-603 EXT-613 EXT-620 EXT-624 EXT-628 EXT-630 EXT-631 EXT-632 EXT-639 EXT-640 EXT-641 EXT-642 EXT-662 EXT-671 EXT-672 EXT-676 EXT-682 EXT-692 EXT-703 EXT-717
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llmenugl.cpp | 43 | ||||
-rw-r--r-- | indra/llui/llmenugl.h | 3 | ||||
-rw-r--r-- | indra/llui/llsearcheditor.h | 8 |
3 files changed, 38 insertions, 16 deletions
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index b6c3ffc61c..4edae46f32 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -1353,23 +1353,26 @@ void LLMenuItemBranchDownGL::openMenu( void ) // set the hover status (called by it's menu) void LLMenuItemBranchDownGL::setHighlight( BOOL highlight ) { - if (highlight == getHighlight()) return; - - LLMenuGL* branch = getBranch(); - if (!branch) return; + if (highlight == getHighlight()) + return; //NOTE: Purposely calling all the way to the base to bypass auto-open. LLMenuItemGL::setHighlight(highlight); + + LLMenuGL* branch = getBranch(); + if (!branch) + return; + if( !highlight) { - if (getBranch()->getTornOff()) + if (branch->getTornOff()) { - ((LLFloater*)getBranch()->getParent())->setFocus(FALSE); - getBranch()->clearHoverItem(); + ((LLFloater*)branch->getParent())->setFocus(FALSE); + branch->clearHoverItem(); } else { - getBranch()->setVisible( FALSE ); + branch->setVisible( FALSE ); } } } @@ -1638,6 +1641,7 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mDropShadowed( p.drop_shadow ), mHorizontalLayout( p.horizontal_layout ), mScrollable(mHorizontalLayout ? FALSE : p.scrollable), // Scrolling is supported only for vertical layout + mMaxScrollableItems(p.max_scrollable_items), mKeepFixedSize( p.keep_fixed_size ), mLabel (p.label), mLastMouseX(0), @@ -1911,6 +1915,7 @@ void LLMenuGL::arrange( void ) item_list_t::iterator first_hidden_item_iter = mItems.end(); S32 height_before_first_visible_item = -1; S32 visible_items_height = 0; + U32 scrollable_items_cnt = 0; if (mHorizontalLayout) { @@ -2005,12 +2010,16 @@ void LLMenuGL::arrange( void ) { height_before_first_visible_item = height - (*item_iter)->getNominalHeight(); first_visible_item_iter = item_iter; + scrollable_items_cnt = 0; } - if (-1 != height_before_first_visible_item && 0 == visible_items_height && height - height_before_first_visible_item > max_height - spillover_item_height * 2) + if (-1 != height_before_first_visible_item && 0 == visible_items_height && + (++scrollable_items_cnt > mMaxScrollableItems || + height - height_before_first_visible_item > max_height - spillover_item_height * 2 )) { first_hidden_item_iter = item_iter; visible_items_height = height - height_before_first_visible_item - (*item_iter)->getNominalHeight(); + scrollable_items_cnt--; } } } @@ -2020,16 +2029,16 @@ void LLMenuGL::arrange( void ) { S32 max_items_height = max_height - spillover_item_height * 2; + if (visible_items_height == 0) + visible_items_height = height - height_before_first_visible_item; + // Fix mFirstVisibleItem value, if it doesn't allow to display all items, that can fit - if (visible_items_height < max_items_height) + if (visible_items_height < max_items_height && scrollable_items_cnt < mMaxScrollableItems) { - if (visible_items_height == 0) - { - visible_items_height = height - height_before_first_visible_item; - } - item_list_t::iterator tmp_iter(first_visible_item_iter); - while (visible_items_height < max_items_height && first_visible_item_iter != mItems.begin()) + while (visible_items_height < max_items_height && + scrollable_items_cnt < mMaxScrollableItems && + first_visible_item_iter != mItems.begin()) { if ((*first_visible_item_iter)->getVisible()) { @@ -2043,6 +2052,7 @@ void LLMenuGL::arrange( void ) { visible_items_height += (*first_visible_item_iter)->getNominalHeight(); height_before_first_visible_item -= (*first_visible_item_iter)->getNominalHeight(); + scrollable_items_cnt++; } } @@ -2051,6 +2061,7 @@ void LLMenuGL::arrange( void ) { visible_items_height -= (*first_visible_item_iter)->getNominalHeight(); height_before_first_visible_item += (*first_visible_item_iter)->getNominalHeight(); + scrollable_items_cnt--; first_visible_item_iter = tmp_iter; } if (!(*first_visible_item_iter)->getVisible()) diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 2e7f61c2dd..44459a6c0e 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -382,6 +382,7 @@ public: create_jump_keys, keep_fixed_size, scrollable; + Optional<U32> max_scrollable_items; Optional<LLUIColor> bg_color; Optional<S32> shortcut_pad; @@ -394,6 +395,7 @@ public: create_jump_keys("create_jump_keys", false), bg_color("bg_color", LLUIColorTable::instance().getColor( "MenuDefaultBgColor" )), scrollable("scrollable", false), + max_scrollable_items("max_scrollable_items", U32_MAX), shortcut_pad("shortcut_pad") { addSynonym(bg_visible, "opaque"); @@ -541,6 +543,7 @@ protected: S32 mLastMouseY; S32 mMouseVelX; S32 mMouseVelY; + U32 mMaxScrollableItems; BOOL mHorizontalLayout; BOOL mScrollable; BOOL mKeepFixedSize; diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h index 368b68baa3..cd2867b493 100644 --- a/indra/llui/llsearcheditor.h +++ b/indra/llui/llsearcheditor.h @@ -67,6 +67,8 @@ public: virtual ~LLSearchEditor() {} void setText(const LLStringExplicit &new_text) { mSearchEditor->setText(new_text); } + const std::string& getText() const { return mSearchEditor->getText(); } + // LLUICtrl interface virtual void setValue(const LLSD& value ); @@ -75,6 +77,12 @@ public: virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual void clear(); + void setKeystrokeCallback(LLLineEditor::callback_t callback, void* user_data) + { + if(mSearchEditor) + mSearchEditor->setKeystrokeCallback(callback,user_data); + } + private: LLLineEditor* mSearchEditor; LLButton* mSearchButton; |