Ejemplo n.º 1
0
void CtrlrPanelWindowManager::create(const CtrlrPanelWindowManager::WindowType window, const String &lastWindowState)
{
	CtrlrChildWindow *w			= createWindow(window);
	String windowState;

	if (w == nullptr)
	{
		return;
	}

	if (lastWindowState.isEmpty())
	{
		if (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).isValid())
		{
			windowState = managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).getProperty (Ids::uiChildWindowState);
		}
	}
	else
	{
		windowState = lastWindowState;
	}

	if (windowState != String::empty)
	{
		w->restoreWindowStateFromString(windowState);
	}
	else
	{
		w->centreWithSize(w->getWidth(), w->getHeight());
	}

	if (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).isValid())
	{
		if (w->getContent())
		{
			/* restore the stored state in our global tree */
			w->getContent()->restoreState (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).getChildWithName(Ids::uiChildWindowContentState));

			/* remove the CONTENT state */
			managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).removeAllChildren (nullptr);

			/* reattach the CONTENT state but with the valid data reference */
			managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).addChild (w->getContent()->saveState(), -1, nullptr);
		}
	}
}
void CtrlrManagerWindowManager::create(const CtrlrManagerWindowManager::WindowType window, const String &lastWindowState)
{
	CtrlrChildWindow *w			= createWindow(window);
	String windowState;

	if (w == nullptr)
	{
		return;
	}

	if (lastWindowState.isEmpty())
	{
		if (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).isValid())
		{
			windowState = managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).getProperty (Ids::uiChildWindowState);
		}
	}
	else
	{
		windowState = lastWindowState;
	}

	if (windowState != String::empty)
	{
		w->restoreWindowStateFromString(windowState);
	}
	else
	{
		w->centreWithSize(w->getWidth(), w->getHeight());
	}

	if (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).isValid())
	{
		if (w->getContent())
		{
			w->getContent()->restoreState (managerTree.getChildWithProperty (Ids::uiChildWindowName, getWindowName(window)).getChildWithName(Ids::uiChildWindowContentState));
		}
	}
}