File: MainPanel.cpp

package info (click to toggle)
mygui 3.2.2%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 36,228 kB
  • sloc: cpp: 118,031; ansic: 30,202; xml: 15,544; cs: 12,602; tcl: 776; python: 417; makefile: 34
file content (51 lines) | stat: -rw-r--r-- 1,370 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*!
	@file
	@author		Albert Semenov
	@date		10/2008
*/
#include "Precompiled.h"
#include "MainPanel.h"

namespace demo
{

	MainPanel::MainPanel() :
		BaseLayout("MainPanel.layout")
	{
		//mMainWidget->setPosition(10, 10);

		assignWidget(mButtonNew, "New");
		assignWidget(mButtonLoad, "Load");
		assignWidget(mButtonQuit, "Quit");
		assignWidget(mComboCreate, "CreateObject");

		mButtonNew->eventMouseButtonClick += MyGUI::newDelegate(this, &MainPanel::notifyMouseButtonClick);
		mButtonLoad->eventMouseButtonClick += MyGUI::newDelegate(this, &MainPanel::notifyMouseButtonClick);
		mButtonQuit->eventMouseButtonClick += MyGUI::newDelegate(this, &MainPanel::notifyMouseButtonClick);
		mComboCreate->eventComboAccept += MyGUI::newDelegate(this, &MainPanel::notifyComboAccept);
	}

	void MainPanel::addObject(const MyGUI::UString& _name)
	{
		mComboCreate->addItem(_name);
	}

	void MainPanel::notifyMouseButtonClick(MyGUI::Widget* _sender)
	{
		if (_sender == mButtonNew)
			eventAction(EventNew, 0);
		else if (_sender == mButtonLoad)
			eventAction(EventLoad, 0);
		else if (_sender == mButtonQuit)
			eventAction(EventQuit, 0);
	}

	void MainPanel::notifyComboAccept(MyGUI::ComboBox* _sender, size_t _index)
	{
		eventAction(EventCreate, _index);

		mComboCreate->setIndexSelected(MyGUI::ITEM_NONE);
		mComboCreate->setCaption("Select Type");
	}

} // namespace demo