1 /*!
2 	@file
3 	@author		Albert Semenov
4 	@date		09/2008
5 */
6 #include "Precompiled.h"
7 #include "DemoKeeper.h"
8 #include "Base/Main.h"
9 
10 namespace demo
11 {
12 
DemoKeeper()13 	DemoKeeper::DemoKeeper() :
14 		mColourPanel(nullptr),
15 		mEditPanel(nullptr)
16 	{
17 	}
18 
setupResources()19 	void DemoKeeper::setupResources()
20 	{
21 		base::BaseManager::setupResources();
22 		addResourceLocation(getRootMedia() + "/Demos/Demo_Colour");
23 		addResourceLocation(getRootMedia() + "/Common/Demos");
24 	}
25 
createScene()26 	void DemoKeeper::createScene()
27 	{
28 		base::BaseDemoManager::createScene();
29 		MyGUI::LayoutManager::getInstance().loadLayout("Wallpaper.layout");
30 		const MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().loadLayout("HelpPanel.layout");
31 		if (root.size() == 1)
32 			root.at(0)->findWidget("Text")->castType<MyGUI::TextBox>()->setCaption("Sample colour picker implementation. Select text in EditBox and then select colour to colour selected part of text.");
33 
34 		mColourPanel = new ColourPanel();
35 		mEditPanel = new EditPanel();
36 
37 		mColourPanel->eventColourAccept = MyGUI::newDelegate(this, &DemoKeeper::notifyColourAccept);
38 	}
39 
destroyScene()40 	void DemoKeeper::destroyScene()
41 	{
42 		delete mEditPanel;
43 		mEditPanel = nullptr;
44 		delete mColourPanel;
45 		mColourPanel = nullptr;
46 	}
47 
notifyColourAccept(ColourPanel * _sender)48 	void DemoKeeper::notifyColourAccept(ColourPanel* _sender)
49 	{
50 		mEditPanel->setColourSelected(_sender->getColour());
51 	}
52 
53 } // namespace demo
54 
55 MYGUI_APP(demo::DemoKeeper)
56