File: State.h

package info (click to toggle)
mygui 3.2.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,224 kB
  • sloc: cpp: 118,031; ansic: 30,202; xml: 15,544; cs: 12,602; tcl: 776; python: 417; makefile: 34
file content (80 lines) | stat: -rw-r--r-- 1,518 bytes parent folder | download | duplicates (3)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*!
	@file
	@author		Albert Semenov
	@date		12/2008
*/
#ifndef MENU_1_H_
#define MENU_1_H_

#include <MyGUI.h>
#include "BaseLayout/BaseLayout.h"

namespace demo
{

	struct ControllerType
	{
		enum EnumType
		{
			Jump,
			Accelerated,
			Slowed,
			Inertional,
			MAX
		};

		ControllerType(EnumType _value = MAX) :
			value(_value)
		{
		}

		friend bool operator == (ControllerType const& a, ControllerType const& b)
		{
			return a.value == b.value;
		}

		friend bool operator != (ControllerType const& a, ControllerType const& b)
		{
			return a.value != b.value;
		}

	private:
		EnumType value;
	};

	class State :
		public wraps::BaseLayout
	{
	public:
		State(const std::string& _layout, ControllerType _type);
		virtual ~State();

		MyGUI::Widget* getClient();

		void setVisible(bool _visible);

		MyGUI::delegates::CDelegate2<ControllerType, bool> eventButtonPress;

	private:
		void notifyMouseButtonClick(MyGUI::Widget* _sender);
		void notifyFrameEvent(float _time);
		void notifyPostAction(MyGUI::Widget* _sender, MyGUI::ControllerItem* _controller);

		MyGUI::ControllerPosition* createControllerPosition(const MyGUI::IntPoint& _point);
		MyGUI::ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);

		void FrameAdvise(bool _advise);

	private:
		bool mFrameAdvise;
		MyGUI::Button* mButton1;
		MyGUI::Button* mButton2;
		MyGUI::Button* mButton3;
		MyGUI::Button* mButton4;
		float mCountTime;
		ControllerType mType;
	};

} // namespace demo

#endif // MENU_1_H_