Esempio n. 1
0
	virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
	{
		uint32 i;
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		const vector<CInterfaceManager::SMasterGroup> &rVMG = pIM->getAllMasterGroup();
		for (uint32 nMasterGroup = 0; nMasterGroup < rVMG.size(); nMasterGroup++)
		{
			const CInterfaceManager::SMasterGroup &rMG = rVMG[nMasterGroup];
			const vector<CInterfaceGroup*> &rV = rMG.Group->getGroups();
			// Active all containers (that can be activated)
			for (i = 0; i < rV.size(); ++i)
			{
				CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(rV[i]);
				if (pGC == NULL) continue;
				if (pGC->isSavable())
				{
					// Yoyo: DO NOT force activation of containers who don't want to save their Active state.
					// Usually driven by server.
					if(pGC->isActiveSavable())
						pGC->setActive(true);
				}
			}

			pIM->checkCoords();
			pIM->getMasterGroup((uint8)nMasterGroup).centerAllContainers();

			// Pop in and close all containers
			for (i = 0; i < rV.size(); ++i)
			{
				CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(rV[i]);
				if (pGC == NULL) continue;
				if (pGC->isSavable())
				{
					if (pGC->isPopable()&&pGC->isPopuped())
						pGC->popin();

					// Can close ?
					if (pGC->isOpenable()&&pGC->isOpen())
						pGC->close();
				}
			}

			pIM->getMasterGroup((uint8)nMasterGroup).deactiveAllContainers();
		}
	}
	virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId("ui:interface", Params));
		if (pGC == NULL)
		{
			nlwarning("%s is not a container", Params.c_str());
			return;
		}
		if (!pGC->isPopable())
		{
			nlwarning("%s cannot be popup/popin", Params.c_str());
			return;
		}
		if (!isContainerAuthorized(pGC)) return;
		if (pGC->isPopuped())
			pIM->runActionHandler("popin", NULL, Params);
		else
			pIM->runActionHandler("popup", NULL, Params);
	}
Esempio n. 3
0
	virtual void execute (CCtrlBase *pCaller, const string &Params)
	{
		CInterfaceManager *im = CInterfaceManager::getInstance();

		// get the parent container
		CGroupContainer *gc = NULL;
		CCtrlBase *cb = pCaller;
		while (cb)
		{
			gc = dynamic_cast<CGroupContainer *>(cb);
			if (gc) break;
			cb = cb->getParent();
		}

		// update GC_POPUP flag
		if (gc)
		{
			im->getDbProp("UI:VARIABLES:GC_POPUP")->setValue64((gc->isPopuped() || gc->getLayerSetup() == 0) ? 1 : 0);
		}
		else
		{
			im->getDbProp("UI:VARIABLES:GC_POPUP")->setValue64(0);
		}

		// update GC_HAS_HELP flag
		if(gc && !gc->getHelpPage().empty())
		{
			im->getDbProp("UI:VARIABLES:GC_HAS_HELP")->setValue64(1);
		}
		else
		{
			im->getDbProp("UI:VARIABLES:GC_HAS_HELP")->setValue64(0);
		}

		// open the menu
		if (CDBCtrlSheet::getDraggedSheet() == NULL)
		{
			CInterfaceManager::getInstance()->enableModalWindow (pCaller, getParam(Params, "menu"));
		}
	}