summaryrefslogtreecommitdiff
path: root/indra/llui/llaccordionctrltab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llaccordionctrltab.cpp')
-rw-r--r--indra/llui/llaccordionctrltab.cpp266
1 files changed, 33 insertions, 233 deletions
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index 4e0537f592..0959722aa6 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -2,44 +2,48 @@
* @file LLAccordionCtrlTab.cpp
* @brief Collapsible control implementation
*
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
*
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "linden_common.h"
+#include "lluictrl.h"
+#include "llscrollbar.h"
#include "llaccordionctrltab.h"
-#include "llaccordionctrl.h"
-
#include "lllocalcliprect.h"
-#include "llscrollbar.h"
+
#include "lltextbox.h"
-#include "lltextutil.h"
-#include "lluictrl.h"
static const std::string DD_BUTTON_NAME = "dd_button";
static const std::string DD_TEXTBOX_NAME = "dd_textbox";
static const std::string DD_HEADER_NAME = "dd_header";
-static const S32 HEADER_HEIGHT = 23;
+static const S32 HEADER_HEIGHT = 20;
static const S32 HEADER_IMAGE_LEFT_OFFSET = 5;
static const S32 HEADER_TEXT_LEFT_OFFSET = 30;
static const F32 AUTO_OPEN_TIME = 1.f;
@@ -68,14 +72,7 @@ public:
virtual BOOL postBuild();
- std::string getTitle();
- void setTitle(const std::string& title, const std::string& hl);
-
- void setTitleFontStyle(std::string style);
-
- void setTitleColor(LLUIColor);
-
- void setSelected(bool is_selected) { mIsSelected = is_selected; }
+ void setTitle(const std::string& title);
virtual void onMouseEnter(S32 x, S32 y, MASK mask);
virtual void onMouseLeave(S32 x, S32 y, MASK mask);
@@ -101,13 +98,9 @@ private:
LLPointer<LLUIImage> mImageHeaderPressed;
LLPointer<LLUIImage> mImageHeaderFocused;
- // style saved when applying it in setTitleFontStyle
- LLStyle::Params mStyleParams;
-
LLUIColor mHeaderBGColor;
bool mNeedsHighlight;
- bool mIsSelected;
LLFrameTimer mAutoOpenTimer;
};
@@ -120,8 +113,7 @@ LLAccordionCtrlTab::LLAccordionCtrlTabHeader::LLAccordionCtrlTabHeader(
const LLAccordionCtrlTabHeader::Params& p)
: LLUICtrl(p)
, mHeaderBGColor(p.header_bg_color())
-, mNeedsHighlight(false)
-, mIsSelected(false),
+,mNeedsHighlight(false),
mImageCollapsed(p.header_collapse_img),
mImageCollapsedPressed(p.header_collapse_img_pressed),
mImageExpanded(p.header_expand_img),
@@ -154,47 +146,10 @@ BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::postBuild()
return TRUE;
}
-std::string LLAccordionCtrlTab::LLAccordionCtrlTabHeader::getTitle()
-{
- if(mHeaderTextbox)
- {
- return mHeaderTextbox->getText();
- }
- else
- {
- return LLStringUtil::null;
- }
-}
-
-void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitle(const std::string& title, const std::string& hl)
+void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitle(const std::string& title)
{
if(mHeaderTextbox)
- {
- LLTextUtil::textboxSetHighlightedVal(
- mHeaderTextbox,
- mStyleParams,
- title,
- hl);
- }
-}
-
-void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitleFontStyle(std::string style)
-{
- if (mHeaderTextbox)
- {
- std::string text = mHeaderTextbox->getText();
- mStyleParams.font(mHeaderTextbox->getDefaultFont());
- mStyleParams.font.style(style);
- mHeaderTextbox->setText(text, mStyleParams);
- }
-}
-
-void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::setTitleColor(LLUIColor color)
-{
- if(mHeaderTextbox)
- {
- mHeaderTextbox->setColor(color);
- }
+ mHeaderTextbox->setText(title);
}
void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw()
@@ -212,7 +167,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() || mIsSelected
+ if (getParent()->hasFocus()
/*&& !(collapsible && !expanded)*/ // WHY??
)
{
@@ -254,15 +209,6 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::reshape(S32 width, S32 height
LLRect textboxRect(HEADER_TEXT_LEFT_OFFSET,(height+header_height)/2 ,width,(height-header_height)/2);
mHeaderTextbox->reshape(textboxRect.getWidth(), textboxRect.getHeight());
mHeaderTextbox->setRect(textboxRect);
-
- if (mHeaderTextbox->getTextPixelWidth() > mHeaderTextbox->getRect().getWidth())
- {
- setToolTip(mHeaderTextbox->getText());
- }
- else
- {
- setToolTip(LLStringUtil::null);
- }
}
void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::onMouseEnter(S32 x, S32 y, MASK mask)
@@ -335,7 +281,6 @@ 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);
}
@@ -366,13 +311,6 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p)
mHeader = LLUICtrlFactory::create<LLAccordionCtrlTabHeader>(headerParams);
addChild(mHeader, 1);
- LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLAccordionCtrlTab::selectOnFocusReceived, this));
-
- if (!p.selection_enabled)
- {
- LLFocusableElement::setFocusLostCallback(boost::bind(&LLAccordionCtrlTab::deselectOnFocusLost, this));
- }
-
reshape(100, 200,FALSE);
}
@@ -441,13 +379,6 @@ void LLAccordionCtrlTab::changeOpenClose(bool is_open)
}
}
-void LLAccordionCtrlTab::handleVisibilityChange(BOOL new_visibility)
-{
- LLUICtrl::handleVisibilityChange(new_visibility);
-
- notifyParent(LLSD().with("child_visibility_change", new_visibility));
-}
-
BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask)
{
if(mCollapsible && mHeaderVisible && mCanOpenClose)
@@ -494,9 +425,6 @@ bool LLAccordionCtrlTab::addChild(LLView* child, S32 tab_group)
setDisplayChildren(getDisplayChildren());
}
- if (!mContainerPanel)
- mContainerPanel = findContainerView();
-
return res;
}
@@ -505,74 +433,6 @@ void LLAccordionCtrlTab::setAccordionView(LLView* panel)
addChild(panel,0);
}
-std::string LLAccordionCtrlTab::getTitle() const
-{
- LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(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<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
- if (header)
- {
- header->setTitle(title, hl);
- }
-}
-
-void LLAccordionCtrlTab::setTitleFontStyle(std::string style)
-{
- LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
- if (header)
- {
- header->setTitleFontStyle(style);
- }
-}
-
-void LLAccordionCtrlTab::setTitleColor(LLUIColor color)
-{
- LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
- if (header)
- {
- header->setTitleColor(color);
- }
-}
-
-boost::signals2::connection LLAccordionCtrlTab::setFocusReceivedCallback(const focus_signal_t::slot_type& cb)
-{
- LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
- if (header)
- {
- return header->setFocusReceivedCallback(cb);
- }
- return boost::signals2::connection();
-}
-
-boost::signals2::connection LLAccordionCtrlTab::setFocusLostCallback(const focus_signal_t::slot_type& cb)
-{
- LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
- if (header)
- {
- return header->setFocusLostCallback(cb);
- }
- return boost::signals2::connection();
-}
-
-void LLAccordionCtrlTab::setSelected(bool is_selected)
-{
- LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
- if (header)
- {
- header->setSelected(is_selected);
- }
-}
LLView* LLAccordionCtrlTab::findContainerView()
{
@@ -589,20 +449,6 @@ 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"));
-}
-
-void LLAccordionCtrlTab::deselectOnFocusLost()
-{
- if(getParent()) // A parent may not be set if tabs are added dynamically.
- {
- getParent()->notifyParent(LLSD().with("action", "deselect_current"));
- }
-
-}
S32 LLAccordionCtrlTab::getHeaderHeight()
{
@@ -704,9 +550,8 @@ S32 LLAccordionCtrlTab::notifyParent(const LLSD& info)
setRect(panel_rect);
}
- //LLAccordionCtrl should rearrange accordion tab if one of accordion change its size
- if (getParent()) // A parent may not be set if tabs are added dynamically.
- getParent()->notifyParent(info);
+ //LLAccordionCtrl should rearrange accodion tab if one of accordion change its size
+ getParent()->notifyParent(info);
return 1;
}
else if(str_action == "select_prev")
@@ -715,27 +560,6 @@ S32 LLAccordionCtrlTab::notifyParent(const LLSD& info)
return 1;
}
}
- else if (info.has("scrollToShowRect"))
- {
- LLAccordionCtrl* parent = dynamic_cast<LLAccordionCtrl*>(getParent());
- if (parent && parent->getFitParent())
- {
- // EXT-8285 ('No attachments worn' text appears at the bottom of blank 'Attachments' accordion)
- // The problem was in passing message "scrollToShowRect" IN LLAccordionCtrlTab::notifyParent
- // FROM child LLScrollContainer TO parent LLAccordionCtrl with "it_parent" set to true.
-
- // It is wrong notification for parent accordion which leads to recursive call of adjustContainerPanel
- // As the result of recursive call of adjustContainerPanel we got LLAccordionCtrlTab
- // that reshaped and re-sized with different rectangles.
-
- // LLAccordionCtrl has own scrollContainer and LLAccordionCtrlTab has own scrollContainer
- // both should handle own scroll container's event.
- // So, if parent accordion "fit_parent" accordion tab should handle its scroll container events itself.
-
- return 1;
- }
- }
-
return LLUICtrl::notifyParent(info);
}
@@ -824,7 +648,6 @@ void LLAccordionCtrlTab::showAndFocusHeader()
{
LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
header->setFocus(true);
- header->setSelected(true);
LLRect screen_rc;
LLRect selected_rc = header->getRect();
@@ -1037,28 +860,5 @@ void LLAccordionCtrlTab::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top,
panel->reshape( width, height, 1);
panel->setRect(panel_rect);
}
-BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask)
-{
- //header may be not the first child but we need to process it first
- if(y >= (getRect().getHeight() - HEADER_HEIGHT - HEADER_HEIGHT/2) )
- {
- //inside tab header
- //fix for EXT-6619
- mHeader->handleToolTip(x, y, mask);
- return TRUE;
- }
- return LLUICtrl::handleToolTip(x, y, mask);
-}
-BOOL LLAccordionCtrlTab::handleScrollWheel ( S32 x, S32 y, S32 clicks )
-{
- if( LLUICtrl::handleScrollWheel(x,y,clicks))
- {
- return TRUE;
- }
- if( mScrollbar && mScrollbar->getVisible() && mScrollbar->handleScrollWheel( 0, 0, clicks ) )
- {
- return TRUE;
- }
- return FALSE;
-}
+