This repository was archived by the owner on Feb 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 959
/
Copy pathIMEEdit.h
109 lines (95 loc) · 3.5 KB
/
IMEEdit.h
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
109
#if !defined(AFX_IMEEDIT_H__F425503C_0F3C_4C7D_A2E5_A9A7E35AC07B__INCLUDED_)
#define AFX_IMEEDIT_H__F425503C_0F3C_4C7D_A2E5_A9A7E35AC07B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// IMEEdit.h : header file
//
// Define constant for CIMEEdit
#define X_INIT 5
#define Y_INIT 5
#define FONT_HEIGHT 16
#define FONT_WIDTH 16
#define BUFFERSIZE 30
#define WCHARSIZE 2
// Define language ID
#define LID_TRADITIONAL_CHINESE 0x0404
#define LID_JAPANESE 0x0411
#define LID_KOREAN 0x0412
#define LID_SIMPLIFIED_CHINESE 0x0804
//define custom message
#define WM_SETINPUTLANG WM_USER + 1
#define WM_SETMODE WM_USER + 2
#define WM_RESETMODE WM_USER + 3
#define WM_TOGGLE WM_USER + 4
/////////////////////////////////////////////////////////////////////////////
// CIMEEdit window
class CIMEEdit : public CEdit
{
// Construction
public:
CIMEEdit();
// Attributes
protected:
int m_xEndPos; // End position of buffer
int m_xInsertPos; // Insert position of buffer
int m_xCaretPos; // Caret position of buffer
int m_nComSize; // Composition string size
int m_nComCursorPos; // Current cursor position in composition string
DWORD m_nComAttrSize; // The size of the attribute of the composition string
int m_nInvertStart; // Start position of invert string
int m_nInvertEnd; // End position of invert string
DWORD m_dwProperty; // Property of IME
UINT m_nCodePage; // Code page
BYTE m_nCharSet; // Character set
HFONT m_hFont; // Font
BOOL m_fShowInvert; // If true, sample show invert string
BOOL m_fStat; // If true, IME composite string
BYTE m_bComAttr[BUFFERSIZE+1]; // The attributes of the composition string
DWORD m_dwCompCls[BUFFERSIZE+1]; // The composition
wchar_t m_szBuffer[BUFFERSIZE+1]; // Buffer for input string
wchar_t m_szComStr[BUFFERSIZE+1]; // Buffer for composition string
wchar_t m_szBackup[BUFFERSIZE+1]; // Buffer for backup last string
public:
wchar_t m_szWFontName[50]; // Font name in UNICODE
char m_szMBFontName[50]; // Font name in multibyte
int m_nLanguage; // Internal index of language
BOOL m_fIsNT; // If true, NT. Or Win9X
BOOL m_fIsXP; // if true, Windows XP or higher version
// Operations
public:
BOOL OnImeComposition(WPARAM wParam,LPARAM lParam);
void OnImeStartComposition(WPARAM wParam,LPARAM lParam);
void OnImeEndComposition(WPARAM wParam,LPARAM lParam);
int InsertCompStr();
void ShowCaretOnView();
int GetWidthOfString(wchar_t*);
void SetFont(HKL hKeyboardLayout, LPCTSTR szSelectedFont);
void ClearBuffer();
int GetCombinedCharLength(int);
void SetCandiDateWindowPos();
void SetCompositionWindowPos();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CIMEEdit)
protected:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CIMEEdit();
// Generated message map functions
protected:
//{{AFX_MSG(CIMEEdit)
afx_msg void OnPaint();
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_IMEEDIT_H__F425503C_0F3C_4C7D_A2E5_A9A7E35AC07B__INCLUDED_)