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.

70 lines
1.5 KiB

  1. //
  2. // tes.h
  3. //
  4. // Generic ITfTextEventSink object
  5. //
  6. #ifndef TES_H
  7. #define TES_H
  8. #include "private.h"
  9. #define TES_INVALID_COOKIE ((DWORD)(-1))
  10. #define ICF_TEXTDELTA 1
  11. #define ICF_LAYOUTDELTA 2
  12. #define ICF_LAYOUTDELTA_CREATE 3
  13. #define ICF_LAYOUTDELTA_DESTROY 4
  14. typedef struct
  15. {
  16. TfEditCookie ecReadOnly;
  17. ITfEditRecord *pEditRecord;
  18. ITfContext *pic;
  19. } TESENDEDIT;
  20. typedef HRESULT (*TESCALLBACK)(UINT uCode, void *pv, void *pvData);
  21. class CTextEventSink : public ITfTextEditSink,
  22. public ITfTextLayoutSink
  23. {
  24. public:
  25. CTextEventSink(TESCALLBACK pfnCallback, void *pv);
  26. virtual ~CTextEventSink() {};
  27. //
  28. // IUnknown methods
  29. //
  30. STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
  31. STDMETHODIMP_(ULONG) AddRef(void);
  32. STDMETHODIMP_(ULONG) Release(void);
  33. //
  34. // ITfTextEventSink
  35. //
  36. STDMETHODIMP OnEndEdit(ITfContext *pic, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord);
  37. STDMETHODIMP OnLayoutChange(ITfContext *pic, TfLayoutCode lcode, ITfContextView *pView);
  38. HRESULT _Advise(ITfContext *pic, DWORD dwFlags);
  39. HRESULT _Unadvise();
  40. protected:
  41. void SetCallbackPV(void* pv)
  42. {
  43. if (_pv == NULL)
  44. _pv = pv;
  45. };
  46. private:
  47. long _cRef;
  48. ITfContext *_pic;
  49. DWORD _dwEditCookie;
  50. DWORD _dwLayoutCookie;
  51. DWORD _dwFlags;
  52. TESCALLBACK _pfnCallback;
  53. void *_pv;
  54. };
  55. #endif // TES_H