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.

62 lines
1.5 KiB

  1. //
  2. // timsink.h
  3. //
  4. #ifndef TIMSINK_H
  5. #define TIMSINK_H
  6. #include "private.h"
  7. typedef HRESULT (*DIMCALLBACK)(UINT uCode, ITfDocumentMgr *dim, ITfDocumentMgr *dimPrev, void *pv);
  8. typedef HRESULT (*ICCALLBACK)(UINT uCode, ITfContext *pic, void *pv);
  9. #define TIM_CODE_INITDIM 0
  10. #define TIM_CODE_UNINITDIM 1
  11. #define TIM_CODE_SETFOCUS 2
  12. #define TIM_CODE_INITIC 3
  13. #define TIM_CODE_UNINITIC 4
  14. class CThreadMgrEventSink : public ITfThreadMgrEventSink
  15. {
  16. public:
  17. CThreadMgrEventSink(DIMCALLBACK pfnDIMCallback, ICCALLBACK pfnICCallback, void *pv);
  18. ~CThreadMgrEventSink();
  19. //
  20. // IUnknown methods
  21. //
  22. STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
  23. STDMETHODIMP_(ULONG) AddRef(void);
  24. STDMETHODIMP_(ULONG) Release(void);
  25. //
  26. // ITfThreadMgrEventSink
  27. //
  28. STDMETHODIMP OnInitDocumentMgr(ITfDocumentMgr *dim);
  29. STDMETHODIMP OnUninitDocumentMgr(ITfDocumentMgr *dim);
  30. STDMETHODIMP OnSetFocus(ITfDocumentMgr *dimFocus, ITfDocumentMgr *dimPrevFocus);
  31. STDMETHODIMP OnPushContext(ITfContext *pic);
  32. STDMETHODIMP OnPopContext(ITfContext *pic);
  33. HRESULT _Advise(ITfThreadMgr *tim);
  34. HRESULT _Unadvise();
  35. HRESULT _InitDIMs(BOOL fInit);
  36. protected:
  37. void SetCallbackPV(void* pv)
  38. {
  39. if (_pv == NULL)
  40. _pv = pv;
  41. };
  42. private:
  43. ITfThreadMgr *_tim;
  44. DWORD _dwCookie;
  45. DIMCALLBACK _pfnDIMCallback;
  46. ICCALLBACK _pfnICCallback;
  47. TfClientId _tid;
  48. void *_pv;
  49. int _cRef;
  50. };
  51. #endif // TIMSINK_H