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();
}
void LLAccordionCtrl::expandDefaultTab()
{
	if (mAccordionTabs.size() > 0)
	{
		LLAccordionCtrlTab* tab = mAccordionTabs.front();

		if (!tab->getDisplayChildren())
		{
			tab->setDisplayChildren(true);
		}

		for (size_t i = 1; i < mAccordionTabs.size(); ++i)
		{
			tab = mAccordionTabs[i];

			if (tab->getDisplayChildren())
			{
				tab->setDisplayChildren(false);
			}
		}

		arrange();
	}
}
Beispiel #4
0
static LLPanel *childGetVisibleTabWithHelp(LLView *parent)
{
	LLView *child;

	// look through immediate children first for an active tab with help
	for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
	{
		LLPanel *curTabPanel = NULL;

		// do we have a tab container?
		LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child);
		if (tab && tab->getVisible())
		{
			curTabPanel = tab->getCurrentPanel();
		}

		// do we have an accordion tab?
		LLAccordionCtrlTab* accordion = dynamic_cast<LLAccordionCtrlTab *>(child);
		if (accordion && accordion->getDisplayChildren())
		{
			curTabPanel = dynamic_cast<LLPanel *>(accordion->getAccordionView());
		}

		// if we found a valid tab, does it have a help topic?
		if (curTabPanel && !curTabPanel->getHelpTopic().empty())
		{
			return curTabPanel;
		}
	}

	// then try a bit harder and recurse through all children
	for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
	{
		if (child->getVisible())
		{
			LLPanel* tab = ::childGetVisibleTabWithHelp(child);
			if (tab)
			{
				return tab;
			}
		}
	}

	// couldn't find any active tabs with a help topic string
	return NULL;
}
Beispiel #5
0
bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const
{
	S32 tabs_cnt = mItemContainers.size();

	bool has_expanded_tabs = false;
	bool has_collapsed_tabs = false;

	for (S32 n = 0; n < tabs_cnt; n++)
	{
		LLAccordionCtrlTab* tab = mItemContainers.get(n);
		if (!tab->getVisible())
			continue;

		if (tab->getDisplayChildren())
		{
			has_expanded_tabs = true;
		}
		else
		{
			has_collapsed_tabs = true;
		}

		if (has_expanded_tabs && has_collapsed_tabs)
		{
			break;
		}
	}

	std::string command_name = userdata.asString();

	if (has_expanded_tabs && command_name == "collapse_all")
	{
		return true;
	}

	if (has_collapsed_tabs && command_name ==  "expand_all")
	{
		return true;
	}

	return false;
}
Beispiel #6
0
LLPanel* LLPanel::childGetVisibleTabWithHelp()
{
	LLView *child;

	bfs_tree_iterator_t it = beginTreeBFS();
	// skip ourselves
	++it;
	for (; it != endTreeBFS(); ++it)
	{
		child = *it;
		LLPanel *curTabPanel = NULL;

		// do we have a tab container?
		LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child);
		if (tab && tab->getVisible())
		{
			curTabPanel = tab->getCurrentPanel();
		}

		// do we have an accordion tab?
		LLAccordionCtrlTab* accordion = dynamic_cast<LLAccordionCtrlTab *>(child);
		if (accordion && accordion->getDisplayChildren())
		{
			curTabPanel = dynamic_cast<LLPanel *>(accordion->getAccordionView());
		}

		// if we found a valid tab, does it have a help topic?
		if (curTabPanel && !curTabPanel->getHelpTopic().empty())
		{
			return curTabPanel;
		}
	}

	// couldn't find any active tabs with a help topic string
	return NULL;
}