From a9680462828d99cb482cdb235f14d6bd3c87bc9c Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 13 May 2010 19:31:50 +0300 Subject: EXT-7158 FIXED Implemented filter in "My Outfits" tab. - Added accordion tab title highlighting setter and title getter. - Added filtered tabs title highlighting. - Tabs which don't pass filter are hidden. - Added applying filter on list refresh event to avoid refreshing list on every filter change. - Moved part of LLTextUtil to llui/lluitextutil to reuse code in llaccordionctrltab. - Fixed passing list size to mRefreshCompleteSignal. - Added list refresh callback to LLInventoryItemsList for checking tab visibility without re-applying filter sub-string. Committed to proceed with dependent tasks. If there are any comments/suggestions related to text utils this part of code may be changed without requiring much effort. Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/363/ --HG-- branch : product-engine --- indra/llui/CMakeLists.txt | 2 ++ indra/llui/llaccordionctrltab.cpp | 51 +++++++++++++++++++++++++++++++-------- indra/llui/llaccordionctrltab.h | 6 +++-- 3 files changed, 47 insertions(+), 12 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 3ecab90756..88a1652671 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -101,6 +101,7 @@ set(llui_SOURCE_FILES lluictrlfactory.cpp lluiimage.cpp lluistring.cpp + lluitextutil.cpp llundo.cpp llurlaction.cpp llurlentry.cpp @@ -197,6 +198,7 @@ set(llui_HEADER_FILES llui.h lluiimage.h lluistring.h + lluitextutil.h llundo.h llurlaction.h llurlentry.h diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 596da782ce..0db2dca615 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -32,12 +32,13 @@ #include "linden_common.h" -#include "lluictrl.h" -#include "llscrollbar.h" #include "llaccordionctrltab.h" -#include "lllocalcliprect.h" +#include "lllocalcliprect.h" +#include "llscrollbar.h" #include "lltextbox.h" +#include "lluictrl.h" +#include "lluitextutil.h" static const std::string DD_BUTTON_NAME = "dd_button"; static const std::string DD_TEXTBOX_NAME = "dd_textbox"; @@ -72,7 +73,8 @@ public: virtual BOOL postBuild(); - void setTitle(const std::string& title); + std::string getTitle(); + void setTitle(const std::string& title, const std::string& hl); virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); @@ -146,10 +148,28 @@ BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::postBuild() return TRUE; } -void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitle(const std::string& title) +std::string LLAccordionCtrlTab::LLAccordionCtrlTabHeader::getTitle() { if(mHeaderTextbox) - mHeaderTextbox->setText(title); + { + return mHeaderTextbox->getText(); + } + else + { + return LLStringUtil::null; + } +} + +void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitle(const std::string& title, const std::string& hl) +{ + if(mHeaderTextbox) + { + LLTextUtil::textboxSetHighlightedVal( + mHeaderTextbox, + LLStyle::Params(), + title, + hl); + } } void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() @@ -436,12 +456,25 @@ void LLAccordionCtrlTab::setAccordionView(LLView* panel) addChild(panel,0); } -void LLAccordionCtrlTab::setTitle(const std::string& title) +std::string LLAccordionCtrlTab::getTitle() +{ + LLAccordionCtrlTabHeader* header = findChild(DD_HEADER_NAME); + if (header) + { + return header->getTitle(); + } + else + { + return LLStringUtil::null; + } +} + +void LLAccordionCtrlTab::setTitle(const std::string& title, const std::string& hl) { LLAccordionCtrlTabHeader* header = findChild(DD_HEADER_NAME); if (header) { - header->setTitle(title); + header->setTitle(title, hl); } } @@ -903,5 +936,3 @@ BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) } return LLUICtrl::handleToolTip(x, y, mask); } - - diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index de254ed3eb..f5b7fd0af6 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -113,8 +113,10 @@ public: void setAccordionView(LLView* panel); LLView* getAccordionView() { return mContainerPanel; }; - // Set text in LLAccordionCtrlTabHeader - void setTitle(const std::string& title); + std::string getTitle(); + + // Set text and highlight substring in LLAccordionCtrlTabHeader + void setTitle(const std::string& title, const std::string& hl = LLStringUtil::null); boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb); boost::signals2::connection setFocusLostCallback(const focus_signal_t::slot_type& cb); -- cgit v1.2.3