Ejemplo n.º 1
0
BOOL LLAccordionCtrlTab::LLAccordionCtrlTabHeader::handleDragAndDrop(S32 x, S32 y, MASK mask,
																	 BOOL drop,
																	 EDragAndDropType cargo_type,
																	 void* cargo_data,
																	 EAcceptance* accept,
																	 std::string& tooltip_msg)
{
	LLAccordionCtrlTab* parent = dynamic_cast<LLAccordionCtrlTab*>(getParent());

	if ( parent && !parent->getDisplayChildren() && parent->getCollapsible() && parent->canOpenClose() )
	{
		if (mAutoOpenTimer.getStarted())
		{
			if (mAutoOpenTimer.getElapsedTimeF32() > AUTO_OPEN_TIME)
			{
				parent->changeOpenClose(false);
				mAutoOpenTimer.stop();
				return TRUE;
			}
		}
		else
			mAutoOpenTimer.start();
	}

	return LLUICtrl::handleDragAndDrop(x, y, mask, drop, cargo_type,
									   cargo_data, accept, tooltip_msg);
}
void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw()
{
	S32 width = getRect().getWidth();
	S32 height = getRect().getHeight();

	F32 alpha = getCurrentTransparency();
	gl_rect_2d(0,0,width - 1 ,height - 1,mHeaderBGColor.get() % alpha,true);

	LLAccordionCtrlTab* parent = dynamic_cast<LLAccordionCtrlTab*>(getParent());
	bool collapsible = (parent && parent->getCollapsible());
	bool expanded = (parent && parent->getDisplayChildren());

	// Handle overlay images, if needed
	// 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
		/*&& !(collapsible && !expanded)*/ // WHY??
		)
	{
		mImageHeaderFocused->draw(0,0,width,height);
	}
	else
	{
		mImageHeader->draw(0,0,width,height);
	}

	if(mNeedsHighlight)
	{
		mImageHeaderOver->draw(0,0,width,height);
	}
	

	if(collapsible)
	{
		LLPointer<LLUIImage> overlay_image;
		if(expanded)
		{
			overlay_image = mImageExpanded;
		}
		else
		{
			overlay_image = mImageCollapsed;
		}
		overlay_image->draw(HEADER_IMAGE_LEFT_OFFSET,
							(height - overlay_image->getHeight()) / 2);
	}
	
	LLUICtrl::draw();
}