-
Notifications
You must be signed in to change notification settings - Fork 0
/
LanguageBar.h
80 lines (62 loc) · 2.62 KB
/
LanguageBar.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
// 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) Microsoft Corporation. All rights reserved
#pragma once
#include "Private.h"
#include "SampleIME.h"
#include "CompositionProcessorEngine.h"
#include "Globals.h"
#include "Compartment.h"
class CCompartment;
class CCompartmentEventSink;
class CLangBarItemButton : public ITfLangBarItemButton, public ITfSource
{
public:
CLangBarItemButton(REFGUID guidLangBar, LPCWSTR description, LPCWSTR tooltip, DWORD onIconIndex, DWORD offIconIndex,
BOOL isSecureMode);
~CLangBarItemButton();
// IUnknown
STDMETHODIMP QueryInterface(REFIID riid, _Outptr_ void **ppvObj);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
// ITfLangBarItem
STDMETHODIMP GetInfo(_Out_ TF_LANGBARITEMINFO *pInfo);
STDMETHODIMP GetStatus(_Out_ DWORD *pdwStatus);
STDMETHODIMP Show(BOOL fShow);
STDMETHODIMP GetTooltipString(_Out_ BSTR *pbstrToolTip);
// ITfLangBarItemButton
STDMETHODIMP OnClick(TfLBIClick click, POINT pt, _In_ const RECT *prcArea);
STDMETHODIMP InitMenu(_In_ ITfMenu *pMenu);
STDMETHODIMP OnMenuSelect(UINT wID);
STDMETHODIMP GetIcon(_Out_ HICON *phIcon);
STDMETHODIMP GetText(_Out_ BSTR *pbstrText);
// ITfSource
STDMETHODIMP AdviseSink(__RPC__in REFIID riid, __RPC__in_opt IUnknown *punk, __RPC__out DWORD *pdwCookie);
STDMETHODIMP UnadviseSink(DWORD dwCookie);
// Add/Remove languagebar item
HRESULT _AddItem(_In_ ITfThreadMgr *pThreadMgr);
HRESULT _RemoveItem(_In_ ITfThreadMgr *pThreadMgr);
// Register compartment for button On/Off switch
BOOL _RegisterCompartment(_In_ ITfThreadMgr *pThreadMgr, TfClientId tfClientId, REFGUID guidCompartment);
BOOL _UnregisterCompartment(_In_ ITfThreadMgr *pThreadMgr);
void CleanUp();
void SetStatus(DWORD dwStatus, BOOL fSet);
private:
ITfLangBarItemSink *_pLangBarItemSink;
TF_LANGBARITEMINFO _tfLangBarItemInfo;
LPCWSTR _pTooltipText;
DWORD _onIconIndex;
DWORD _offIconIndex;
BOOL _isAddedToLanguageBar;
BOOL _isSecureMode;
DWORD _status;
CCompartment *_pCompartment;
CCompartmentEventSink *_pCompartmentEventSink;
static HRESULT _CompartmentCallback(_In_ void *pv, REFGUID guidCompartment);
// The cookie for the sink to CLangBarItemButton.
static const DWORD _cookie = 0;
LONG _refCount;
};