コード例 #1
0
BOOL LLPanelGroup::postBuild()
{
	mTabContainer = getChild<LLTabContainer>("group_tab_container");

	if (mTabContainer)
	{
		// Select the initial tab specified via constructor
		const BOOL recurse = TRUE;
		LLPanelGroupTab* tabp = 
			getChild<LLPanelGroupTab>(mInitialTab, recurse);

		if (!tabp)
		{
			//our initial tab selection was invalid, just select the
			//first tab then or default to selecting the initial
			//selected tab specified in the layout file
			tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();

			//no tab was initially selected through constructor
			//or the XML, select the first tab
			if (!tabp)
			{
				mTabContainer->selectFirstTab();
				tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();
			}
		}
		else
		{
			mTabContainer->selectTabPanel(tabp);
		}

		mCurrentTab = tabp;

		// Add click callbacks.
		S32 i;
		S32 tab_count = mTabContainer->getTabCount();

		for (i = tab_count - 1; i >=0; --i)
		{
			LLPanel* tab_panel = mTabContainer->getPanelByIndex(i);
			LLPanelGroupTab* panelp =(LLPanelGroupTab*)tab_panel; // bit of a hack

			// Pass on whether or not to allow edit to tabs.
			panelp->setAllowEdit(mAllowEdit);
			panelp->addObserver(this);

			mTabContainer->setTabChangeCallback(panelp, onClickTab);
			mTabContainer->setTabUserData(panelp, this);
		}
		updateTabVisibility();

		// Act as though this tab was just activated.
		mCurrentTab->activate();
	}

	mDefaultNeedsApplyMesg = getString("default_needs_apply_text");
	mWantApplyMesg = getString("want_apply_text");

	LLButton* button = getChild<LLButton>("btn_ok");
	if (button)
	{
		button->setClickedCallback(onBtnOK);
		button->setCallbackUserData(this);
		button->setVisible(mAllowEdit);
	}
	
	button = getChild<LLButton>("btn_cancel");
	if (button)
	{
		button->setClickedCallback(onBtnCancel);
	   	button->setCallbackUserData(this);
		button->setVisible(mAllowEdit);
	}

	button = getChild<LLButton>("btn_apply");
	if (button)
	{
		button->setClickedCallback(onBtnApply);
		button->setVisible(mAllowEdit);
		button->setEnabled(FALSE);

		mApplyBtn = button;
	}

	button = getChild<LLButton>("btn_refresh");
	if (button)
	{
		button->setClickedCallback(onBtnRefresh);
		button->setCallbackUserData(this);
		button->setVisible(mAllowEdit);
	}

	return TRUE;
}
コード例 #2
0
BOOL LLPanelGroup::postBuild()
{
	mTabContainer = getChild<LLTabContainer>("group_tab_container");

	if (mTabContainer)
	{
		//our initial tab selection was invalid, just select the
		//first tab then or default to selecting the initial
		//selected tab specified in the layout file
		LLPanelGroupTab* tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();

		//no tab was initially selected through constructor
		//or the XML, select the first tab
		if (!tabp)
		{
			mTabContainer->selectFirstTab();
			tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();
		}

		mCurrentTab = tabp;

		// Add click callbacks.
		for (int i = mTabContainer->getTabCount() - 1; i >=0; --i)
		{
			LLPanel* tab_panel = mTabContainer->getPanelByIndex(i);
			LLPanelGroupTab* panelp =(LLPanelGroupTab*)tab_panel; // bit of a hack

			// Pass on whether or not to allow edit to tabs.
			panelp->setAllowEdit(mAllowEdit);
			panelp->addObserver(this);
		}
		mTabContainer->setCommitCallback(boost::bind(&LLPanelGroup::handleClickTab,this)); 
		updateTabVisibility();

		// Act as though this tab was just activated.
		mCurrentTab->activate();
	}

	mDefaultNeedsApplyMesg = getString("default_needs_apply_text");
	mWantApplyMesg = getString("want_apply_text");

	LLButton* button = getChild<LLButton>("btn_ok");
	if (button)
	{
		button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnOK,this));
		button->setVisible(mAllowEdit);
	}
	
	button = getChild<LLButton>("btn_cancel");
	if (button)
	{
		button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnCancel,this));
		button->setEnabled(mAllowEdit); // Cancel should always be enabled for standalone group floater, this is expected behavior and may be used for simply closing
	}

	button = getChild<LLButton>("btn_apply");
	if (button)
	{
		button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnApply,this));
		button->setEnabled(FALSE);

		mApplyBtn = button;
	}

	button = getChild<LLButton>("btn_refresh");
	if (button)
	{
		button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnRefresh,this));
	}

	return TRUE;
}