From 40b476dbb2aee494d57dce81427b74ac19b1428d Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Sat, 29 May 2010 00:06:34 +0300 Subject: EXT-7198, EXT-7491 FIXED Added mutli-selection support for outfit items and outfit tabs selection support. - Added selecting multiple items from more than one accordion tab. - Integrated context menus from Vadim's patch for EXT-6726 Appearance SP menus (WIP tier 2). - Added selection to accordion control to use it instead of accordion tab focus in cases when focus is lost and outfit tab should stay selected. - Changed "Wear" button behavior: "Wear" puts on currently selected outfit (as the tooltip reads "Wear selected outfit"). There is always an outfit selected when the accordion is focused so for now there are no cases when only some items are selected. Separate items can be worn from context menu. - Added moving accordion tab selection with right click. Fixed (EXT-7491) Right click on an accordion title should move selection to it. Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/437/ --HG-- branch : product-engine --- indra/llui/llaccordionctrltab.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'indra/llui/llaccordionctrltab.cpp') diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index b09c108ec3..83e67980a3 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -76,6 +76,8 @@ public: std::string getTitle(); void setTitle(const std::string& title, const std::string& hl); + void setSelected(bool is_selected) { mIsSelected = is_selected; } + virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); @@ -103,6 +105,7 @@ private: LLUIColor mHeaderBGColor; bool mNeedsHighlight; + bool mIsSelected; LLFrameTimer mAutoOpenTimer; }; @@ -115,7 +118,8 @@ LLAccordionCtrlTab::LLAccordionCtrlTabHeader::LLAccordionCtrlTabHeader( const LLAccordionCtrlTabHeader::Params& p) : LLUICtrl(p) , mHeaderBGColor(p.header_bg_color()) -,mNeedsHighlight(false), +, mNeedsHighlight(false) +, mIsSelected(false), mImageCollapsed(p.header_collapse_img), mImageCollapsedPressed(p.header_collapse_img_pressed), mImageExpanded(p.header_expand_img), @@ -187,7 +191,7 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() // Only show green "focus" background image if the accordion is open, // because the user's mental model of focus is that it goes away after // the accordion is closed. - if (getParent()->hasFocus() + if (getParent()->hasFocus() || mIsSelected /*&& !(collapsible && !expanded)*/ // WHY?? ) { @@ -301,6 +305,7 @@ LLAccordionCtrlTab::Params::Params() ,header_image_focused("header_image_focused") ,header_text_color("header_text_color") ,fit_panel("fit_panel",true) + ,selection_enabled("selection_enabled", false) { mouse_opaque(false); } @@ -331,6 +336,11 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p) mHeader = LLUICtrlFactory::create(headerParams); addChild(mHeader, 1); + if (p.selection_enabled) + { + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLAccordionCtrlTab::selectOnFocusReceived, this)); + } + reshape(100, 200,FALSE); } @@ -498,6 +508,15 @@ boost::signals2::connection LLAccordionCtrlTab::setFocusLostCallback(const focus return boost::signals2::connection(); } +void LLAccordionCtrlTab::setSelected(bool is_selected) +{ + LLAccordionCtrlTabHeader* header = findChild(DD_HEADER_NAME); + if (header) + { + header->setSelected(is_selected); + } +} + LLView* LLAccordionCtrlTab::findContainerView() { for(child_list_const_iter_t it = getChildList()->begin(); @@ -513,6 +532,11 @@ LLView* LLAccordionCtrlTab::findContainerView() return NULL; } +void LLAccordionCtrlTab::selectOnFocusReceived() +{ + if (getParent()) // A parent may not be set if tabs are added dynamically. + getParent()->notifyParent(LLSD().with("action", "select_current")); +} S32 LLAccordionCtrlTab::getHeaderHeight() { @@ -713,6 +737,7 @@ void LLAccordionCtrlTab::showAndFocusHeader() { LLAccordionCtrlTabHeader* header = getChild(DD_HEADER_NAME); header->setFocus(true); + header->setSelected(true); LLRect screen_rc; LLRect selected_rc = header->getRect(); -- cgit v1.2.3