LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params)
{
    LLView* view = findChildView(panel_name, true);
    if (!view) return NULL;

    if (!getVisible())
    {
        openFloater();
    }

    LLPanel* panel = NULL;

    LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent());
    if (container)
    {
        LLSD new_params = params;
        new_params[LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME] = panel_name;
        container->onOpen(new_params);

        panel = container->getCurrentPanel();
    }
    else if ((panel = dynamic_cast<LLPanel*>(view)) != NULL)
    {
        panel->onOpen(params);
    }

    return panel;
}
/**
 * Activate tab with "panel_name" panel
 * if no such tab - return false, otherwise true.
 * TODO* In some cases a pointer to a panel of
 * a specific class may be needed so this method
 * would need to use templates.
 */
LLPanel*	LLSideTray::showPanel		(const std::string& panel_name, const LLSD& params)
{
	//arrange tabs
	child_vector_const_iter_t child_it;
	for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
	{
		LLView* view = (*child_it)->findChildView(panel_name,true);
		if(view)
		{
			selectTabByName	((*child_it)->getName());
			if(mCollapsed)
				expandSideBar();

			LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent());
			if(container)
			{
				LLSD new_params = params;
				new_params[LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME] = panel_name;
				container->onOpen(new_params);

				return container->getCurrentPanel();
			}

			LLPanel* panel = dynamic_cast<LLPanel*>(view);
			if(panel)
			{
				panel->onOpen(params);
			}
			return panel;
		}
	}
	return NULL;
}
void LLBadgeOwner::addBadgeToParentHolder()
{
	LLView * owner_view = mBadgeOwnerView.get();
	
	if (mBadge && owner_view)
	{
		LLBadgeHolder * badge_holder = NULL;

		// Find the appropriate holder for the badge
		LLView * parent = owner_view->getParent();

		while (parent)
		{
			LLBadgeHolder * badge_holder_panel = dynamic_cast<LLBadgeHolder *>(parent);

			if (badge_holder_panel && badge_holder_panel->acceptsBadge())
			{
				badge_holder = badge_holder_panel;
				break;
			}

			parent = parent->getParent();
		}

		if (badge_holder)
		{
			mHasBadgeHolderParent = badge_holder->addBadge(mBadge);
		}
	}
}
示例#4
0
void LLFloaterEditUI::refresh()
{
	LLView* view = LLView::sEditingUIView;

	// same selection
	if (view == mLastView) return;

	// user deselected
	if (!view) 
	{
		mLastView = NULL;
		mLabelLine->setText(LLStringUtil::null);
		mLabelLine->setEnabled(FALSE);
		mWidthSpin->set(0.f);
		mWidthSpin->setEnabled(FALSE);
		mHeightSpin->set(0.f);
		mHeightSpin->setEnabled(FALSE);
		return;
	}

	// HACK - don't allow widgets in this window to be selected
	LLView* parent = view->getParent();
	while (parent)
	{
		if (parent == this)
		{
			// user selected one of our children, slam them back
			LLView::sEditingUIView = mLastView;
			return;
		}
		parent = parent->getParent();
	}

	refreshCore();

	mLastView = view;
}
示例#5
0
LLPanel* LLSideTray::openChildPanel(LLSideTrayTab* tab, const std::string& panel_name, const LLSD& params)
{
	LLView* view = tab->findChildView(panel_name, true);
	if (!view) return NULL;

	std::string tab_name = tab->getName();

	bool tab_attached = isTabAttached(tab_name);

	if (tab_attached && LLUI::sSettingGroups["config"]->getBOOL("OpenSidePanelsInFloaters"))
	{
		tab->toggleTabDocked();
		tab_attached = false;
	}

	// Select tab and expand Side Tray only when a tab is attached.
	if (tab_attached)
	{
		selectTabByName(tab_name);
		if (mCollapsed)
			expandSideBar();
	}
	else
	{
		LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name);
		if (!floater_tab) return NULL;

		floater_tab->openFloater(tab_name);
	}

	LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent());
	if (container)
	{
		LLSD new_params = params;
		new_params[LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME] = panel_name;
		container->onOpen(new_params);

		return container->getCurrentPanel();
	}

	LLPanel* panel = dynamic_cast<LLPanel*>(view);
	if (panel)
	{
		panel->onOpen(params);
	}

	return panel;
}
示例#6
0
// Skip over any parents that are not LLUICtrl's
//  Used in focus logic since only LLUICtrl elements can have focus
LLUICtrl* LLUICtrl::getParentUICtrl() const
{
	LLView* parent = getParent();
	while (parent)
	{
		if (parent->isCtrl())
		{
			return (LLUICtrl*)(parent);
		}
		else
		{
			parent =  parent->getParent();
		}
	}
	return NULL;
}
示例#7
0
LLFloaterGotoLine::LLFloaterGotoLine(LLScriptEdCore* editor_core)
:       LLFloater(LLSD()),
        mGotoBox(NULL),
        mEditorCore(editor_core)
{
        buildFromFile("floater_goto_line.xml");

        sInstance = this;
        
        // find floater in which script panel is embedded
        LLView* viewp = (LLView*)editor_core;
        while(viewp)
        {
                LLFloater* floaterp = dynamic_cast<LLFloater*>(viewp);
                if (floaterp)
                {
                        floaterp->addDependentFloater(this);
                        break;
                }
                viewp = viewp->getParent();
        }
}
void LLFloaterSearchReplace::show(LLTextEditor* editor)
{
	if (!sInstance)
	{
		sInstance = new LLFloaterSearchReplace();
	}

	if ( (sInstance) && (editor) )
	{
		sInstance->mEditor = editor;

		LLFloater* newdependee, *olddependee = sInstance->getDependee();
		LLView* viewp = editor->getParent();
		while (viewp)
		{
			newdependee = dynamic_cast<LLFloater*>(viewp);
			if (newdependee)
			{
				if (newdependee != olddependee)
				{
					if (olddependee)
						olddependee->removeDependentFloater(sInstance);

					if (!newdependee->getHost())
						newdependee->addDependentFloater(sInstance);
					else
						newdependee->getHost()->addDependentFloater(sInstance);
				}
				break;
			}
			viewp = viewp->getParent();
		}

		sInstance->open();
	}
}
示例#9
0
void	LLFloaterEditUI::navigateHierarchyButtonPressed(void*	data)
{
	LLView* view = LLView::sEditingUIView;
	if( !view ) return;
	LLView*	parent = view->getParent();
	if(!parent)
	{
		return ;
	}
	const LLView::child_list_t*	viewChildren = view->getChildList();
	const LLView::child_list_t*	parentChildren = parent->getChildList();
	//LLView::child_list_t::iterator
	std::list<LLView*>::const_iterator	itor;
	std::list<LLView*>::size_type	idx;
	std::list<LLView*>::size_type	sidx;
	for(idx = 0,itor = parentChildren->begin();itor!=parentChildren->end();itor++,idx++){
		if((*itor)==view)break;
	}
	switch((intptr_t)data)
	{
		case	0	://up
			view = view->getParent();
		break;
		case	1	://down
			view = viewChildren->begin()!=viewChildren->end() ? (*viewChildren->begin()) : NULL;
		break;
		case	2	://left
		{			
			if(idx==0)
				idx = parentChildren->size()-1;
			else
				idx--;
			if( (long) idx < 0 || idx >= parentChildren->size())break;
			for(sidx = 0,itor = parentChildren->begin();itor!=parentChildren->end();itor++,sidx++){
				if(sidx == idx)
				{
					view = (*itor);
					break;
				}
			}
		}
		break;
		case	3	://right
		{
			if(idx==parentChildren->size()-1)
				idx = 0;
			else
				idx++;
			if( (long) idx < 0 || idx >= parentChildren->size())break;
			for(sidx = 0,itor = parentChildren->begin();itor!=parentChildren->end();itor++,sidx++){
				if(sidx == idx)
				{
					view = (*itor);
					break;
				}
			}
		}
		break;
	}
	if (view)
	{
		sEditingUIView = view;
		sInstance->refresh();
	}
}
示例#10
0
void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL keystrokes_only)
{
	// notes if keyboard focus is changed again (by onFocusLost/onFocusReceived)
    // making the rest of our processing unnecessary since it will already be
    // handled by the recursive call
	static bool focus_dirty;
	focus_dirty = false;

	if (mLockedView && 
		(new_focus == NULL || 
			(new_focus != mLockedView 
			&& dynamic_cast<LLView*>(new_focus)
			&& !dynamic_cast<LLView*>(new_focus)->hasAncestor(mLockedView))))
	{
		// don't allow focus to go to anything that is not the locked focus
		// or one of its descendants
		return;
	}

	mKeystrokesOnly = keystrokes_only;

	if( new_focus != mKeyboardFocus )
	{
		mLastKeyboardFocus = mKeyboardFocus;
		mKeyboardFocus = new_focus;

		// list of the focus and it's ancestors
		view_handle_list_t old_focus_list = mCachedKeyboardFocusList;
		view_handle_list_t new_focus_list;

		// walk up the tree to root and add all views to the new_focus_list
		for (LLView* ctrl = dynamic_cast<LLView*>(mKeyboardFocus); ctrl; ctrl = ctrl->getParent())
		{
			new_focus_list.push_back(ctrl->getHandle());
		}

		// remove all common ancestors since their focus is unchanged
		while (!new_focus_list.empty() &&
			   !old_focus_list.empty() &&
			   new_focus_list.back() == old_focus_list.back())
		{
			new_focus_list.pop_back();
			old_focus_list.pop_back();
		}

		// walk up the old focus branch calling onFocusLost
		// we bubble up the tree to release focus, and back down to add
		for (view_handle_list_t::iterator old_focus_iter = old_focus_list.begin();
			 old_focus_iter != old_focus_list.end() && !focus_dirty;
			 old_focus_iter++)
		{			
			LLView* old_focus_view = old_focus_iter->get();
			if (old_focus_view)
			{
				mCachedKeyboardFocusList.pop_front();
				old_focus_view->onFocusLost();
			}
		}

		// walk down the new focus branch calling onFocusReceived
		for (view_handle_list_t::reverse_iterator new_focus_riter = new_focus_list.rbegin();
			 new_focus_riter != new_focus_list.rend() && !focus_dirty;
			 new_focus_riter++)
		{			
			LLView* new_focus_view = new_focus_riter->get();
			if (new_focus_view)
			{
                mCachedKeyboardFocusList.push_front(new_focus_view->getHandle());
				new_focus_view->onFocusReceived();
			}
		}
		
		// if focus was changed as part of an onFocusLost or onFocusReceived call
		// stop iterating on current list since it is now invalid
		if (focus_dirty)
		{
			return;
		}

		// If we've got a default keyboard focus, and the caller is
		// releasing keyboard focus, move to the default.
		if (mDefaultKeyboardFocus != NULL && mKeyboardFocus == NULL)
		{
			mDefaultKeyboardFocus->setFocus(TRUE);
		}

		LLView* focus_subtree = dynamic_cast<LLView*>(mKeyboardFocus);
		LLView* viewp = dynamic_cast<LLView*>(mKeyboardFocus);
		// find root-most focus root
		while(viewp)
		{
			if (viewp->isFocusRoot())
			{
				focus_subtree = viewp;
			}
			viewp = viewp->getParent();
		}

		
		if (focus_subtree)
		{
			LLView* focused_view = dynamic_cast<LLView*>(mKeyboardFocus);
			mFocusHistory[focus_subtree->getHandle()] = focused_view ? focused_view->getHandle() : LLHandle<LLView>(); 
		}
	}
	
	if (lock)
	{
		lockFocus();
	}

	focus_dirty = true;
}
示例#11
0
void LLFocusMgr::setKeyboardFocus(LLUICtrl* new_focus, BOOL lock, BOOL keystrokes_only)
{
	if (mLockedView && 
		(new_focus == NULL || 
			(new_focus != mLockedView && !new_focus->hasAncestor(mLockedView))))
	{
		// don't allow focus to go to anything that is not the locked focus
		// or one of its descendants
		return;
	}

	//llinfos << "Keyboard focus handled by " << (new_focus ? new_focus->getName() : "nothing") << llendl;

	mKeystrokesOnly = keystrokes_only;

	if( new_focus != mKeyboardFocus )
	{
		mLastKeyboardFocus = mKeyboardFocus;
		mKeyboardFocus = new_focus;

		if( mLastKeyboardFocus )
		{
			mLastKeyboardFocus->onFocusLost();
		}

		// clear out any existing flash
		if (new_focus)
		{
			mFocusWeight = 0.f;
			new_focus->onFocusReceived();
		}
		mFocusTimer.reset();

		#ifdef _DEBUG
			mKeyboardFocusName = new_focus ? new_focus->getName() : std::string("none");
		#endif

		// If we've got a default keyboard focus, and the caller is
		// releasing keyboard focus, move to the default.
		if (mDefaultKeyboardFocus != NULL && mKeyboardFocus == NULL)
		{
			mDefaultKeyboardFocus->setFocus(TRUE);
		}

		LLView* focus_subtree = mKeyboardFocus;
		LLView* viewp = mKeyboardFocus;
		// find root-most focus root
		while(viewp)
		{
			if (viewp->isFocusRoot())
			{
				focus_subtree = viewp;
			}
			viewp = viewp->getParent();
		}

		
		if (focus_subtree)
		{
			mFocusHistory[focus_subtree->getHandle()] = mKeyboardFocus ? mKeyboardFocus->getHandle() : LLHandle<LLView>(); 
		}
	}
	
	if (lock)
	{
		lockFocus();
	}
}