示例#1
0
void UI::pushRoot (const std::string& windowID)
{
	_noPushAllowed = true;
	while (!_stack.empty()) {
		UIWindow* window = *_stack.rbegin();
		window->onPop();
		_stack.pop_back();
		if (!_stack.empty()) {
			_stack.back()->onActive();
		}

		if (window->shouldDelete()) {
			delete window;
		}
	}
	_noPushAllowed = false;
	push(windowID);
}
示例#2
0
void UI::popMain ()
{
	_noPushAllowed = true;
	// don't pop the root window
	while (_stack.size() > 1) {
		UIWindow* window = *_stack.rbegin();
		if (window->isMain())
			break;
		info(LOG_CLIENT, "pop window " + window->getId());
		window->onPop();
		_stack.pop_back();
		_stack.back()->onActive();

		if (window->shouldDelete()) {
			delete window;
		}
	}
	_noPushAllowed = false;
}
示例#3
0
void UI::pop ()
{
	if (_noPushAllowed)
		return;

	if (_stack.size() == 1) {
		UIPopupCallbackPtr c(new UIPopupOkCommandCallback(CMD_QUIT));
		UI::get().popup(tr("Quit"), UIPOPUP_OK | UIPOPUP_CANCEL, c);
		return;
	}

	UIWindow* window = *_stack.rbegin();
	if (!window->onPop())
		return;

	info(LOG_CLIENT, "pop window " + window->getId());
	System.track("popwindow", window->getId());
	_stack.pop_back();
	_stack.back()->onActive();

	if (window->shouldDelete()) {
		delete window;
	}
}