From e1189d0e2ee47539edc68c3532e0a5ce64d5dcd1 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Fri, 4 Jun 2010 13:29:25 +0300 Subject: EXT-7368 FIXED Implemented new "empty_accordion_text" textbox to show help text when there are no visible tabs in accordion. * Textbox always fit whole accordion. * This text is updated with search_term (in link to open Search floater) when new filter substring is passed to accordion. * Accordion is notified by its tabs when their visibility is changed. Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/486/ --HG-- branch : product-engine --- indra/llui/llaccordionctrl.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/llui/llaccordionctrl.h') diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index a029201c90..2f483eafb2 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -34,6 +34,7 @@ #define LL_ACCORDIONCTRL_H #include "llpanel.h" +#include "lltextbox.h" #include "llscrollbar.h" #include @@ -64,10 +65,12 @@ public: accordion tabs are responsible for scrolling their content. *NOTE fit_parent works best when combined with single_expansion. Accordion view should implement getRequiredRect() and provide valid height*/ + Optional empty_accordion_text; Params() : single_expansion("single_expansion",false) , fit_parent("fit_parent", false) + , empty_accordion_text("empty_accordion_text") {}; }; @@ -105,7 +108,15 @@ public: void reset (); + /** + * Sets filter substring as a search_term for help text when there are no any visible tabs. + */ + void setFilterSubString(const std::string& filter_string); + private: + void initNoTabsWidget(const LLTextBox::Params& tb_params); + void updateNoTabsHelpTextVisibility(); + void arrangeSinge(); void arrangeMultiple(); @@ -131,6 +142,8 @@ private: bool mAutoScrolling; F32 mAutoScrollRate; LLAccordionCtrlTab* mSelectedTab; + LLTextBox* mNoVisibleTabsHelpText; + std::string mNoVisibleTabsOrigString; }; -- cgit v1.2.3 From d1751df1cc5d9bf853f29555de94faec1912e19f Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Fri, 4 Jun 2010 21:52:38 +0300 Subject: EXT-7610 FIXED Added sorting outfit tabs by name (case insensitive). Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/523/. --HG-- branch : product-engine --- indra/llui/llaccordionctrl.h | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'indra/llui/llaccordionctrl.h') diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index 2f483eafb2..fc6f2d896c 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -57,6 +57,19 @@ private: public: + /** + * Abstract comparator for accordion tabs. + */ + class LLTabComparator + { + public: + LLTabComparator() {}; + virtual ~LLTabComparator() {}; + + /** Returns true if tab1 < tab2, false otherwise */ + virtual bool compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const = 0; + }; + struct Params : public LLInitParam::Block { @@ -108,6 +121,9 @@ public: void reset (); + void setComparator(const LLTabComparator* comp) { mTabComparator = comp; } + void sort(); + /** * Sets filter substring as a search_term for help text when there are no any visible tabs. */ @@ -134,6 +150,21 @@ private: BOOL autoScroll (S32 x, S32 y); + /** + * An adaptor for LLTabComparator + */ + struct LLComparatorAdaptor + { + LLComparatorAdaptor(const LLTabComparator& comparator) : mComparator(comparator) {}; + + bool operator()(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) + { + return mComparator.compare(tab1, tab2); + } + + const LLTabComparator& mComparator; + }; + private: LLRect mInnerRect; LLScrollbar* mScrollbar; @@ -141,9 +172,11 @@ private: bool mFitParent; bool mAutoScrolling; F32 mAutoScrollRate; - LLAccordionCtrlTab* mSelectedTab; LLTextBox* mNoVisibleTabsHelpText; std::string mNoVisibleTabsOrigString; + + LLAccordionCtrlTab* mSelectedTab; + const LLTabComparator* mTabComparator; }; -- cgit v1.2.3