Ejemplo n.º 1
0
//virtual
BOOL LLAccordionCtrlTab::postBuild()
{
	if(mHeader)
		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);
	}

	if(mContainerPanel)
		mContainerPanel->setVisible(mDisplayChildren);

	return LLUICtrl::postBuild();
}
// Default constructor
LLScrollContainer::LLScrollContainer(const LLScrollContainer::Params& p)
:	LLUICtrl(p),
	mAutoScrolling( FALSE ),
	mAutoScrollRate( 0.f ),
	mBackgroundColor(p.bg_color()),
	mIsOpaque(p.is_opaque),
	mHideScrollbar(p.hide_scrollbar),
	mReserveScrollCorner(p.reserve_scroll_corner),
	mMinAutoScrollRate(p.min_auto_scroll_rate),
	mMaxAutoScrollRate(p.max_auto_scroll_rate),
	mScrolledView(NULL)
{
	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
	LLRect border_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 );
	LLViewBorder::Params params;
	params.name("scroll border");
	params.rect(border_rect);
	params.visible(p.border_visible);
	params.bevel_style(LLViewBorder::BEVEL_IN);
	mBorder = LLUICtrlFactory::create<LLViewBorder> (params);
	LLView::addChild( mBorder );

	mInnerRect.set( 0, getRect().getHeight(), getRect().getWidth(), 0 );
	mInnerRect.stretch( -getBorderWidth()  );

	LLRect vertical_scroll_rect = mInnerRect;
	vertical_scroll_rect.mLeft = vertical_scroll_rect.mRight - scrollbar_size;
	LLScrollbar::Params sbparams;
	sbparams.name("scrollable vertical");
	sbparams.rect(vertical_scroll_rect);
	sbparams.orientation(LLScrollbar::VERTICAL);
	sbparams.doc_size(mInnerRect.getHeight());
	sbparams.doc_pos(0);
	sbparams.page_size(mInnerRect.getHeight());
	sbparams.step_size(VERTICAL_MULTIPLE);
	sbparams.follows.flags(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM);
	sbparams.visible(false);
	sbparams.change_callback(p.scroll_callback);
	mScrollbar[VERTICAL] = LLUICtrlFactory::create<LLScrollbar> (sbparams);
	LLView::addChild( mScrollbar[VERTICAL] );
	
	LLRect horizontal_scroll_rect = mInnerRect;
	horizontal_scroll_rect.mTop = horizontal_scroll_rect.mBottom + scrollbar_size;
	sbparams.name("scrollable horizontal");
	sbparams.rect(horizontal_scroll_rect);
	sbparams.orientation(LLScrollbar::HORIZONTAL);
	sbparams.doc_size(mInnerRect.getWidth());
	sbparams.doc_pos(0);
	sbparams.page_size(mInnerRect.getWidth());
	sbparams.step_size(VERTICAL_MULTIPLE);
	sbparams.visible(false);
	sbparams.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT);
	sbparams.change_callback(p.scroll_callback);
	mScrollbar[HORIZONTAL] = LLUICtrlFactory::create<LLScrollbar> (sbparams);
	LLView::addChild( mScrollbar[HORIZONTAL] );
}
Ejemplo n.º 3
0
//---------------------------------------------------------------------------------
BOOL LLAccordionCtrl::postBuild()
{
	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);

	LLRect scroll_rect;
	scroll_rect.setOriginAndSize( 
		getRect().getWidth() - scrollbar_size,
		1,
		scrollbar_size,
		getRect().getHeight() - 1);
	
	LLScrollbar::Params sbparams;
	sbparams.name("scrollable vertical");
	sbparams.rect(scroll_rect);
	sbparams.orientation(LLScrollbar::VERTICAL);
	sbparams.doc_size(mInnerRect.getHeight());
	sbparams.doc_pos(0);
	sbparams.page_size(mInnerRect.getHeight());
	sbparams.step_size(VERTICAL_MULTIPLE);
	sbparams.follows.flags(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM);
	sbparams.change_callback(boost::bind(&LLAccordionCtrl::onScrollPosChangeCallback, this, _1, _2));
	
	mScrollbar = LLUICtrlFactory::create<LLScrollbar> (sbparams);
	LLView::addChild( mScrollbar );
	mScrollbar->setVisible( false );
	mScrollbar->setFollowsRight();
	mScrollbar->setFollowsTop();
	mScrollbar->setFollowsBottom();

	//if it was created from xml...
	std::vector<LLUICtrl*> accordion_tabs;
	for(child_list_const_iter_t it = getChildList()->begin(); 
		getChildList()->end() != it; ++it)
	{
		LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(*it);
		if(accordion_tab == NULL)
			continue;
		if(std::find(mAccordionTabs.begin(),mAccordionTabs.end(),accordion_tab) == mAccordionTabs.end())
		{
			accordion_tabs.push_back(accordion_tab);
		}
	}

	for(std::vector<LLUICtrl*>::reverse_iterator it = accordion_tabs.rbegin();it!=accordion_tabs.rend();++it)
		addCollapsibleCtrl(*it);

	arrange	();

	if(mSingleExpansion)
	{
		if(!mAccordionTabs[0]->getDisplayChildren())
			mAccordionTabs[0]->setDisplayChildren(true);
		for(size_t i=1;i<mAccordionTabs.size();++i)
		{
			if(mAccordionTabs[i]->getDisplayChildren())
				mAccordionTabs[i]->setDisplayChildren(false);
		}
	}

	updateNoTabsHelpTextVisibility();

	return TRUE;
}