Exemple #1
0
void LLPanelPicks::showAccordion(const std::string& name, bool show)
{
	LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(name);
	tab->setVisible(show);
	LLAccordionCtrl* acc = getChild<LLAccordionCtrl>("accordion");
	acc->arrange();
}
LLFolderViewItem* LLLandmarksPanel::selectItemInAccordionTab(LLPlacesInventoryPanel* inventory_list,
															 const std::string& tab_name,
															 const LLUUID& obj_id,
															 BOOL take_keyboard_focus) const
{
	if (!inventory_list)
		return NULL;

	LLFolderView* root = inventory_list->getRootFolder();

	LLFolderViewItem* item = inventory_list->getItemByID(obj_id);
	if (!item)
		return NULL;

	LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(tab_name);
	if (!tab->isExpanded())
	{
		tab->changeOpenClose(false);
	}

	root->setSelection(item, FALSE, take_keyboard_focus);

	LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion");
	LLRect screen_rc;
	localRectToScreen(item->getRect(), &screen_rc);
	accordion->notifyParent(LLSD().with("scrollToShowRect", screen_rc.getValue()));

	return item;
}
S32	LLAccordionCtrlTab::notifyParent(const LLSD& info)
{
	if(info.has("action"))
	{
		std::string str_action = info["action"];
		if(str_action == "size_changes")
		{
			//
			S32 height = info["height"];
			height = llmax(height,10) + HEADER_HEIGHT + getPaddingTop() + getPaddingBottom();
			
			mExpandedHeight = height;
			
			if(isExpanded())
			{
				LLRect panel_rect = getRect();
				panel_rect.setLeftTopAndSize( panel_rect.mLeft, panel_rect.mTop, panel_rect.getWidth(), height);
				reshape(getRect().getWidth(),height);
				setRect(panel_rect);
			}
			
			//LLAccordionCtrl should rearrange accordion tab if one of accordion change its size
			if (getParent()) // A parent may not be set if tabs are added dynamically.
				getParent()->notifyParent(info);
			return 1;
		}
		else if(str_action == "select_prev") 
		{
			showAndFocusHeader();
			return 1;
		}
	}
	else if (info.has("scrollToShowRect"))
	{
		LLAccordionCtrl* parent = dynamic_cast<LLAccordionCtrl*>(getParent());
		if (parent && parent->getFitParent())
		{
			//	EXT-8285 ('No attachments worn' text appears at the bottom of blank 'Attachments' accordion)
			//	The problem was in passing message "scrollToShowRect" IN LLAccordionCtrlTab::notifyParent
			//	FROM child LLScrollContainer TO parent LLAccordionCtrl with "it_parent" set to true.

			//	It is wrong notification for parent accordion which leads to recursive call of adjustContainerPanel
			//	As the result of recursive call of adjustContainerPanel we got LLAccordionCtrlTab
			//	that reshaped and re-sized with different rectangles.

			//	LLAccordionCtrl has own scrollContainer and LLAccordionCtrlTab has own scrollContainer
			//	both should handle own scroll container's event.
			//	So, if parent accordion "fit_parent" accordion tab should handle its scroll container events itself.

			return 1;
		}
	}

	return LLUICtrl::notifyParent(info);
}
Exemple #4
0
void LLPanelPeople::showFriendsAccordionsIfNeeded()
{
	if(FRIENDS_TAB_NAME == getActiveTabName())
	{
		// Expand and show accordions if needed, else - hide them
		showAccordion("tab_online", mOnlineFriendList->filterHasMatches());
		showAccordion("tab_all", mAllFriendList->filterHasMatches());

		// Rearrange accordions
		LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion");
		accordion->arrange();

		// *TODO: new no_matched_tabs_text attribute was implemented in accordion (EXT-7368).
		// this code should be refactored to use it
		// keep help text in a synchronization with accordions visibility.
		updateFriendListHelpText();
	}
}
void LLFacebookFriendsPanel::showFriendsAccordionsIfNeeded()
{
    // Show / hide the status text : needs to be done *before* showing / hidding the accordions
    if (!mSecondLifeFriends->filterHasMatches() && !mSuggestedFriends->filterHasMatches())
    {
        // Show some explanation text if the lists are empty...
        mFriendsStatusCaption->setVisible(true);
        if (LLFacebookConnect::instance().isConnected())
        {
            //...you're connected to FB but have no friends :(
            mFriendsStatusCaption->setText(getString("facebook_friends_empty"));
        }
        else
        {
            //...you're not connected to FB
            mFriendsStatusCaption->setText(getString("facebook_friends_no_connected"));
        }
        // Hide the lists
        getChild<LLAccordionCtrl>("friends_accordion")->setVisible(false);
        getChild<LLAccordionCtrlTab>("tab_second_life_friends")->setVisible(false);
        getChild<LLAccordionCtrlTab>("tab_suggested_friends")->setVisible(false);
    }
    else
    {
        // We have something in the lists, hide the explanatory text
        mFriendsStatusCaption->setVisible(false);
        
        // Show the lists
        LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion");
        accordion->setVisible(true);
        
        // Expand and show accordions if needed, else - hide them
        getChild<LLAccordionCtrlTab>("tab_second_life_friends")->setVisible(mSecondLifeFriends->filterHasMatches());
        getChild<LLAccordionCtrlTab>("tab_suggested_friends")->setVisible(mSuggestedFriends->filterHasMatches());
        
        // Rearrange accordions
        accordion->arrange();
    }
}