Repository navigation
Expand file tree
/
Copy pathCandidateWindow.h
More file actions
122 lines (98 loc) · 3.25 KB
/
Copy pathCandidateWindow.h
File metadata and controls
122 lines (98 loc) · 3.25 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
//////////////////////////////////////////////////////////////////////
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (C) 2003 Microsoft Corporation. All rights reserved.
//
// CandidateWindow.h
//
// CCandidateWindow declaration.
//
//////////////////////////////////////////////////////////////////////
#ifndef CANDIDATEWINDOW_H
#define CANDIDATEWINDOW_H
#define MAX_CAND_STR 50
//+---------------------------------------------------------------------------
//
// CCandidateWindow
//
//----------------------------------------------------------------------------
class CCandidateWindow : public ITfCandidateListUIElementBehavior
{
public:
CCandidateWindow(CTextService *pTextService);
~CCandidateWindow();
// IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
// ITfUIElement
STDMETHODIMP GetDescription(BSTR *bstr);
STDMETHODIMP GetGUID(GUID *pguid);
STDMETHODIMP Show(BOOL bShow);
STDMETHODIMP IsShown(BOOL *pbShow);
// ITfCandidateListUIElement
STDMETHODIMP GetUpdatedFlags(DWORD *pdwFlags);
STDMETHODIMP GetDocumentMgr(ITfDocumentMgr **ppDocumentMgr);
STDMETHODIMP GetCount(UINT *puCount);
STDMETHODIMP GetSelection(UINT *puIndex);
STDMETHODIMP GetString(UINT uIndex, BSTR *pstr);
STDMETHODIMP GetPageIndex(UINT *pIndex,
UINT uSize,
UINT *puPageCnt);
STDMETHODIMP SetPageIndex(UINT *pIndex,
UINT uPageCnt);
STDMETHODIMP GetCurrentPage(UINT *puPage);
// ITfCandidateListUIElementBehavior
STDMETHODIMP SetSelection(UINT nIndex);
STDMETHODIMP Finalize();
STDMETHODIMP Abort();
static BOOL _InitWindowClass();
static void _UninitWindowClass();
BOOL _Create();
void _Destroy();
void _Move(int x, int y);
void _Begin();
void _End();
void _RefreshFromState();
HRESULT _OnKeyDown(UINT uVKey);
HRESULT _OnKeyUp(UINT uVKey);
private:
void _GetCompositionText();
void _InitList();
void _CallUpdateUIElement();
void _Next();
void _Prev();
void _NextPage();
void _PrevPage();
UINT _GetPageSize() const;
static LRESULT CALLBACK _WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static void _SetThis(HWND hwnd, LPARAM lParam)
{
SetWindowLongPtr(hwnd, GWLP_USERDATA,
(LONG_PTR)((CREATESTRUCT *)lParam)->lpCreateParams);
}
static CCandidateWindow *_GetThis(HWND hwnd)
{
return (CCandidateWindow *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
}
static ATOM _atomWndClass;
HWND _hwnd;
CTextService *_pTextService;
// the converted text
WCHAR _szText[256];
// Candidate list UIElement information
UINT _uCandList;
WCHAR *_arCandStr[MAX_CAND_STR];
UINT _uSelection;
UINT _arPageIndex[MAX_CAND_STR];
UINT _uPageCnt;
DWORD _dwUpdatetFlags;
DWORD _dwUIElementId;
BOOL _bInShowMode;
LONG _cRef;
};
#endif // CANDIDATEWINDOW_H