コード例 #1
0
ファイル: Console.cpp プロジェクト: Anomalous-Software/mygui
	void Console::notifyComboAccept(MyGUI::ComboBox* _sender, size_t _index)
	{
		const MyGUI::UString& command = _sender->getOnlyText();
		if (command == "") return;

		MyGUI::UString key = command;
		MyGUI::UString value;

		size_t pos = command.find(' ');
		if (pos != MyGUI::UString::npos)
		{
			key = command.substr(0, pos);
			value = command.substr(pos + 1);
		}

		MapDelegate::iterator iter = mDelegates.find(key);
		if (iter != mDelegates.end())
		{
			iter->second(key, value);
		}
		else
		{
			if (eventConsoleUnknowCommand.empty())
			{
				addToConsole(mStringUnknow + "'" + key + "'");
			}
			else
			{
				eventConsoleUnknowCommand(key, value);
			}
		}

		_sender->setCaption("");
	}
コード例 #2
0
bool CommandManager::executeCommand(const MyGUI::UString& _command)
{
	bool result = false;
	MyGUI::UString command = _command;
	size_t index = _command.find('.');
	MYGUI_LOG(Warning , "+++++:Menu Command apply :" << command << "+++++");
	if (index != MyGUI::UString::npos)
	{
		command = _command.substr(0, index);
		mData = _command.substr(index + 1);
	}

	MapDelegate::iterator iter = mDelegates.find(command);
	if (iter != mDelegates.end())
	{
		iter->second(command, result);
	}
	else
	{
		MYGUI_LOG(Warning, "Command '" << command << "' not found");
	}

	mData.clear();

	return result;
}
コード例 #3
0
	void WidgetManager::parse(WidgetPtr _widget, const Ogre::String &_key, const Ogre::String &_value)
	{
		MapDelegate::iterator iter = mDelegates.find(_key);
		if (iter == mDelegates.end()) {
			MYGUI_LOG(Error, "Unknown key '" << _key << "' with value '" << _value << "'");
			return;
		}
		iter->second(_widget, _key, _value);
	}