//--------------------------------------------------------------------------
	void BaseFileDialog::ok()
	{
		MyGUI::LanguageManager& lang = MyGUI::LanguageManager::getInstance();
		if(mCurrentBasename.empty())
		{
			MessageBox* msgbox = new MessageBox;
			msgbox->setIcon(MessageBoxIcon::INFO);
			msgbox->setMessage("#{SelectFileBefore}");
			msgbox->addButton(MessageBoxButton::OK);
			return;
		}

		size_t pos = mCurrentBasename.rfind('.');
		if(pos == String::npos)
		{
			if(mCurrentFilter < getNumFilters())
			{
				const Filter& filter = getFilter(mCurrentFilter);
				mCurrentBasename += filter.getDefaultExt();
			}
		}

		String filename = getCurrentFilename();
		if(mType == LOAD)
		{
			if(!ResourceGroupManager::getSingleton().resourceExists(mResourceGroup, filename))
			{
				MessageBox* msgbox = new MessageBox;
				msgbox->setIcon(MessageBoxIcon::ERROR);
				msgbox->setMessage("#{FileNotFound}", "1", filename);
				msgbox->addButton(MessageBoxButton::OK);
				return;
			}
		}
		else if(mType == SAVE)
		{
			if(ResourceGroupManager::getSingleton().resourceExists(mResourceGroup, filename))
			{
				MessageBox* msgbox = new MessageBox;
				msgbox->setIcon(MessageBoxIcon::QUEST);
				msgbox->setMessage("#{ConfirmOverwriteFile}", "1", filename);
				msgbox->addButton(MessageBoxButton::YES);
				msgbox->addButton(MessageBoxButton::NO);
				msgbox->eventChoice = MyGUI::newDelegate(this, &BaseFileDialog::notifyFileOverwriteMessageButton);
				return;
			}
		}

		ok_final();
	}
Esempio n. 2
0
int Script::messageBox(lua_State* L){
#ifdef _CLIENT_
	string msg = string(luaL_checkstring(L, 1));
  MessageBox* mb = new MessageBox();
  mb->setMessage(msg);
  CGE::Engine::instance()->addGuiListener(mb, false);
#endif
  return 0;
}
	//----------------------------------------------------------------------------
	void WorldViewWindowManager::_processWindowClosing()
	{
		World* changedWorld = nullptr;
		size_t i = mWindows.size();
		while(i != 0)
		{
			WorldViewWindow* window = mWindows[--i];
			if(window->isClosing())
			{
				World* world = window->getWorld();
				if(!world->isChanged())
					WorldManager::getSingleton().destroyWorld(world);
				else
				{
					changedWorld = world;
					break;
				}
			}
		}

		if(!changedWorld)
		{
			if(mAppExitAfterWindowClosing)
				InputSystem::getSingleton().setExitFlag();
			return;
		}

		WorldManager::getSingleton().setActiveWorld(changedWorld);

		MessageBox* msgbox = new MessageBox;
		msgbox->addButton(MessageBoxButton::BUTTON1, "#{Save}");
		msgbox->addButton(MessageBoxButton::BUTTON2, "#{DontSave}");
		msgbox->addButton(MessageBoxButton::CANCEL);
		msgbox->setIcon(MessageBoxIcon::QUEST);
		msgbox->setMessage("#{ConfirmSaveChanges}", "1", changedWorld->getName());
		msgbox->eventChoice = MyGUI::newDelegate(this, &WorldViewWindowManager::notifyMessageBoxChoice);
	}