コード例 #1
0
ファイル: GroupMessage.cpp プロジェクト: sskoruppa/Glove_Code
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();
	}
}
コード例 #2
0
ファイル: FlashControl.cpp プロジェクト: sskoruppa/Glove_Code
void FlashControl::bind(const MyGUI::UString& funcName, FlashDelegate::IDelegate* callback)
{
	if (funcName.empty() || callback == 0)
		return;

	delegateMap[funcName] = callback;
}
コード例 #3
0
ファイル: GroupMessage.cpp プロジェクト: alexis-/iwe
	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();
		}
	}
コード例 #4
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);
	}
コード例 #5
0
ファイル: OpenSaveFileDialog.cpp プロジェクト: alexis-/iwe
	void OpenSaveFileDialog::setCurrentFolder(const MyGUI::UString& _folder)
	{
		mCurrentFolder = _folder.empty() ? MyGUI::UString(common::getSystemCurrentFolder()) : _folder;

		update();
	}
コード例 #6
0
ファイル: Gui_Popup.cpp プロジェクト: jacobgogogo/stuntrally
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;
}
コード例 #7
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);
				}
			}
		}

	}