Exemplo n.º 1
0
	void Console::notifyButtonPressed(MyGUI::Widget* _sender, MyGUI::KeyCode _key, MyGUI::Char _char)
	{
		MyGUI::EditBox* edit = _sender->castType<MyGUI::EditBox>();
		size_t len = edit->getCaption().length();
		if ((_key == MyGUI::KeyCode::Backspace) && (len > 0) && (mAutocomleted))
		{
			edit->deleteTextSelection();
			len = edit->getCaption().length();
			edit->eraseText(len - 1);
		}

		MyGUI::UString command = edit->getCaption();
		if (command.length() == 0)
			return;

		for (MapDelegate::iterator iter = mDelegates.begin(); iter != mDelegates.end(); ++iter)
		{
			if (iter->first.find(command) == 0)
			{
				if (command == iter->first) break;
				edit->setCaption(iter->first);
				edit->setTextSelection(command.length(), iter->first.length());
				mAutocomleted = true;
				return;
			}
		}
		mAutocomleted = false;
	}
Exemplo n.º 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;
}
Exemplo n.º 3
0
void StatePanel::updateActorTheme(const MyGUI::UString& commandName, bool& result)
{
	std::string materialname = commandName.substr(commandName.find_first_of('_') + 1);
	Animation * anim = getActiveAnimation();
	if(anim != nullptr)
	{
		anim->upateActorTheme(materialname);
	}
}
Exemplo n.º 4
0
inline NumberType toNumber(MyGUI::UString numberString)
{
	if (numberString.substr(0, 4).compare("true") == 0) return 1;
	else if (numberString.substr(0, 4).compare("false") == 0) return 0;

	std::istringstream converter(numberString);

	if (typeid(NumberType) == typeid(bool))
	{
		int result;
		return (converter >> result).fail() ? false : !!result;
	}
Exemplo n.º 5
0
void PlayState::notifyButtonPressed(MyGUI::Widget* _sender, MyGUI::KeyCode _key, MyGUI::Char _char)
{
    size_t len = _sender->getCaption().length();
    MyGUI::Edit* edit = _sender->castType<MyGUI::Edit>();
    if ((_key == MyGUI::KeyCode::Backspace) && (len > 0) && (mAutocompleted)) {
        edit->deleteTextSelection();
        len = _sender->getCaption().length();
        edit->eraseText(len-1);
    }

    MyGUI::UString command = _sender->getCaption();
    if (command.length() == 0) return;

    mAutocompleted = false;
}
Exemplo n.º 6
0
MyGUI::IntSize CalcTextWidth( MyGUI::UString text,string font ){
	MyGUI::FontManager* pfm = MyGUI::FontManager::getInstancePtr();
	MyGUI::IFont* pf = pfm->getByName(font);
	MyGUI::IntSize size;
	size.height = pf->getDefaultHeight();
	if( pf ){
		for( MyGUI::UString::iterator i=text.begin();i!=text.end();++i ){
			MyGUI::GlyphInfo* pg = pf->getGlyphInfo(*i);
			if( pg ){
				size.width += (int)pg->width;
			}
		}
	}
	return size;
}
Exemplo n.º 7
0
void FlashControl::bind(const MyGUI::UString& funcName, FlashDelegate::IDelegate* callback)
{
	if (funcName.empty() || callback == 0)
		return;

	delegateMap[funcName] = callback;
}
Exemplo n.º 8
0
	MyGUI::UString EditorState::convertProjectName(const MyGUI::UString& _fileName)
	{
		size_t pos = mFileName.find_last_of("\\/");
		MyGUI::UString shortName = pos == MyGUI::UString::npos ? mFileName : mFileName.substr(pos + 1);
		addUserTag("ResourceName", shortName);

		size_t index = _fileName.find("|");
		if (index == MyGUI::UString::npos)
			return _fileName;

		MyGUI::UString fileName = _fileName.substr(0, index);
		MyGUI::UString itemIndexName = _fileName.substr(index + 1);
		size_t itemIndex = MyGUI::utility::parseValue<size_t>(itemIndexName);

		MyGUI::xml::Document doc;
		if (!doc.open(fileName))
			return _fileName;

		MyGUI::xml::ElementPtr root = doc.getRoot();
		if ((nullptr == root) || (root->getName() != "MyGUI"))
			return _fileName;

		if (root->findAttribute("type") == "Resource")
		{
			// берем детей и крутимся
			MyGUI::xml::ElementEnumerator element = root->getElementEnumerator();
			while (element.next("Resource"))
			{
				if (element->findAttribute("type") == "ResourceLayout")
				{
					if (itemIndex == 0)
					{
						// поменять на теги
						std::string resourceName = element->findAttribute("name");
						addUserTag("ResourceName", resourceName);
						return MyGUI::utility::toString(fileName, " [", resourceName, "]");
					}
					else
					{
						itemIndex --;
					}
				}
			}
		}

		return _fileName;
	}
Exemplo n.º 9
0
		//--------------------------------------------------------------------------------
		void	Chat::Log(const MyGUI::UString& str, const MyGUI::UString& color)
		{
			Framework::System::Log::Debug(std::string("Chat: ") + str.asUTF8());

			mMessagesMutex.lock();

			mMessages.push_back(std::make_pair(str,color));

			mMessagesMutex.unlock();
		}
Exemplo n.º 10
0
	void RecentFilesManager::addRecentFolder(const MyGUI::UString& _folder)
	{
		MyGUI::UString folder(_folder);
		if (_folder.empty())
			folder = MyGUI::UString(common::getSystemCurrentFolder());

		mRecentFolders.insert(mRecentFolders.begin(), folder);

		checkArray(mRecentFolders, mMaxRecentFolders);
	}
Exemplo n.º 11
0
void EditorState::setModeSaveLoadDialog(bool _save, const MyGUI::UString& _filename)
{
	if (_save)
		mOpenSaveFileDialog->setDialogInfo(localise("Save"), localise("Save"));
	else
		mOpenSaveFileDialog->setDialogInfo(localise("Load"), localise("Load"));

	size_t pos = _filename.find_last_of(L"\\/");
	if (pos == MyGUI::UString::npos)
	{
		mOpenSaveFileDialog->setFileName(_filename);
	}
	else
	{
		mOpenSaveFileDialog->setCurrentFolder(_filename.substr(0, pos));
		mOpenSaveFileDialog->setFileName(_filename.substr(pos + 1));
	}

	mOpenSaveFileDialog->setVisible(true);
	mModeSaveDialog = _save;
}
Exemplo n.º 12
0
void GroupMessage::showMessages()
{
	if (mWarningMessages.size())
	{
		MyGUI::UString warningMess;
		for (MyGUI::VectorString::iterator iter = mWarningMessages.begin(); iter != mWarningMessages.end(); ++iter)
		{
			if (warningMess.empty()) warningMess = warningMess + *iter;
			else warningMess = warningMess + "\n" + *iter;
		}
		if (!warningMess.empty())
			MyGUI::Message::createMessageBox("Message", localise("Warning"), warningMess, MyGUI::MessageBoxStyle::IconWarning | MyGUI::MessageBoxStyle::Ok);

		mWarningMessages.clear();
	}

	if (mErrorMessages.size())
	{
		MyGUI::UString errorMessages;
		for (MyGUI::VectorString::iterator iter = mErrorMessages.begin(); iter != mErrorMessages.end(); ++iter)
		{
			if (errorMessages.empty()) errorMessages = errorMessages + *iter;
			else errorMessages = errorMessages + "\n" + *iter;
		}
		if (!errorMessages.empty())
			MyGUI::Message::createMessageBox("Message", localise("Error"), errorMessages , MyGUI::MessageBoxStyle::IconError | MyGUI::MessageBoxStyle::Ok);

		mErrorMessages.clear();
	}
}
Exemplo n.º 13
0
void SpaceShipDesignerGUI::editBoxUpdated(MyGUI::EditBox *widget)
{
    MyGUI::UString caption = widget->getCaption();
    if(widget->getName() == "SelectFloorFrom")
    {
        if(caption == "")
            mParent->enableSelectedFloorFrom(false);
        else
        {
            mParent->setSelectedFloorFrom(atoi(caption.asUTF8().c_str()));
        }
    }
    else if(widget->getName() == "SelectFloorTo")
    {
        if(caption == "")
            mParent->enableSelectedFloorTo(false);
        else
        {
            mParent->setSelectedFloorTo(atoi(caption.asUTF8().c_str()));
        }
    }
}
Exemplo n.º 14
0
	void EditText::setCaption(const MyGUI::UString& _value)
	{
        if (mCaption != _value) {
            mCaption = _value;
            mTextOutDate = true;
        }
		
        if (mFont) {
            mFont->AllocateSymbols(_value.c_str());
        }

		if (nullptr != mNode)
			mNode->outOfDate(mRenderItem);
	}
Exemplo n.º 15
0
	void TextView::update(const MyGUI::UString& _text, const Sandbox::FontPtr& _font , MyGUI::Align _align, int _maxWidth)
	{
		
        m_font = _font;
		mViewSize.clear();
        mTextData.Clear();
        
        FontAlign align = ALIGN_LEFT;
        if (_align.isHCenter())
            align = ALIGN_CENTER;
        if (_align.isRight())
            align = ALIGN_RIGHT;
        
        mTextData.Fill(_text.c_str(), _font, _maxWidth, align);

		mViewSize = MyGUI::IntSize(mTextData.size.w,mTextData.size.h);
	}
Exemplo n.º 16
0
	void GroupMessage::showMessages()
	{
		if (mWarningMessages.size())
		{
			MyGUI::UString warningMess;
			for (VectorUString::const_iterator iter = mWarningMessages.begin(); iter != mWarningMessages.end(); ++iter)
			{
				if (warningMess.empty())
					warningMess = warningMess + *iter;
				else
					warningMess = warningMess + "\n" + *iter;
			}
			if (!warningMess.empty())
			{
				/*MyGUI::Message* message = */MessageBoxManager::getInstance().create(
					replaceTags("Warning"),
					warningMess,
					MyGUI::MessageBoxStyle::IconWarning | MyGUI::MessageBoxStyle::Ok);
			}

			mWarningMessages.clear();
		}

		if (mErrorMessages.size())
		{
			MyGUI::UString errorMessages;
			for (VectorUString::const_iterator iter = mErrorMessages.begin(); iter != mErrorMessages.end(); ++iter)
			{
				if (errorMessages.empty())
					errorMessages = errorMessages + *iter;
				else
					errorMessages = errorMessages + "\n" + *iter;
			}
			if (!errorMessages.empty())
			{
				/*MyGUI::Message* message = */MessageBoxManager::getInstance().create(
					replaceTags("Error"),
					errorMessages,
					MyGUI::MessageBoxStyle::IconError | MyGUI::MessageBoxStyle::Ok);
			}

			mErrorMessages.clear();
		}
	}
Exemplo n.º 17
0
bool WinState::keyPressed(const OIS::KeyEvent &e) 
{
     MyGUI::UString txt = user_name_txt->getCaption();
    if ((int)e.key==14 && txt.size()>0) 
    {
        txt.resize(txt.size()-1);
    }
    else
    {
      if (((int)e.text >=65 && (int)e.text<=90) || ((int)e.text>=97 && (int)e.text<=122))
      {
        if (txt.size()<CONSTANTS_MAX_USERNAME_SIZE) txt.push_back(e.text);
      }
    }
    user_name_txt->setCaption(txt);
    if ((e.key == OIS::KC_ESCAPE) || (e.key == OIS::KC_RETURN) || (e.key == OIS::KC_R))
    {
        cout << "NEW RECORD TO SAVE" << endl;
        save_record();
        popState();
    }

  return true;
}
Exemplo n.º 18
0
		//--------------------------------------------------------------------------------
		void	Chat::_Log(const MyGUI::UString& str, const MyGUI::UString& color)
		{
			while(mList->getItemCount() > 200)
				mList->removeItemAt(0);

			std::wstring tmp;

			std::vector<std::wstring> lines;
			lines.clear();

			MyGUI::IFont* font = MyGUI::FontManager::getInstance().getByName(MyGUI::FontManager::getInstance().getDefaultFont());

			int ctr = 0;

			for(size_t i = 0; i < str.size(); i++)
			{
				if(ctr + font->getGlyphInfo((int)str[i])->width > mList->getWidth() - 35)
				{
					ctr = 0;

					if(str[i] != L' ')
						tmp.push_back(L'-');
					else
						while(str[i] == L' ' && i < str.size()){i++;}

						lines.push_back(tmp);
						tmp.clear();
				}

				tmp.push_back(str[i]);

				ctr += font->getGlyphInfo((int)str[i])->width;

				if (i >= str.size() - 1)
				{
					ctr = 0;
					lines.push_back(tmp);
					tmp.clear();
				}
			}

			for (unsigned int i = 0 ; i < lines.size() ; i++)
			{
				if (i == 0)
				{
					std::wstring toAdd;
					toAdd += lines[i].substr(0, lines[i].find(L":") + 1);
					toAdd += color;
					toAdd += lines[i].substr(lines[i].find(L":") + 1, lines[i].size());

					mList->addItem(toAdd);
				}
				else
				{
					std::wstring toAdd = color;
					toAdd += lines[i];
					mList->addItem(toAdd);
				}
			}

			mList->beginToItemLast();
		}
Exemplo n.º 19
0
	void OpenSaveFileDialog::setCurrentFolder(const MyGUI::UString& _folder)
	{
		mCurrentFolder = _folder.empty() ? MyGUI::UString(common::getSystemCurrentFolder()) : _folder;

		update();
	}
Exemplo n.º 20
0
bool PlayState::keyPressed(const OIS::KeyEvent &e)
{
  if (!user_name_txt->getVisible())
  {
//        if (paused) pause(); // ESTO NO ES NECESARIO. AL HACER UN PUSHSTATE EL GAMEMANAGER LLAMARÁ A PAUSE() AUTOMATICAMENTE
//        else
        if (!paused)
        {
              if (e.key == OIS::KC_P) {
                paused = true;
                pushState(PauseState::getSingletonPtr());
              }
              else if (e.key == OIS::KC_G) {
                paused = true;
                game_over();
              }
              else if (e.key == OIS::KC_W) {
                win();
             }
             else if (e.key == OIS::KC_UP)
             {
               _pacmanDir = UP_DIR;
             }
             else if (e.key == OIS::KC_DOWN) {
               _pacmanDir = DOWN_DIR;
             }
             else if (e.key == OIS::KC_LEFT) {
               _pacmanDir = LEFT_DIR;
             }
             else if (e.key == OIS::KC_RIGHT) {
               _pacmanDir = RIGHT_DIR;
             }
//             else if (e.key == OIS::KC_ESCAPE) {              
//               popState();
//               pushState(IntroState::getSingletonPtr());
//             }
        }
  }
  else
  {
    sounds::getInstance()->play_effect("eat_fruit");

    MyGUI::UString txt = user_name_txt->getCaption();
    if ((int)e.key==14 && txt.size()>0) txt.resize(txt.size()-1);
    else
    {
      if (((int)e.text >=65 && (int)e.text<=90) || ((int)e.text>=97 && (int)e.text<=122))
      {
        if (txt.size()<3) txt.push_back(e.text);
      }
    }
    user_name_txt->setCaption(txt);
    if (e.key==OIS::KC_RETURN)
    {
      cout << "NEW RECORD TO SAVE" << endl;
        records::getInstance()->add_record(txt,get_score());
        records::getInstance()->saveFile(NULL);
        sounds::getInstance()->play_effect("eat_ghost");
        user_name_txt->setVisible(false);
        popState();
        stopWorld = false;
    }
  }
  return true;

}
Exemplo n.º 21
0
bool GuiPopup::Show(
	PopupDelegate* delegate, const UString& title, bool modal,
	const MyGUI::UString& text0, const MyGUI::UString& text1, const MyGUI::UString& text2, const MyGUI::UString& text3,
	const MyGUI::UString& edit0, const MyGUI::UString& edit1, const MyGUI::UString& edit2, const MyGUI::UString& edit3,
	const MyGUI::UString& button0, const MyGUI::UString& button1, const MyGUI::UString& button2, const MyGUI::UString& button3)
{
	if (isVisible)
		return false;
	isVisible = true;
	btnResult = -1;

	//  window    -----------------------
	int numEdits = 0;
	if (!text0.empty())  ++numEdits;  if (!text1.empty())  ++numEdits;
	if (!text2.empty())  ++numEdits;  if (!text3.empty())  ++numEdits;

	int scr_w = mPlatform->getRenderManagerPtr()->getViewSize().width, scr_h = mPlatform->getRenderManagerPtr()->getViewSize().height;
	int wnd_w = 392, wnd_h = 140 + numEdits * 80,
		wnd_x = (scr_w - wnd_w)/2, wnd_y = (scr_h - wnd_h)/2;  // center

	mWnd = mGUI->createWidget<Window>("WindowC", wnd_x,wnd_y, wnd_w,wnd_h, Align::Center, "Popup", "WndPop");
	mWnd->setColour(Colour(0.8f,0.96f,1.f));
	mWnd->setAlpha(0.9f);
	mWnd->setCaption(title);

	mDelegates.clear();  // add delegate
	mDelegates += delegate;

	if (modal)
		InputManager::getInstance().addWidgetModal(mWnd);


	//  text, edit  -----------------------
	int y = 24,  yadd = 80;
	if (!text0.empty())  {
		TextBox* text = mWnd->createWidget<TextBox>("TextBox", 16,    y, 352,28, Align::Default, "PopText0");	text->setCaption(text0);
		EditBox* edit = mWnd->createWidget<EditBox>("EditBox", 16, 32+y, 352,28, Align::Default, "PopEdit0");	edit->setCaption(edit0);
		y += yadd;
	}
	if (!text1.empty())  {
		TextBox* text = mWnd->createWidget<TextBox>("TextBox", 16,    y, 352,28, Align::Default, "PopText1");	text->setCaption(text1);
		EditBox* edit = mWnd->createWidget<EditBox>("EditBox", 16, 32+y, 352,28, Align::Default, "PopEdit1");	edit->setCaption(edit1);
		y += yadd;
	}
	if (!text2.empty())  {
		TextBox* text = mWnd->createWidget<TextBox>("TextBox", 16,    y, 352,28, Align::Default, "PopText2");	text->setCaption(text2);
		EditBox* edit = mWnd->createWidget<EditBox>("EditBox", 16, 32+y, 352,28, Align::Default, "PopEdit2");	edit->setCaption(edit2);
		y += yadd;
	}
	if (!text3.empty())  {
		TextBox* text = mWnd->createWidget<TextBox>("TextBox", 16,    y, 352,28, Align::Default, "PopText3");	text->setCaption(text3);
		EditBox* edit = mWnd->createWidget<EditBox>("EditBox", 16, 32+y, 352,28, Align::Default, "PopEdit3");	edit->setCaption(edit3);
		y += yadd;
	}

	//  buttons  -----------------------
	y += 12;
	int numBtns = 0;
	if (!button0.empty())  ++numBtns;  if (!button1.empty())  ++numBtns;
	if (!button2.empty())  ++numBtns;  if (!button3.empty())  ++numBtns;

	if (numBtns == 0)  ++numBtns;  // at least 1
	int xmarg = 20, w = (wnd_w - xmarg*2) / numBtns;
	int x = wnd_w - xmarg - w;

	if (!button0.empty())  {
		Button* btn = mWnd->createWidget<Button>("Button",  x,y, w-16,36, Align::Default, "PopBtn0");  btn->setCaption(button0);
		btn->setColour(Colour(0.7f,0.85f,1.0f));
		btn->eventMouseButtonClick += newDelegate(this, &GuiPopup::ButtonClick);  x -= w;
	}
	if (!button1.empty())  {
		Button* btn = mWnd->createWidget<Button>("Button",  x,y, w-16,36, Align::Default, "PopBtn1");  btn->setCaption(button1);
		btn->setColour(Colour(0.6f,0.8f,1.0f));
		btn->eventMouseButtonClick += newDelegate(this, &GuiPopup::ButtonClick);  x -= w;
	}
	if (!button2.empty())  {
		Button* btn = mWnd->createWidget<Button>("Button",  x,y, w-16,36, Align::Default, "PopBtn2");  btn->setCaption(button2);
		btn->setColour(Colour(0.6f,0.8f,1.0f));
		btn->eventMouseButtonClick += newDelegate(this, &GuiPopup::ButtonClick);  x -= w;
	}
	if (!button3.empty())  {
		Button* btn = mWnd->createWidget<Button>("Button",  x,y, w-16,36, Align::Default, "PopBtn3");  btn->setCaption(button3);
		btn->setColour(Colour(0.6f,0.8f,1.0f));
		btn->eventMouseButtonClick += newDelegate(this, &GuiPopup::ButtonClick);  x -= w;
	}

	return true;
}
Exemplo n.º 22
0
void SampleLayout::notifyTreeNodePrepare(MyGUI::TreeControl* pTreeControl, MyGUI::TreeControl::Node* pNode)
{
	if (pNode == pTreeControl->getRoot())
		return;

	pNode->removeAll();

/*#ifdef MYGUI_OGRE_PLATFORM
	Ogre::Archive* pArchive = *(pNode->getData<Ogre::Archive*>());

	MyGUI::UString strPath(getPath(pNode));
	Ogre::StringVectorPtr Resources = pArchive->find(strPath + "*", false, true);
	for (Ogre::StringVector::iterator Iterator = Resources->begin(); Iterator != Resources->end(); ++Iterator)
	{
		MyGUI::TreeControl::Node* pChild = new MyGUI::TreeControl::Node(*Iterator, "Folder");
		pChild->setData(pArchive);
		pNode->add(pChild);
	}

	Resources = pArchive->find(strPath + "*", false, false);
	for (Ogre::StringVector::iterator Iterator = Resources->begin(); Iterator != Resources->end(); ++Iterator)
	{
		MyGUI::UString strName(*Iterator);
		MyGUI::UString strExtension;
		size_t nPosition = strName.rfind(".");
		if (nPosition != MyGUI::UString::npos)
		{
			strExtension = strName.substr(nPosition + 1);
			std::transform(strExtension.begin(), strExtension.end(), strExtension.begin(), tolower);
		}

		MyGUI::UString strImage;
		if (strExtension == "png" || strExtension == "tif" || strExtension == "tiff" || strExtension == "jpg" || strExtension == "jpeg")
			strImage = "Image";
		else
		if (strExtension == "mat" || strExtension == "material")
			strImage = "Material";
		else
		if (strExtension == "layout")
			strImage = "Layout";
		else
		if (strExtension == "ttf" || strExtension == "font" || strExtension == "fontdef")
			strImage = "Font";
		else
		if (strExtension == "txt" || strExtension == "text")
			strImage = "Text";
		else
		if (strExtension == "xml")
			strImage = "XML";
		else
		if (strExtension == "mesh")
			strImage = "Mesh";
		else
		if (strExtension == "htm" || strExtension == "html")
			strImage = "HTML";
		else
			strImage = "Unknown";

		MyGUI::TreeControl::Node* pChild = new MyGUI::TreeControl::Node(strName, strImage);
		pChild->setPrepared(true);
		pNode->add(pChild);
	}
#else*/
	PairFileInfo info = *(pNode->getData<PairFileInfo>());
	// если папка, то добавляем детей
	if (info.second.folder)
	{
		std::wstring path = info.first + L"/" + info.second.name;
		common::VectorFileInfo result;
		common::getSystemFileList(result, path, L"*.*");

		for (common::VectorFileInfo::iterator item = result.begin(); item != result.end(); ++item)
		{
			if ((*item).name == L".." || (*item).name == L".")
				continue;
			if ((*item).folder)
			{
				MyGUI::TreeControl::Node* pChild = new MyGUI::TreeControl::Node((*item).name, "Folder");
				pChild->setData(PairFileInfo(path, *item));
				pNode->add(pChild);
			}
			else
			{
				MyGUI::UString strName((*item).name);
				MyGUI::UString strExtension;
				size_t nPosition = strName.rfind(".");
				if (nPosition != MyGUI::UString::npos)
				{
					strExtension = strName.substr(nPosition + 1);
					std::transform(strExtension.begin(), strExtension.end(), strExtension.begin(), tolower);
				}

				MyGUI::UString strImage;
				if (strExtension == "png" || strExtension == "tif" || strExtension == "tiff" || strExtension == "jpg" || strExtension == "jpeg")
					strImage = "Image";
				else if (strExtension == "mat" || strExtension == "material")
					strImage = "Material";
				else if (strExtension == "layout")
					strImage = "Layout";
				else if (strExtension == "ttf" || strExtension == "font" || strExtension == "fontdef")
					strImage = "Font";
				else if (strExtension == "txt" || strExtension == "text")
					strImage = "Text";
				else if (strExtension == "xml")
					strImage = "XML";
				else if (strExtension == "mesh")
					strImage = "Mesh";
				else if (strExtension == "htm" || strExtension == "html")
					strImage = "HTML";
				else
					strImage = "Unknown";

				MyGUI::TreeControl::Node* pChild = new MyGUI::TreeControl::Node((*item).name, strImage);
				pChild->setPrepared(true);
				pNode->add(pChild);
			}
		}
	}

//#endif
}
Exemplo n.º 23
0
	void DemoKeeper::command(const MyGUI::UString& _key, const MyGUI::UString& _value)
	{
		if (_key == "colour")
		{
			if (_value.empty()) mConsole->addToConsole(mConsole->getConsoleStringCurrent(), _key, MyGUI::utility::toString(mEdit->getTextColour()));
			else
			{
				MyGUI::Colour colour;
				if ( ! MyGUI::utility::parseComplex(_value, colour.red, colour.green, colour.blue, colour.alpha))
				{
					mConsole->addToConsole(mConsole->getConsoleStringError(), _key, _value);
					mConsole->addToConsole(mConsole->getConsoleStringFormat(), _key, "red green blue alpha");
				}
				else
				{
					mConsole->addToConsole(mConsole->getConsoleStringSuccess(), _key, _value);
					mEdit->setTextColour(colour);
				}
			}
		}
		else if (_key == "show")
		{
			if (_value.empty())
			{
				mConsole->addToConsole(mConsole->getConsoleStringCurrent(), _key, MyGUI::utility::toString(mEdit->getVisible()));
			}
			else
			{
				bool show = false;
				if ( ! MyGUI::utility::parseComplex(_value, show))
				{
					mConsole->addToConsole(mConsole->getConsoleStringError(), _key, _value);
					mConsole->addToConsole(mConsole->getConsoleStringFormat(), _key, "true | false");
				}
				else
				{
					mConsole->addToConsole(mConsole->getConsoleStringSuccess(), _key, _value);
					mEdit->setVisible(show);
				}
			}
		}
		else if (_key == "alpha")
		{
			if (_value.empty())
			{
				mConsole->addToConsole(mConsole->getConsoleStringCurrent(), _key, MyGUI::utility::toString(mEdit->getAlpha()));
			}
			else
			{
				float alpha;
				if ( ! MyGUI::utility::parseComplex(_value, alpha) || (alpha < 0 || alpha > 1))
				{
					mConsole->addToConsole(mConsole->getConsoleStringError(), _key, _value);
					mConsole->addToConsole(mConsole->getConsoleStringFormat(), _key, "0 - 1");
				}
				else
				{
					mConsole->addToConsole(mConsole->getConsoleStringSuccess(), _key, _value);
					mEdit->setAlpha(alpha);
				}
			}
		}
		else if (_key == "coord")
		{
			if (_value.empty()) mConsole->addToConsole(mConsole->getConsoleStringCurrent(), _key, MyGUI::utility::toString(mEdit->getCoord()));
			else
			{
				MyGUI::IntCoord coord;
				if ( ! MyGUI::utility::parseComplex(_value, coord.left, coord.top, coord.width, coord.height))
				{
					mConsole->addToConsole(mConsole->getConsoleStringError(), _key, _value);
					mConsole->addToConsole(mConsole->getConsoleStringFormat(), _key, "left top width height");
				}
				else
				{
					mConsole->addToConsole(mConsole->getConsoleStringSuccess(), _key, _value);
					mEdit->setCoord(coord);
				}
			}
		}

	}
Exemplo n.º 24
0
	bool EditorState::isProjectFile(const MyGUI::UString& _fileName)
	{
		size_t index = _fileName.find("|");
		return (index != MyGUI::UString::npos);
	}