CHUI-53 FIXED vertical scroll bar in inventory floater to appear when horizontal scroll bar hides last item in folder view.

Added a scroll container which provides the information about the height of currently displayed folder view contents. It is used for updating vertical scroll bar visibility in inventory panel.
meow-7.2.2
Seth ProductEngine 2012-03-16 01:08:20 +02:00
parent b9521a38f1
commit 34c599858b
6 changed files with 69 additions and 9 deletions

View File

@ -389,10 +389,17 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height
{
*show_h_scrollbar = TRUE;
*visible_height -= scrollbar_size;
// Note: Do *not* recompute *show_v_scrollbar here because with
// the (- scrollbar_size) we just did we will always add a vertical scrollbar
// even if the height of the items is actually less than the visible size.
// Fear not though: there's enough calcVisibleSize() calls to add a vertical slider later.
// The view inside the scroll container should not be extended
// to container's full height to ensure the correct computation
// of *show_v_scrollbar after subtracting horizontal scrollbar_size.
// Must retest now that visible_height has changed
if( !*show_v_scrollbar && ((doc_height - *visible_height) > 1) )
{
*show_v_scrollbar = TRUE;
*visible_width -= scrollbar_size;
}
}
}
}

View File

@ -91,7 +91,7 @@ public:
void setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; }
LLRect getVisibleContentRect();
LLRect getContentWindowRect();
const LLRect& getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
virtual const LLRect getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
void pageUp(S32 overlap = 0);
void pageDown(S32 overlap = 0);
void goToTop();
@ -116,6 +116,9 @@ public:
bool autoScroll(S32 x, S32 y);
protected:
LLView* mScrolledView;
private:
// internal scrollbar handlers
virtual void scrollHorizontal( S32 new_pos );
@ -124,7 +127,6 @@ private:
void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
LLScrollbar* mScrollbar[SCROLLBAR_COUNT];
LLView* mScrolledView;
S32 mSize;
BOOL mIsOpaque;
LLUIColor mBackgroundColor;

View File

@ -164,6 +164,33 @@ void LLCloseAllFoldersFunctor::doFolder(LLFolderViewFolder* folder)
void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item)
{ }
///----------------------------------------------------------------------------
/// Class LLFolderViewScrollContainer
///----------------------------------------------------------------------------
// virtual
const LLRect LLFolderViewScrollContainer::getScrolledViewRect() const
{
LLRect rect = LLRect::null;
if (mScrolledView)
{
LLFolderView* folder_view = dynamic_cast<LLFolderView*>(mScrolledView);
if (folder_view)
{
S32 height = folder_view->mRunningHeight;
rect = mScrolledView->getRect();
rect.setLeftTopAndSize(rect.mLeft, rect.mTop, rect.getWidth(), height);
}
}
return rect;
}
LLFolderViewScrollContainer::LLFolderViewScrollContainer(const LLScrollContainer::Params& p)
: LLScrollContainer(p)
{}
///----------------------------------------------------------------------------
/// Class LLFolderView
///----------------------------------------------------------------------------
@ -535,6 +562,7 @@ void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent)
{
width = scroll_rect.getWidth();
}
LLView::reshape(width, height, called_from_parent);
mReshapeSignal(mSelectedItems, FALSE);
}

View File

@ -44,6 +44,7 @@
#include "lldepthstack.h"
#include "lleditmenuhandler.h"
#include "llfontgl.h"
#include "llscrollcontainer.h"
#include "lltooldraganddrop.h"
#include "llviewertexture.h"
@ -54,10 +55,28 @@ class LLInventoryModel;
class LLPanel;
class LLLineEditor;
class LLMenuGL;
class LLScrollContainer;
class LLUICtrl;
class LLTextBox;
/**
* Class LLFolderViewScrollContainer
*
* A scroll container which provides the information about the height
* of currently displayed folder view contents.
* Used for updating vertical scroll bar visibility in inventory panel.
* See LLScrollContainer::calcVisibleSize().
*/
class LLFolderViewScrollContainer : public LLScrollContainer
{
public:
/*virtual*/ ~LLFolderViewScrollContainer() {};
/*virtual*/ const LLRect getScrolledViewRect() const;
protected:
LLFolderViewScrollContainer(const LLScrollContainer::Params& p);
friend class LLUICtrlFactory;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLFolderView
//
@ -81,6 +100,9 @@ public:
Params();
};
friend class LLFolderViewScrollContainer;
LLFolderView(const Params&);
virtual ~LLFolderView( void );

View File

@ -206,10 +206,11 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
LLScrollContainer::Params scroller_params(params.scroll());
scroller_params.rect(scroller_view_rect);
mScroller = LLUICtrlFactory::create<LLScrollContainer>(scroller_params);
mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params);
addChild(mScroller);
mScroller->addChild(mFolderRoot);
mFolderRoot->setScrollContainer(mScroller);
mFolderRoot->setFollowsAll();
mFolderRoot->addChild(mFolderRoot->mStatusTextBox);
}

View File

@ -1568,7 +1568,7 @@ void LLPanelObjectInventory::reset()
scroll_p.rect(scroller_rect);
scroll_p.tab_stop(true);
scroll_p.follows.flags(FOLLOWS_ALL);
mScroller = LLUICtrlFactory::create<LLScrollContainer>(scroll_p);
mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroll_p);
addChild(mScroller);
mScroller->addChild(mFolders);