Пример #1
0
	/// Closes the current document if there's more than one on the stack.
	/// Stores exit code to be passed to suspended context if modal.
	void close( int code = 0 )
	{
		WSWUI::NavigationStack *stack = UI_Main::Get()->getNavigator();
		if( stack == NULL ) {
			return;
		}

		ElementDocument *document = GetCurrentUIDocument();
		bool isModal = document->IsModal();

		// can't close if there's a modal dialog on top
		if( !isModal && stack->isTopModal() ) {
			return;
		}

		// so it's a top modal dialog or there's no modal dialog on stack at all
		if( isModal ) {
			modalValue = code;
			stack->popDocument();
		}
		else {
			// not really a modal window, clear the stack
			UI_Main::Get()->showUI( false );
		}
	}