aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UIScene_Keyboard.h
blob: 146934c1f62fd6860ee151d297a19fd3f4704a93 (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
94
95
96
#pragma once

#include "UIScene.h"

class UIScene_Keyboard : public UIScene
{
private:
	bool m_bKeyboardDonePressed;

#ifdef _WINDOWS64
	int(*m_win64Callback)(LPVOID, const bool);
	LPVOID m_win64CallbackParam;
	wstring m_win64TextBuffer;
	int m_win64MaxChars;
	bool m_bPCMode; // Hides on-screen keyboard buttons; physical keyboard only
	int m_iCursorPos;
#endif

protected:
	UIControl_Label m_EnterTextLabel;
	UIControl_TextInput m_KeyboardTextInput;
	UIControl_Button m_ButtonSpace, m_ButtonCursorLeft, m_ButtonCursorRight, m_ButtonCaps, m_ButtonDone, m_ButtonSymbols, m_ButtonBackspace;

	IggyName m_funcInitFunctionButtons;
	IggyName m_funcCursorRightButtonPressed, m_funcCursorLeftButtonPressed, m_funcCapsButtonPressed, m_funcBackspaceButtonPressed;
	IggyName m_funcSpaceButtonPressed, m_funcSymbolButtonPressed, m_funcDoneButtonPressed;

	UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
		UI_MAP_ELEMENT(m_EnterTextLabel, "EnterTextLabel")
		UI_MAP_ELEMENT(m_KeyboardTextInput, "KeyboardTextInput")

		UI_MAP_ELEMENT(m_ButtonSpace, "Button_space")
		UI_MAP_ELEMENT(m_ButtonCursorLeft, "Button_CursorLeft")
		UI_MAP_ELEMENT(m_ButtonCursorRight, "Button_CursorRight")
		UI_MAP_ELEMENT(m_ButtonCaps, "Button_Caps")
		UI_MAP_ELEMENT(m_ButtonDone, "Button_Done")
		UI_MAP_ELEMENT(m_ButtonSymbols, "Button_symbols")
		UI_MAP_ELEMENT(m_ButtonBackspace, "Button_bspace")

		UI_MAP_NAME(m_funcInitFunctionButtons, L"InitFunctionButtons");

		UI_MAP_NAME(m_funcCursorRightButtonPressed, L"CursorRightButtonPressed");
		UI_MAP_NAME(m_funcCursorLeftButtonPressed, L"CursorLeftButtonPressed");
		UI_MAP_NAME(m_funcCapsButtonPressed, L"CapsButtonPressed");
		UI_MAP_NAME(m_funcBackspaceButtonPressed, L"BackspaceButtonPressed");
		UI_MAP_NAME(m_funcSpaceButtonPressed, L"SpaceButtonPressed");
		UI_MAP_NAME(m_funcSymbolButtonPressed, L"SymbolButtonPressed");
		UI_MAP_NAME(m_funcDoneButtonPressed, L"DoneButtonPressed");
	UI_END_MAP_ELEMENTS_AND_NAMES()

public:
	UIScene_Keyboard(int iPad, void *initData, UILayer *parentLayer);
	~UIScene_Keyboard();

	virtual void updateTooltips();

	virtual bool allowRepeat(int key);
	// INPUT
	virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);

#ifdef _WINDOWS64
	virtual void tick();
#endif

	virtual void handleTimerComplete(int id);

protected:
	void handlePress(F64 controlId, F64 childId);

protected:
	// TODO: This should be pure virtual in this class
	virtual wstring getMoviePath();

private:
	void KeyboardDonePressed();

public:
	virtual EUIScene getSceneType() { return eUIScene_Keyboard;}

	// Returns true if this scene handles input
	//virtual bool stealsFocus() { return false; }

	// Returns true if this scene has focus for the pad passed in
	//virtual bool hasFocus(int iPad) { return false; }
	// Returns true if this scene has focus for the pad passed in
#ifndef __PS3__
	virtual bool hasFocus(int iPad) { return bHasFocus; }
#endif

	// Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden
#ifdef _WINDOWS64
	virtual bool hidesLowerScenes() { return true; }
#else
	virtual bool hidesLowerScenes() { return false; }
#endif
};