summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llaccordionctrl.cpp8
-rw-r--r--indra/llui/llaccordionctrltab.cpp299
-rw-r--r--indra/llui/llaccordionctrltab.h31
-rw-r--r--indra/llui/llfloater.cpp7
-rw-r--r--indra/llui/llfloater.h4
-rw-r--r--indra/llui/llscrolllistcell.cpp4
-rw-r--r--indra/llui/llscrolllistcell.h5
-rw-r--r--indra/llui/llscrolllistctrl.h5
-rw-r--r--indra/llui/lltabcontainer.cpp7
9 files changed, 321 insertions, 49 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index aa69dfe0cc..2ed1082f56 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -103,13 +103,6 @@ void LLAccordionCtrl::draw()
LLLocalClipRect clip(local_rect);
LLPanel::draw();
- /*
- S32 width = getRect().getWidth();
- S32 height = getRect().getHeight();
-
- gl_rect_2d(0, 0 , width - 1 ,height - 1,LLColor4::green,true);
- gl_line_2d(0, 0 , width - 1 ,height - 1,LLColor4::black);
- */
}
@@ -125,7 +118,6 @@ BOOL LLAccordionCtrl::postBuild()
scrollbar_size,
getRect().getHeight() - 1);
-
LLScrollbar::Params sbparams;
sbparams.name("scrollable vertical");
sbparams.rect(scroll_rect);
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index daa9e08f14..1067c3f1d5 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -33,8 +33,9 @@
#include "linden_common.h"
#include "lluictrl.h"
-
+#include "llscrollbar.h"
#include "llaccordionctrltab.h"
+#include "lllocalcliprect.h"
#include "lltextbox.h"
@@ -46,6 +47,8 @@ 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;
+static const S32 VERTICAL_MULTIPLE = 16;
+static const S32 PARENT_BORDER_MARGIN = 5;
static LLDefaultChildRegistry::Register<LLAccordionCtrlTab> t1("accordion_tab");
@@ -277,6 +280,7 @@ LLAccordionCtrlTab::Params::Params()
,header_image_pressed("header_image_pressed")
,header_image_focused("header_image_focused")
,header_text_color("header_text_color")
+ ,fit_panel("fit_panel",true)
{
mouse_opaque(false);
}
@@ -293,6 +297,9 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p)
,mPaddingTop(p.padding_top)
,mPaddingBottom(p.padding_bottom)
,mCanOpenClose(true)
+ ,mFitPanel(p.fit_panel)
+ ,mContainerPanel(NULL)
+ ,mScrollbar(NULL)
{
mStoredOpenCloseState = false;
mWasStateStored = false;
@@ -321,54 +328,42 @@ void LLAccordionCtrlTab::setDisplayChildren(bool display)
mExpandedHeight : HEADER_HEIGHT);
setRect(rect);
- for(child_list_const_iter_t it = getChildList()->begin();
- getChildList()->end() != it; ++it)
- {
- LLView* child = *it;
- if(DD_HEADER_NAME == child->getName())
- continue;
+ if(mContainerPanel)
+ mContainerPanel->setVisible(getDisplayChildren());
- child->setVisible(getDisplayChildren());
+ if(mDisplayChildren)
+ {
+ adjustContainerPanel();
}
+ else
+ {
+ if(mScrollbar)
+ mScrollbar->setVisible(false);
+ }
+
}
void LLAccordionCtrlTab::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)
{
LLRect headerRect;
- LLUICtrl::reshape(width, height, TRUE);
-
headerRect.setLeftTopAndSize(
0,height,width,HEADER_HEIGHT);
mHeader->setRect(headerRect);
mHeader->reshape(headerRect.getWidth(), headerRect.getHeight());
- for(child_list_const_iter_t it = getChildList()->begin();
- getChildList()->end() != it; ++it)
- {
- LLView* child = *it;
- if(DD_HEADER_NAME == child->getName())
- continue;
- if(!child->getVisible())
- continue;
-
- LLRect childRect = child->getRect();
- S32 childWidth = width - getPaddingLeft() - getPaddingRight();
- S32 childHeight = height - getHeaderHeight() - getPaddingTop() - getPaddingBottom();
+ if(!mDisplayChildren)
+ return;
- child->reshape(childWidth,childHeight);
-
- childRect.setLeftTopAndSize(
- getPaddingLeft(),
- childHeight + getPaddingBottom(),
- childWidth,
- childHeight);
+ LLRect childRect;
- child->setRect(childRect);
-
- break;//suppose that there is only one panel
- }
+ childRect.setLeftTopAndSize(
+ getPaddingLeft(),
+ height - getHeaderHeight() - getPaddingTop(),
+ width - getPaddingLeft() - getPaddingRight(),
+ height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() );
+ adjustContainerPanel(childRect);
}
void LLAccordionCtrlTab::changeOpenClose(bool is_open)
@@ -439,7 +434,7 @@ void LLAccordionCtrlTab::setAccordionView(LLView* panel)
}
-LLView* LLAccordionCtrlTab::getAccordionView()
+LLView* LLAccordionCtrlTab::findContainerView()
{
for(child_list_const_iter_t it = getChildList()->begin();
getChildList()->end() != it; ++it)
@@ -474,6 +469,43 @@ void LLAccordionCtrlTab::setHeaderVisible(bool value)
BOOL LLAccordionCtrlTab::postBuild()
{
mHeader->setVisible(mHeaderVisible);
+
+ static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+
+ LLRect scroll_rect;
+ scroll_rect.setOriginAndSize(
+ getRect().getWidth() - scrollbar_size,
+ 1,
+ scrollbar_size,
+ getRect().getHeight() - 1);
+
+ mContainerPanel = findContainerView();
+
+ if(!mFitPanel)
+ {
+ LLScrollbar::Params sbparams;
+ sbparams.name("scrollable vertical");
+ sbparams.rect(scroll_rect);
+ sbparams.orientation(LLScrollbar::VERTICAL);
+ sbparams.doc_size(getRect().getHeight());
+ sbparams.doc_pos(0);
+ sbparams.page_size(getRect().getHeight());
+ sbparams.step_size(VERTICAL_MULTIPLE);
+ sbparams.follows.flags(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM);
+ sbparams.change_callback(boost::bind(&LLAccordionCtrlTab::onScrollPosChangeCallback, this, _1, _2));
+
+
+ mScrollbar = LLUICtrlFactory::create<LLScrollbar> (sbparams);
+ LLView::addChild( mScrollbar );
+ mScrollbar->setFollowsRight();
+ mScrollbar->setFollowsTop();
+ mScrollbar->setFollowsBottom();
+
+ mScrollbar->setVisible(false);
+ }
+
+ mContainerPanel->setVisible(mDisplayChildren);
+
return LLUICtrl::postBuild();
}
bool LLAccordionCtrlTab::notifyChildren (const LLSD& info)
@@ -562,6 +594,12 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent)
if( !header->hasFocus() )
return LLUICtrl::handleKey(key, mask, called_from_parent);
+ if ( (key == KEY_RETURN )&& mask == MASK_NONE)
+ {
+ changeOpenClose(getDisplayChildren());
+ return TRUE;
+ }
+
if ( (key == KEY_ADD || key == KEY_RIGHT)&& mask == MASK_NONE)
{
if(getDisplayChildren() == false)
@@ -622,6 +660,7 @@ void LLAccordionCtrlTab::storeOpenCloseState()
mStoredOpenCloseState = getDisplayChildren();
mWasStateStored = true;
}
+
void LLAccordionCtrlTab::restoreOpenCloseState()
{
if(!mWasStateStored)
@@ -632,3 +671,195 @@ void LLAccordionCtrlTab::restoreOpenCloseState()
}
mWasStateStored = false;
}
+
+void LLAccordionCtrlTab::adjustContainerPanel ()
+{
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
+
+ LLRect child_rect;
+ child_rect.setLeftTopAndSize(
+ getPaddingLeft(),
+ height - getHeaderHeight() - getPaddingTop(),
+ width - getPaddingLeft() - getPaddingRight(),
+ height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() );
+
+ adjustContainerPanel(child_rect);
+}
+
+void LLAccordionCtrlTab::adjustContainerPanel(const LLRect& child_rect)
+{
+ if(!mContainerPanel)
+ return;
+
+ if(!mFitPanel)
+ {
+ show_hide_scrollbar(child_rect);
+ updateLayout(child_rect);
+ }
+ else
+ {
+ mContainerPanel->reshape(child_rect.getWidth(),child_rect.getHeight());
+ mContainerPanel->setRect(child_rect);
+ }
+}
+
+S32 LLAccordionCtrlTab::getChildViewHeight()
+{
+ if(!mContainerPanel)
+ return 0;
+ return mContainerPanel->getRect().getHeight();
+}
+
+void LLAccordionCtrlTab::show_hide_scrollbar(const LLRect& child_rect)
+{
+ if(getChildViewHeight() > child_rect.getHeight() )
+ showScrollbar(child_rect);
+ else
+ hideScrollbar(child_rect);
+}
+void LLAccordionCtrlTab::showScrollbar(const LLRect& child_rect)
+{
+ if(!mContainerPanel || !mScrollbar)
+ return;
+ bool was_visible = mScrollbar->getVisible();
+ mScrollbar->setVisible(true);
+
+ static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+
+ {
+ ctrlSetLeftTopAndSize(mScrollbar,child_rect.getWidth()-scrollbar_size,
+ child_rect.getHeight()-PARENT_BORDER_MARGIN,
+ scrollbar_size,
+ child_rect.getHeight()-2*PARENT_BORDER_MARGIN);
+ }
+
+ LLRect orig_rect = mContainerPanel->getRect();
+
+ mScrollbar->setPageSize(child_rect.getHeight());
+ mScrollbar->setDocParams(orig_rect.getHeight(),mScrollbar->getDocPos());
+
+ if(was_visible)
+ {
+ S32 scroll_pos = llmin(mScrollbar->getDocPos(), orig_rect.getHeight() - child_rect.getHeight() - 1);
+ mScrollbar->setDocPos(scroll_pos);
+ }
+ else//shrink child panel
+ {
+ updateLayout(child_rect);
+ }
+
+}
+
+void LLAccordionCtrlTab::hideScrollbar( const LLRect& child_rect )
+{
+ if(!mContainerPanel || !mScrollbar)
+ return;
+
+ if(mScrollbar->getVisible() == false)
+ return;
+ mScrollbar->setVisible(false);
+ mScrollbar->setDocPos(0);
+
+ //shrink child panel
+ updateLayout(child_rect);
+}
+
+void LLAccordionCtrlTab::onScrollPosChangeCallback(S32, LLScrollbar*)
+{
+ LLRect child_rect;
+
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
+
+ child_rect.setLeftTopAndSize(
+ getPaddingLeft(),
+ height - getHeaderHeight() - getPaddingTop(),
+ width - getPaddingLeft() - getPaddingRight(),
+ height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() );
+
+ updateLayout(child_rect);
+}
+
+void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child)
+{
+ if (child && child->getVisible() && child->getRect().isValid())
+ {
+ LLRect screen_rect;
+ localRectToScreen(child->getRect(),&screen_rect);
+
+ if ( root_rect.overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect))
+ {
+ glMatrixMode(GL_MODELVIEW);
+ LLUI::pushMatrix();
+ {
+ LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom, 0.f);
+ child->draw();
+
+ }
+ LLUI::popMatrix();
+ }
+ }
+}
+
+void LLAccordionCtrlTab::draw()
+{
+ if(mFitPanel)
+ LLUICtrl::draw();
+ else
+ {
+ LLRect root_rect = getRootView()->getRect();
+ drawChild(root_rect,mHeader);
+ drawChild(root_rect,mScrollbar );
+ {
+ LLRect child_rect;
+
+ S32 width = getRect().getWidth();
+ S32 height = getRect().getHeight();
+
+ child_rect.setLeftTopAndSize(
+ getPaddingLeft(),
+ height - getHeaderHeight() - getPaddingTop(),
+ width - getPaddingLeft() - getPaddingRight(),
+ height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() );
+
+ LLLocalClipRect clip(child_rect);
+ drawChild(root_rect,mContainerPanel);
+ }
+
+
+ gGL.getTexUnit(0)->disable();
+ }
+}
+
+void LLAccordionCtrlTab::updateLayout ( const LLRect& child_rect )
+{
+ LLView* child = getAccordionView();
+ if(!mContainerPanel)
+ return;
+
+ S32 panel_top = child_rect.getHeight();
+ S32 panel_width = child_rect.getWidth();
+
+ static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+ if(mScrollbar->getVisible() != false)
+ {
+ panel_top+=mScrollbar->getDocPos();
+ panel_width-=scrollbar_size;
+ }
+
+ //set sizes for first panels and dragbars
+ LLRect panel_rect = child->getRect();
+ ctrlSetLeftTopAndSize(mContainerPanel,child_rect.mLeft,panel_top,panel_width,panel_rect.getHeight());
+}
+void LLAccordionCtrlTab::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, S32 width, S32 height)
+{
+ if(!panel)
+ return;
+ LLRect panel_rect = panel->getRect();
+ panel_rect.setLeftTopAndSize( left, top, width, height);
+ panel->reshape( width, height, 1);
+ panel->setRect(panel_rect);
+}
+
+
diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h
index 2e0260ab16..462ccc6d53 100644
--- a/indra/llui/llaccordionctrltab.h
+++ b/indra/llui/llaccordionctrltab.h
@@ -41,6 +41,7 @@ class LLUICtrlFactory;
class LLUIImage;
class LLButton;
class LLTextBox;
+class LLScrollbar;
@@ -84,6 +85,8 @@ public:
Optional<bool> header_visible;
+ Optional<bool> fit_panel;
+
Optional<S32> padding_left;
Optional<S32> padding_right;
Optional<S32> padding_top;
@@ -107,7 +110,7 @@ public:
//set LLAccordionCtrlTab panel
void setAccordionView(LLView* panel);
- LLView* getAccordionView();
+ LLView* getAccordionView() { return mContainerPanel; };
bool getCollapsible() {return mCollapsible;};
@@ -123,6 +126,8 @@ public:
S32 notify(const LLSD& info);
bool notifyChildren(const LLSD& info);
+ void draw();
+
void storeOpenCloseState ();
void restoreOpenCloseState ();
@@ -164,9 +169,26 @@ public:
void showAndFocusHeader();
-private:
+ void setFitPanel( bool fit ) { mFitPanel = true; }
-
+protected:
+ void adjustContainerPanel (const LLRect& child_rect);
+ void adjustContainerPanel ();
+ S32 getChildViewHeight ();
+
+ void onScrollPosChangeCallback(S32, LLScrollbar*);
+
+ void show_hide_scrollbar (const LLRect& child_rect);
+ void showScrollbar (const LLRect& child_rect);
+ void hideScrollbar (const LLRect& child_rect);
+
+ void updateLayout ( const LLRect& child_rect );
+ void ctrlSetLeftTopAndSize (LLView* panel, S32 left, S32 top, S32 width, S32 height);
+
+ void drawChild(const LLRect& root_rect,LLView* child);
+
+ LLView* findContainerView ();
+private:
class LLAccordionCtrlTabHeader;
LLAccordionCtrlTabHeader* mHeader; //Header
@@ -176,6 +198,7 @@ private:
bool mHeaderVisible;
bool mCanOpenClose;
+ bool mFitPanel;
S32 mPaddingLeft;
S32 mPaddingRight;
@@ -185,6 +208,8 @@ private:
bool mStoredOpenCloseState;
bool mWasStateStored;
+ LLScrollbar* mScrollbar;
+ LLView* mContainerPanel;
LLUIColor mDropdownBGColor;
};
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index b6d73cda3c..e91d753a39 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1554,7 +1554,12 @@ void LLFloater::onClickClose( LLFloater* self )
{
if (!self)
return;
- self->closeFloater(false);
+ self->onClickCloseBtn();
+}
+
+void LLFloater::onClickCloseBtn()
+{
+ closeFloater(false);
}
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 19e8288807..c1e8813f87 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -307,6 +307,8 @@ protected:
void destroy() { die(); } // Don't call this directly. You probably want to call closeFloater()
+ virtual void onClickCloseBtn();
+
private:
void setForeground(BOOL b); // called only by floaterview
void cleanupHandles(); // remove handles to dead floaters
@@ -346,6 +348,7 @@ protected:
LLResizeBar* mResizeBar[4];
LLResizeHandle* mResizeHandle[4];
+ LLButton* mButtons[BUTTON_COUNT];
private:
LLRect mExpandedRect;
@@ -379,7 +382,6 @@ private:
handle_set_t mDependents;
bool mButtonsEnabled[BUTTON_COUNT];
- LLButton* mButtons[BUTTON_COUNT];
F32 mButtonScale;
BOOL mAutoFocus;
LLHandle<LLFloater> mSnappedTo;
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 3cc92baa8d..d17be8b94a 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -185,6 +185,8 @@ LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p)
{
sCount++;
+ mTextWidth = getWidth();
+
// initialize rounded rect image
if (!mRoundedRectImage)
{
@@ -340,7 +342,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
0,
LLFontGL::NO_SHADOW,
string_chars,
- getWidth(),
+ getTextWidth(),
&right_x,
TRUE);
}
diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h
index 5fecf5aade..b1c8901fc4 100644
--- a/indra/llui/llscrolllistcell.h
+++ b/indra/llui/llscrolllistcell.h
@@ -151,11 +151,16 @@ public:
/*virtual*/ const std::string & getToolTip() const;
/*virtual*/ BOOL needsToolTip() const;
+ S32 getTextWidth() const { return mTextWidth;}
+ void setTextWidth(S32 value) { mTextWidth = value;}
+ virtual void setWidth(S32 width) { LLScrollListCell::setWidth(width); mTextWidth = width; }
+
void setText(const LLStringExplicit& text);
void setFontStyle(const U8 font_style);
private:
LLUIString mText;
+ S32 mTextWidth;
const LLFontGL* mFont;
LLColor4 mColor;
U8 mUseColor;
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index e819c5fdea..ebdc82115f 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -219,7 +219,10 @@ public:
void deselectAllItems(BOOL no_commit_on_change = FALSE); // by default, go ahead and commit on selection change
void clearHighlightedItems();
- void mouseOverHighlightNthItem( S32 index );
+
+ virtual void mouseOverHighlightNthItem( S32 index );
+
+ S32 getHighlightedItemInx() const { return mHighlightedItem; }
void setDoubleClickCallback( callback_t cb ) { mOnDoubleClickCallback = cb; }
void setMaximumSelectCallback( callback_t cb) { mOnMaximumSelectCallback = cb; }
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 30fc7babae..1dcfb4e296 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -2061,5 +2061,12 @@ void LLTabContainer::commitHoveredButton(S32 x, S32 y)
tuple->mButton->onCommit();
}
}
+ /**
+ * EXT - 4572 (Click and hold the left mouse button doesn't let you browse tabbed IM floater)
+ *
+ * During hovering mouse(with left mouse button hold) over tabs, a newly just activated corresponding
+ * to the tab(that is hovered in the given instant of time) panel may caught mouse capture.
+ */
+ gFocusMgr.setMouseCapture(this);
}
}