aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UIControl.h
blob: 8445af0fc0cac15e4d8b1f8d576de56e9d197c84 (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
#pragma once

// This class for any name object in the flash scene
class UIControl
{

public:
	enum eUIControlType
	{
		eNoControl,
		eButton,
		eButtonList,
		eCheckBox,
		eCursor,
		eDLCList,
		eDynamicLabel,
		eEnchantmentBook,
		eEnchantmentButton,
		eHTMLLabel,
		eLabel,
		eLeaderboardList,
		eMinecraftPlayer,
		eMinecraftHorse,
		ePlayerList,
		ePlayerSkinPreview,
		eProgress,
		eSaveList,
		eSlider,
		eSlotList,
		eTextInput,
		eTexturePackList,
		eBitmapIcon,
		eTouchControl,
	};
protected:
	eUIControlType m_eControlType;
	int m_id;
	bool m_bHidden; // set by the Remove call

public:
	UIControl *m_pParentPanel; // set by UI_MAP_ELEMENT macro during mapElementsAndNames

	void setControlType(eUIControlType eType) {m_eControlType=eType;}
	eUIControlType getControlType() {return m_eControlType;}
	void setId(int iID) { m_id=iID; }
	int getId() { return m_id; }
	UIScene * getParentScene() {return m_parentScene;}
	UIControl* getParentPanel() { return m_pParentPanel; }

protected:
	IggyValuePath m_iggyPath;
	UIScene *m_parentScene;
	string m_controlName;

	IggyName m_nameXPos, m_nameYPos, m_nameWidth, m_nameHeight;
	IggyName m_funcSetAlpha, m_nameVisible;

	S32 m_x,m_y,m_width,m_height;
	float m_lastOpacity;
	bool m_isVisible;

public:
	UIControl();

	virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
	void UpdateControl();
	void setHidden(bool bHidden) {m_bHidden=bHidden;}
	bool getHidden(void) {return m_bHidden;}

	IggyValuePath *getIggyValuePath();

	string getControlName() { return m_controlName; }

	virtual void tick() {}
	virtual void ReInit();

	virtual void setFocus(bool focus) {}

	S32 getXPos();
	S32 getYPos();
	S32 getWidth();
	S32 getHeight();

	void setOpacity(float percent);
	void setVisible(bool visible);
	bool getVisible();
	bool isVisible() { return m_isVisible; }

	virtual bool hasFocus() { return false; }

protected:
	IggyName registerFastName(const wstring &name);
};