예제 #1
0
void	LLAccordionCtrl::arrangeMultiple()
{
	S32 panel_left = BORDER_MARGIN;	  // Margin from left side of Splitter
	S32 panel_top = getRect().getHeight() - BORDER_MARGIN;		  // Top coordinate of the first panel
	S32 panel_width = getRect().getWidth() - 4;		  // Top coordinate of the first panel

	//Calculate params	
	for(size_t i = 0; i < mAccordionTabs.size(); i++ )
	{
		LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
		
		if(accordion_tab->getVisible() == false) //skip hidden accordion tabs
			continue;
		
		if(!accordion_tab->isExpanded() )
		{
			ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, accordion_tab->getRect().getHeight());
			panel_top-=mAccordionTabs[i]->getRect().getHeight();
		}
		else
		{
			S32 panel_height = accordion_tab->getRect().getHeight();
			
			if(mFitParent)
			{
				// all expanded tabs will have equal height
				panel_height = calcExpandedTabHeight(i, panel_top);
				ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height);

				// try to make accordion tab fit accordion view height.
				// Accordion View should implement getRequiredRect() and provide valid height
				S32 optimal_height = accordion_tab->getAccordionView()->getRequiredRect().getHeight();
				optimal_height += accordion_tab->getHeaderHeight() + 2 * BORDER_MARGIN;
				if(optimal_height < panel_height)
				{
					panel_height = optimal_height;
				}

				// minimum tab height is equal to header height
				if(mAccordionTabs[i]->getHeaderHeight() > panel_height)
				{
					panel_height = mAccordionTabs[i]->getHeaderHeight();
				}
			}
			
			ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height);
			panel_top-=panel_height;
			
		}
	}	

	show_hide_scrollbar(getRect().getWidth(),getRect().getHeight());

	updateLayout(getRect().getWidth(),getRect().getHeight());
}
예제 #2
0
void	LLAccordionCtrl::hideScrollbar( S32 width, S32 height )
{
	if(mScrollbar->getVisible() == false)
		return;
	mScrollbar->setVisible(false);

	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);

	S32 panel_width = width - 2*BORDER_MARGIN;

	//reshape all accordeons and shift all draggers
	for(size_t i=0;i<mAccordionTabs.size();++i)
	{
		LLRect panel_rect = mAccordionTabs[i]->getRect();
		ctrlSetLeftTopAndSize(mAccordionTabs[i],panel_rect.mLeft,panel_rect.mTop,panel_width,panel_rect.getHeight());
	}

	mScrollbar->setDocPos(0);

	if(mAccordionTabs.size()>0)
	{
		S32 panel_top = height - BORDER_MARGIN;		  // Top coordinate of the first panel
		S32 diff = panel_top - mAccordionTabs[0]->getRect().mTop;
		shiftAccordionTabs(0,diff);
	}
}
예제 #3
0
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 LLAccordionCtrl::arrange()
{
	if( mAccordionTabs.size() == 0)
	{
		//We do not arrange if we do not have what should be arranged
		return;
	}


	if(mAccordionTabs.size() == 1)
	{
		S32 panel_top = getRect().getHeight() - BORDER_MARGIN;		  // Top coordinate of the first panel
		S32 panel_width = getRect().getWidth() - 4;		  // Top coordinate of the first panel
		
		LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[0]);
		
		LLRect panel_rect = accordion_tab->getRect();
		
		S32 panel_height = getRect().getHeight() - 2*BORDER_MARGIN;

		ctrlSetLeftTopAndSize(accordion_tab,panel_rect.mLeft,panel_top,panel_width,panel_height);
		
		show_hide_scrollbar(getRect().getWidth(),getRect().getHeight());
		return;

	}

	if(mSingleExpansion)
		arrangeSinge ();
	else
		arrangeMultiple ();
}
예제 #5
0
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	LLAccordionCtrl::arrangeSinge()
{
	S32 panel_left = BORDER_MARGIN;	  // Margin from left side of Splitter
	S32 panel_top = getRect().getHeight() - BORDER_MARGIN;		  // Top coordinate of the first panel
	S32 panel_width = getRect().getWidth() - 4;		  // Top coordinate of the first panel
	S32 panel_height;

	S32 collapsed_height = 0;

	for(size_t i=0;i<mAccordionTabs.size();++i)
	{
		LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
		
		if(accordion_tab->getVisible() == false) //skip hidden accordion tabs
			continue;
		if(!accordion_tab->isExpanded() )
		{
			collapsed_height+=mAccordionTabs[i]->getRect().getHeight();
		}
	}

	S32 expanded_height = getRect().getHeight() - BORDER_MARGIN - collapsed_height;
	
	for(size_t i=0;i<mAccordionTabs.size();++i)
	{
		LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
		
		if(accordion_tab->getVisible() == false) //skip hidden accordion tabs
			continue;
		if(!accordion_tab->isExpanded() )
		{
			panel_height = accordion_tab->getRect().getHeight();
		}
		else
		{
			panel_height = expanded_height;
		}
		ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height);
		panel_top-=mAccordionTabs[i]->getRect().getHeight();
	}
}
예제 #7
0
void	LLAccordionCtrl::updateLayout	(S32 width, S32 height)
{
	S32 panel_top = height - BORDER_MARGIN ;
	if(mScrollbar->getVisible())
		panel_top+=mScrollbar->getDocPos();

	S32 panel_width = width - 2*BORDER_MARGIN;

	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
	if(mScrollbar->getVisible())
		panel_width-=scrollbar_size;

	//set sizes for first panels and dragbars
	for(size_t i=0;i<mAccordionTabs.size();++i)
	{
		if(!mAccordionTabs[i]->getVisible())
			continue;
		LLRect panel_rect = mAccordionTabs[i]->getRect();
		ctrlSetLeftTopAndSize(mAccordionTabs[i],panel_rect.mLeft,panel_top,panel_width,panel_rect.getHeight());
		panel_top-=panel_rect.getHeight();
	}
}
예제 #8
0
void	LLAccordionCtrl::showScrollbar(S32 width, S32 height)
{
	bool was_visible = mScrollbar->getVisible();

	mScrollbar->setVisible(true);
	
	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);

	ctrlSetLeftTopAndSize(mScrollbar
		,width-scrollbar_size - PARENT_BORDER_MARGIN/2
		,height-PARENT_BORDER_MARGIN
		,scrollbar_size
		,height-2*PARENT_BORDER_MARGIN);
	
	mScrollbar->setPageSize(height);
	mScrollbar->setDocParams(mInnerRect.getHeight(),mScrollbar->getDocPos());

	if(was_visible)
	{
		S32 scroll_pos = llmin(mScrollbar->getDocPos(), getRecuiredHeight() - height - 1);
		mScrollbar->setDocPos(scroll_pos);
	}
}
예제 #9
0
void	LLAccordionCtrl::arrangeSinge()
{
	S32 panel_left = BORDER_MARGIN;	  // Margin from left side of Splitter
	S32 panel_top = getRect().getHeight() - BORDER_MARGIN;		  // Top coordinate of the first panel
	S32 panel_width = getRect().getWidth() - 4;		  // Top coordinate of the first panel
	S32 panel_height;

	S32 collapsed_height = 0;

	for(size_t i=0;i<mAccordionTabs.size();++i)
	{
		LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
		
		if(accordion_tab->getVisible() == false) //skip hidden accordion tabs
			continue;
		if(!accordion_tab->isExpanded() )
		{
			collapsed_height+=mAccordionTabs[i]->getRect().getHeight();
		}
	}

	S32 expanded_height = getRect().getHeight() - BORDER_MARGIN - collapsed_height;
	
	for(size_t i=0;i<mAccordionTabs.size();++i)
	{
		LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
		
		if(accordion_tab->getVisible() == false) //skip hidden accordion tabs
			continue;
		if(!accordion_tab->isExpanded() )
		{
			panel_height = accordion_tab->getRect().getHeight();
		}
		else
		{
			if(mFitParent)
			{
				panel_height = expanded_height;
			}
			else
			{
				if(accordion_tab->getAccordionView())
				{
					panel_height = accordion_tab->getAccordionView()->getRect().getHeight() + 
						accordion_tab->getHeaderHeight() + 2*BORDER_MARGIN;
				}
				else
				{
					panel_height = accordion_tab->getRect().getHeight();
				}
			}
		}

		// make sure at least header is shown
		panel_height = llmax(panel_height, accordion_tab->getHeaderHeight());

		ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height);
		panel_top-=mAccordionTabs[i]->getRect().getHeight();
	}

	show_hide_scrollbar(getRect().getWidth(), getRect().getHeight());
	updateLayout(getRect().getWidth(), getRect().getHeight());
}