Ejemplo n.º 1
0
	bool SelectorControl::getCapture()
	{
		MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>(false);
		if (window != nullptr)
			return !window->getActionScale().empty();
		return false;
	}
Ejemplo n.º 2
0
	void DemoKeeper::createScene()
	{
		base::BaseDemoManager::createScene();
		createDefaultScene();
		const MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().loadLayout("HelpPanel.layout");
		if (root.size() == 1)
			root.at(0)->findWidget("Text")->castType<MyGUI::TextBox>()->setCaption("Demo of rendering camera view into widget and mesh into widget (you can drag it using mouse).");

		const MyGUI::IntSize& size = MyGUI::RenderManager::getInstance().getViewSize();

		MyGUI::Window* window = MyGUI::Gui::getInstance().createWidget<MyGUI::Window>("WindowCS", MyGUI::IntCoord(10, size.height - 10 - 230, 300, 230), MyGUI::Align::Default, "Overlapped");
		window->setCaption("Camera view");
		window->setMinSize(MyGUI::IntSize(100, 100));
		MyGUI::Canvas* canvas = window->createWidget<MyGUI::Canvas>("Canvas", MyGUI::IntCoord(0, 0, window->getClientCoord().width, window->getClientCoord().height), MyGUI::Align::Stretch);

		MyGUI::Window* window2 = MyGUI::Gui::getInstance().createWidget<MyGUI::Window>("WindowCS", MyGUI::IntCoord(size.width - 10 - 300, 10, 300, 230), MyGUI::Align::Default, "Overlapped");
		window2->setCaption("Model view");
		window2->setMinSize(MyGUI::IntSize(100, 100));
		MyGUI::Canvas* canvas2 = window2->createWidget<MyGUI::Canvas>("Canvas", MyGUI::IntCoord(0, 0, window2->getClientCoord().width, window2->getClientCoord().height), MyGUI::Align::Stretch);
		canvas2->setPointer("hand");

#ifdef MYGUI_OGRE_PLATFORM

		gRenderBox.setCanvas(canvas);
		gRenderBox.setViewport(getCamera());
		gRenderBox.setBackgroundColour(MyGUI::Colour::Black);

		gRenderBoxScene.setCanvas(canvas2);
		gRenderBoxScene.injectObject("Robot.mesh");
		gRenderBoxScene.setAutoRotation(true);
		gRenderBoxScene.setMouseRotation(true);

		MyGUI::Gui::getInstance().eventFrameStart += MyGUI::newDelegate(this, &DemoKeeper::notifyFrameStart);
#endif // MYGUI_OGRE_PLATFORM
	}
Ejemplo n.º 3
0
	MyGUI::IntCoord SelectorControl::getActionScale()
	{
		MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>(false);
		if (window != nullptr)
			return window->getActionScale();
		return MyGUI::IntCoord();
	}
Ejemplo n.º 4
0
void SkeletonView::createScene()
{
	const MyGUI::IntSize& size = MyGUI::RenderManager::getInstance().getViewSize();
	MyGUI::Window* window = MyGUI::Gui::getInstance().createWidget<MyGUI::Window>("PanelSkin", MyGUI::IntCoord(0, size.height - 276, 360, 276), MyGUI::Align::Left|MyGUI::Align::Bottom, "Main","SkeletonViewWnd");
	 
	window->setCaption("Skeleton view");
 	MyGUI::Canvas* canvas = window->createWidget<MyGUI::Canvas>("Canvas", MyGUI::IntCoord(5, 5, window->getClientCoord().width-10, window->getClientCoord().height-10), MyGUI::Align::Stretch);
	canvas->setPointer("hand");
 	 
	setCanvas(canvas);
	 	 
	/*Ogre::Vector3 dir(-1, -1, 0.5);
	dir.normalise();
	Ogre::Light* light = mSceneMgr->createLight(MyGUI::utility::toString(this, "_LightRenderBox"));
	light->setType(Ogre::Light::LT_DIRECTIONAL);
	light->setDirection(dir);*/

	std::string camera(MyGUI::utility::toString(this, "_CameraRenderBox"));
	mCamera = AppDemo::getSingleton().mSceneMgr->createCamera(camera);
	mCamera->setNearClipDistance(1);
	mCamera->setPosition(0,10,50);
	mCamera->lookAt(0,0,0);
  	mCamera->setAspectRatio( float(mCanvas->getWidth()) / float(mCanvas->getHeight()) );

	setViewport(mCamera);
}
Ejemplo n.º 5
0
	void Control::AdviceWidget(MyGUI::Widget* _widget)
	{
		std::string command = _widget->getUserString("CommandClick");
		if (!command.empty())
			_widget->eventMouseButtonClick += MyGUI::newDelegate(this, &Control::notifyMouseButtonClick);

		MyGUI::TabControl* tab = _widget->castType<MyGUI::TabControl>(false);
		if (tab != nullptr)
		{
			if (tab->getItemCount() != 0 && tab->getItemAt(0)->getUserString("CommandActivate") != "")
				tab->eventTabChangeSelect += MyGUI::newDelegate(this, &Control::notifyTabChangeSelect);
		}

		MyGUI::Window* window = _widget->castType<MyGUI::Window>(false);
		if (window != nullptr && window->getUserString("CommandClose") != "")
			window->eventWindowButtonPressed += MyGUI::newDelegate(this, &Control::notifyWindowButtonPressed);

		command = _widget->getUserString("CommandAccept");
		if (!command.empty())
		{
			MyGUI::EditBox* edit = _widget->castType<MyGUI::EditBox>(false);
			if (edit != nullptr)
				edit->eventEditSelectAccept += MyGUI::newDelegate(this, &Control::notifyEditSelectAccept);
		}
	}
Ejemplo n.º 6
0
  void OpenSaveFileDialog::setDialogInfo(const MyGUI::UString& _caption, const MyGUI::UString& _button, bool _folderMode)
  {
    mFolderMode = _folderMode;

    MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>(false);
    if (window != nullptr)
      window->setCaption(_caption);

    mButtonOpenSave->setCaption(_button);
    mEditFileName->setVisible(!_folderMode);
  }
Ejemplo n.º 7
0
void GUIManager::buildGUIFromXML(std::string file_name)
{
   float values[4];

   TiXmlDocument doc(file_name.c_str());
   if (doc.LoadFile())
   {
      TiXmlNode* gui_node = doc.FirstChild("gui");
      if (gui_node)
      {
         TiXmlNode* windows_node = gui_node->FirstChild("windows");

         for(TiXmlNode* window_node = windows_node->FirstChild("window"); window_node; window_node = window_node->NextSibling())
         {
            std::string name_text = GameManager::textFromChildNode(window_node, "name");
            std::string caption_text = GameManager::textFromChildNode(window_node, "caption");
            std::string skin_text = GameManager::textFromChildNode(window_node, "skin");
            std::string position_text = GameManager::textFromChildNode(window_node, "position");
            GameManager::parseFloats(position_text, values);
            uint32 left = (uint32) values[0];
            uint32 top = (uint32) values[1];
            std::string size_text = GameManager::textFromChildNode(window_node, "size");
            GameManager::parseFloats(size_text, values);
            uint32 width = (uint32) values[0];
            uint32 height = (uint32) values[1];

            std::string layer_text = GameManager::textFromChildNode(window_node, "layer");

            MyGUI::Window* w = my_gui->createWidget<MyGUI::Window>(skin_text, left, top, width, height, MyGUI::Align::Default, layer_text, name_text);
            w->setCaption(caption_text);

            TiXmlNode* buttons_node = window_node->FirstChild("buttons");

            if (buttons_node)
            {
               addButtons(buttons_node, values, w);
            }

            TiXmlNode* combo_boxes_node = window_node->FirstChild("combo_boxes");

            if (combo_boxes_node)
            {
               addComboBoxes(combo_boxes_node, values, w);
            }
         }
      }
   }
   else
   {
      //do nothing
   }
}
	void BaseLayout::shutdown()
	{
		// удаляем все классы
		for (VectorBasePtr::reverse_iterator iter = mListBase.rbegin(); iter != mListBase.rend(); ++iter)
			delete (*iter);
		mListBase.clear();

		// удаляем все рутовые виджеты
		for (MyGUI::VectorWidgetPtr::const_iterator iter = mListWindowRoot.begin(); iter != mListWindowRoot.end(); ++iter) {
			MyGUI::Window *window = (*iter)->castType<MyGUI::Window>(false);
			if (window) {
				window->destroySmooth();
			} else {
				MyGUI::WidgetManager::getInstance().destroyWidget(*iter);
			}
		}
		mListWindowRoot.clear();
	}
Ejemplo n.º 9
0
	void DemoKeeper::createScene()
	{
		MyGUI::LayoutManager::getInstance().loadLayout("Wallpaper.layout");
		const MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().loadLayout("HelpPanel.layout");
		root.at(0)->findWidget("Text")->castType<MyGUI::TextBox>()->setCaption("Resize window to see how ScrollView widget works");

		const MyGUI::IntSize& view = MyGUI::RenderManager::getInstance().getViewSize();
		const MyGUI::IntSize size(450, 450);

		MyGUI::Window* window = MyGUI::Gui::getInstance().createWidget<MyGUI::Window>("WindowCS", MyGUI::IntCoord((view.width - size.width) / 2, (view.height - size.height) / 2, size.width, size.height), MyGUI::Align::Default, "Main");
		window->setMinSize(150, 150);
		window->setCaption("ScrollView demo");
		MyGUI::ScrollView* scroll_view = window->createWidget<MyGUI::ScrollView>("ScrollView", MyGUI::IntCoord(2, 2, window->getClientCoord().width - 2, window->getClientCoord().height - 2), MyGUI::Align::Stretch);

		scroll_view->setCanvasSize(256, 256);
		MyGUI::ImageBox* image = scroll_view->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 256, 256), MyGUI::Align::Default);
		image->setImageTexture("Crystal_Clear_View.png");
	}
Ejemplo n.º 10
0
	void DemoKeeper::createScene()
	{
		base::BaseDemoManager::createScene();
		MyGUI::ResourceManager::getInstance().load("Fonts.xml");
		MyGUI::ResourceManager::getInstance().load("HyperTextSkins.xml");

		std::string category = MyGUI::WidgetManager::getInstance().getCategoryName();
		MyGUI::FactoryManager::getInstance().registerFactory<MyGUI::WrapPanel>(category);
		MyGUI::FactoryManager::getInstance().registerFactory<MyGUI::StackPanel>(category);
		MyGUI::FactoryManager::getInstance().registerFactory<MyGUI::ScrollViewPanel>(category);
		MyGUI::FactoryManager::getInstance().registerFactory<MyGUI::HyperTextBox>(category);

		MyGUI::Window* window = MyGUI::Gui::getInstance().createWidget<MyGUI::Window>("WindowCSX", MyGUI::IntCoord(10, 10, 500, 500), MyGUI::Align::Default, "Main");
		MyGUI::IntCoord coord = window->getClientCoord();

		MyGUI::HyperTextBox* hyperText = window->createWidget<MyGUI::HyperTextBox>("HyperTextBox", MyGUI::IntCoord(0, 0, coord.width, coord.height), MyGUI::Align::Stretch);
		hyperText->eventUrlClick += MyGUI::newDelegate(this, &DemoKeeper::OnClickUrl);

		hyperText->setCaption(
			"<p align='left'><h1>Caption1 left</h1></p>\n"\
			"<p align='center'><h2>Caption2 center</h2></p>\n"\
			"<p align='right'><h3>Caption3 right</h3></p>\n"\
			"<p><s>This is strike.</s></p>\n"\
			"<p><s><color value='#FF00FF'>This is strike and colour.</color></s></p>\n"\
			"<p><u>This is under.</u></p>\n"\
			"<p><color value='#FFFFFF'>This is color.</color></p>\n"\
			"<br/>\n"\
			"<p><url value='url_text1'>http://www.mygui.info</url></p>\n"\
			"<p><i><b><url value='url_text2'>http://www.mygui.info</url></b></i></p>\n"\
			"<p>This is image.<img>HandPointerImage</img></p>\n"\
			"<p>This is linked image.<url value='url_img'><img>HandPointerImage</img></url></p>\n"\
			"<p><b>This is bold text.</b></p>\n"\
			"<p><i>This is italic text.</i></p>\n"\
			"<p><t/><i><b>This is bold and italic text.</b></i></p>\n"\
			"<p><i><b><s><u>This is bold and italic and under and strike text.</u></s></b></i></p>\n"\
			"<p float='left'><img width='48' height='48'>HandPointerImage</img>text1 texttext2 text3 text4 texttext5 texttexttexttext6 text7 text8 texttext9 text10 texttext11 text12</p>\n"\
			"<p float='right' align='right'><img width='48' height='48'>HandPointerImage</img>text1 texttext2 text3 text4 texttext5 texttexttexttext6 text7 text8 texttext9 text10 texttext11 text12</p>");

		hyperText->updateContent();
	}
Ejemplo n.º 11
0
	void DemoKeeper::notifyEventAction(MainPanel::TypeEvents _action, size_t _index)
	{
		if (_action == MainPanel::EventQuit)
		{
			quit();
		}
		else if (_action == MainPanel::EventNew)
		{
			removeRenderBoxes();
			destroyWindows();
			mEditorWindow->clearView();
		}
		else if (_action == MainPanel::EventLoad)
		{
			createWindows();
		}
		else if (_action == MainPanel::EventCreate)
		{
			MyGUI::Widget* view = mEditorWindow->getView();
			const MyGUI::IntCoord& coord = view->getClientCoord();

			if (_index == 0)
			{
				const MyGUI::IntSize size(80, 80);
				MyGUI::Window* window = view->createWidget<MyGUI::Window>(MyGUI::WidgetStyle::Overlapped, "WindowCS", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				window->setCaption("Frame");
				window->setMinSize(size);
			}
			else if (_index == 1)
			{
				const MyGUI::IntSize size(180, 15);
				MyGUI::ScrollBar* scroll = view->createWidget<MyGUI::ScrollBar>("ScrollBarH", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				scroll->setScrollRange(200);
				scroll->setScrollPosition(10);
				scroll->setScrollPage(1);
				scroll->setScrollViewPage(20);
			}
			else if (_index == 2)
			{
				const MyGUI::IntSize size(15, 180);
				MyGUI::ScrollBar* scroll = view->createWidget<MyGUI::ScrollBar>("ScrollBarV", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				scroll->setScrollRange(200);
				scroll->setScrollPosition(10);
				scroll->setScrollPage(1);
				scroll->setScrollViewPage(20);
			}
			else if (_index == 3)
			{
				const MyGUI::IntSize size(80, 26);
				MyGUI::TextBox* text = view->createWidget<MyGUI::TextBox>("TextBox", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				text->setCaption("TextBox");
			}
			else if (_index == 4)
			{
				const MyGUI::IntSize size(50, 50);
				MyGUI::ImageBox* image = view->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				image->setImageTexture("HelpIcon.png");
			}
			else if (_index == 5)
			{
				const MyGUI::IntSize size(150, 150);
				MyGUI::Window* window = view->createWidget<MyGUI::Window>(MyGUI::WidgetStyle::Overlapped, "WindowC", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				window->setCaption("Render");
				MyGUI::Canvas* canvas = window->createWidget<MyGUI::Canvas>("Canvas", MyGUI::IntCoord(0, 0, window->getClientCoord().width, window->getClientCoord().height), MyGUI::Align::Stretch);

				createRenderBox(canvas);
			}
		}
	}
Ejemplo n.º 12
0
	void DemoKeeper::notifyEventAction(MainPanel::TypeEvents _action, size_t _index)
	{
		static MyGUI::IVertexBuffer* vbo = nullptr;

		if (_action == MainPanel::EventQuit)
		{
			if (vbo)
				MyGUI::RenderManager::getInstance().destroyVertexBuffer(vbo);
			quit();
		}
		else if (_action == MainPanel::EventNew)
		{
			//cocos2d::extension::CCNotificationCenter::sharedNotificationCenter()->postNotification(EVENT_COME_TO_BACKGROUND);
			//cocos2d::CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND);

			//removeRenderBoxes();
			//destroyWindows();
			//mEditorWindow->clearView();
			//MyGUI::Widget *tempWindow = mEditorWindow->getView()->findWidget("tempWindow");
			//if (tempWindow)
			//	MyGUI::Gui::getInstance().destroyWidget(tempWindow);

			if (vbo)
			{
				MyGUI::RenderManager::getInstance().destroyVertexBuffer(vbo);
				vbo = nullptr;
			}
		}
		else if (_action == MainPanel::EventLoad)
		{
			//mEditorWindow->getView()->createWidget<MyGUI::Window>(
			//	MyGUI::WidgetStyle::Overlapped, "WindowCSX",
			//	MyGUI::IntCoord(10, 10, 100, 100),
			//	MyGUI::Align::Default, "", "tempWindow");

			
			if (!vbo)
			{
				vbo = MyGUI::RenderManager::getInstance().createVertexBuffer();
			}

			for (unsigned i = 2; i < 2048; i += 4)
			{
				vbo->setVertexCount(i);
				vbo->lock();
				vbo->unlock();
			}

			//createWindows();
		}
		else if (_action == MainPanel::EventCreate)
		{
			MyGUI::Widget* view = mEditorWindow->getView();
			const MyGUI::IntCoord& coord = view->getClientCoord();

			if (_index == 0)
			{
				const MyGUI::IntSize size(80, 80);
				MyGUI::Window* window = view->createWidget<MyGUI::Window>(MyGUI::WidgetStyle::Overlapped, "WindowCS", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				window->setCaption("Frame");
				window->setMinSize(size);
			}
			else if (_index == 1)
			{
				const MyGUI::IntSize size(180, 15);
				MyGUI::ScrollBar* scroll = view->createWidget<MyGUI::ScrollBar>("ScrollBarH", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				scroll->setScrollRange(200);
				scroll->setScrollPosition(10);
				scroll->setScrollPage(1);
				scroll->setScrollViewPage(20);
			}
			else if (_index == 2)
			{
				const MyGUI::IntSize size(15, 180);
				MyGUI::ScrollBar* scroll = view->createWidget<MyGUI::ScrollBar>("ScrollBarV", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				scroll->setScrollRange(200);
				scroll->setScrollPosition(10);
				scroll->setScrollPage(1);
				scroll->setScrollViewPage(20);
			}
			else if (_index == 3)
			{
				const MyGUI::IntSize size(80, 26);
				MyGUI::TextBox* text = view->createWidget<MyGUI::TextBox>("TextBox", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				text->setCaption("TextBox");
			}
			else if (_index == 4)
			{
				const MyGUI::IntSize size(50, 50);
				MyGUI::ImageBox* image = view->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				image->setImageTexture("HelpIcon.png");
			}
			else if (_index == 5)
			{
				const MyGUI::IntSize size(480, 320);
				MyGUI::Window* window = view->createWidget<MyGUI::Window>(MyGUI::WidgetStyle::Overlapped, "WindowCSX", MyGUI::IntCoord(getRand(0, coord.width - size.width), getRand(0, coord.height - size.height), size.width, size.height), MyGUI::Align::Default);
				window->setCaption("Render");
				MyGUI::Canvas* canvas = window->createWidget<MyGUI::Canvas>("Canvas", MyGUI::IntCoord(0, 0, window->getClientCoord().width, window->getClientCoord().height), MyGUI::Align::Stretch);

				createRenderBox(canvas);
			}
		}
	}
Ejemplo n.º 13
0
	void TextFieldControl::setCaption(const MyGUI::UString& _value)
	{
		MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>(false);
		if (window != nullptr)
			window->setCaption(_value);
	}