Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.9 KiB

  1. //
  2. // kes.h
  3. //
  4. #ifndef KES_H
  5. #define KES_H
  6. #include "private.h"
  7. typedef HRESULT (*KESCALLBACK)(UINT uCode, ITfContext *pic, WPARAM wParam, LPARAM lParam, BOOL *pfEaten, void *pv);
  8. typedef HRESULT (*KESPREKEYCALLBACK)(ITfContext *pic, REFGUID rguid, BOOL *pfEaten, void *pv);
  9. #define KES_CODE_FOCUS 0x00000000
  10. #define KES_CODE_KEYUP 0x00000001
  11. #define KES_CODE_KEYDOWN 0x00000002
  12. #define KES_CODE_TEST 0x80000000
  13. typedef struct tag_KESPRESERVEDKEY {
  14. const GUID *pguid;
  15. TF_PRESERVEDKEY tfpk;
  16. const WCHAR *psz;
  17. } KESPRESERVEDKEY;
  18. class CKeyEventSink : public ITfKeyEventSink
  19. {
  20. public:
  21. CKeyEventSink(KESCALLBACK pfnCallback, void *pv);
  22. CKeyEventSink(KESCALLBACK pfnCallback, KESPREKEYCALLBACK pfnPrekeyCallback, void *pv);
  23. ~CKeyEventSink();
  24. //
  25. // IUnknown methods
  26. //
  27. STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
  28. STDMETHODIMP_(ULONG) AddRef(void);
  29. STDMETHODIMP_(ULONG) Release(void);
  30. //
  31. // ITfWin32KeyEventSink
  32. //
  33. STDMETHODIMP OnSetFocus(BOOL fForeground);
  34. STDMETHODIMP OnTestKeyDown(ITfContext *pic, WPARAM wParam, LPARAM lParam, BOOL *pfEaten);
  35. STDMETHODIMP OnKeyDown(ITfContext *pic, WPARAM wParam, LPARAM lParam, BOOL *pfEaten);
  36. STDMETHODIMP OnTestKeyUp(ITfContext *pic, WPARAM wParam, LPARAM lParam, BOOL *pfEaten);
  37. STDMETHODIMP OnKeyUp(ITfContext *pic, WPARAM wParam, LPARAM lParam, BOOL *pfEaten);
  38. STDMETHODIMP OnPreservedKey(ITfContext *pic, REFGUID rguid, BOOL *pfEaten);
  39. HRESULT _Register(ITfThreadMgr *ptim, TfClientId tid, const KESPRESERVEDKEY *pprekey);
  40. HRESULT _Unregister(ITfThreadMgr *ptim, TfClientId tid, const KESPRESERVEDKEY *pprekey);
  41. private:
  42. KESCALLBACK _pfnCallback;
  43. KESPREKEYCALLBACK _pfnPreKeyCallback;
  44. void *_pv;
  45. DWORD _dwCookiePreservedKey;
  46. int _cRef;
  47. };
  48. #endif // KES_H