blob: ccf9def53655629a7618f99086e1aaa4b93f4360 (
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
97
98
99
100
101
102
103
104
105
106
107
108
|
#ifndef _LCDINPUTTEXT_H_INCLUDED_
#define _LCDINPUTTEXT_H_INCLUDED_
#define MARKER_HOLD 0
#define MARKER_HORIZONTAL 1
#define MARKER_VERTICAL 2
#define KEYS_RETURN 0
#define KEYS_CTRL_RETURN 1
#include "CLCDTextObject.h"
#include "CLCDBar.h"
struct SMarker
{
int iPosition;
int iXLine;
int iXWidth;
int iLine;
};
struct SLineEntry
{
int iOffset;
int iWidth;
bool bLineBreak;
};
class CLineEntry
{
public:
tstring strLine;
vector<int> vWrapLineOffsets;
};
class CLCDInput : public CLCDTextObject
{
public:
CLCDInput();
~CLCDInput();
bool Initialize();
bool Shutdown();
bool Draw(CLCDGfx *pGfx);
bool Update();
void ShowSymbols(bool bShow);
void SetBreakKeys(int iKeys);
void SetScrollbar(CLCDBar *pScrollbar);
void ActivateInput();
void DeactivateInput();
bool IsInputActive();
tstring GetText();
void Reset();
static LRESULT CALLBACK KeyboardHook(int Code, WPARAM wParam, LPARAM lParam);
int GetLineCount();
int GetLine();
bool ScrollLine(bool bDown=true);
void ScrollToMarker();
long GetLastInputTime();
protected:
void OnFontChanged();
void OnSizeChanged(SIZE OldSize);
LRESULT ProcessKeyEvent(int Code, WPARAM wParam, LPARAM lParam);
void UpdateOffsets(int iModified);
void UpdateMarker();
void MoveMarker(int iDir,int iMove,bool bShift=false);
protected:
bool m_bShowSymbols;
bool m_iBreakKeys;
int m_iLineCount;
long m_lInputTime;
bool m_bInsert;
long m_lBlinkTimer;
bool m_bShowMarker;
int m_iLinePosition;
SMarker m_Marker[2];
// Text variables
tstring m_strText;
vector<SLineEntry> m_vLineOffsets;
// Input variables
static CLCDInput* m_pInput;
HHOOK m_hKBHook;
BYTE m_acKeyboardState[256];
// Scrollbar
CLCDBar *m_pScrollbar;
};
#endif // !_LCDTEXT_H_INCLUDED_
//** end of LCDText.h ****************************************************
|