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.

116 lines
2.5 KiB

  1. //
  2. // asynccal.h
  3. //
  4. #ifndef AYNCCAL_H
  5. #define AYNCCAL_H
  6. #include "helpers.h"
  7. //////////////////////////////////////////////////////////////////////////////
  8. //
  9. // CAsyncCall
  10. //
  11. //////////////////////////////////////////////////////////////////////////////
  12. class CAsyncCall
  13. {
  14. public:
  15. CAsyncCall(ITfLangBarItemButton *plb)
  16. {
  17. plb->AddRef();
  18. _plbiButton = plb;
  19. _plbiBitmapButton = NULL;
  20. _plbiBitmap = NULL;
  21. _plbiBalloon = NULL;
  22. _ref = 1;
  23. }
  24. CAsyncCall(ITfLangBarItemBitmapButton *plb)
  25. {
  26. plb->AddRef();
  27. _plbiButton = NULL;
  28. _plbiBitmapButton = plb;
  29. _plbiBitmap = NULL;
  30. _plbiBalloon = NULL;
  31. _ref = 1;
  32. }
  33. CAsyncCall(ITfLangBarItemBitmap *plb)
  34. {
  35. plb->AddRef();
  36. _plbiButton = NULL;
  37. _plbiBitmapButton = NULL;
  38. _plbiBitmap = plb;
  39. _plbiBalloon = NULL;
  40. _ref = 1;
  41. }
  42. CAsyncCall(ITfLangBarItemBalloon *plb)
  43. {
  44. plb->AddRef();
  45. _plbiButton = NULL;
  46. _plbiBitmapButton = NULL;
  47. _plbiBitmap = NULL;
  48. _plbiBalloon = plb;
  49. _ref = 1;
  50. }
  51. ~CAsyncCall()
  52. {
  53. SafeRelease(_plbiButton);
  54. SafeRelease(_plbiBitmapButton);
  55. SafeRelease(_plbiBitmap);
  56. SafeRelease(_plbiBalloon);
  57. _ref = 1;
  58. }
  59. HRESULT OnClick(TfLBIClick click, POINT pt, const RECT *prc)
  60. {
  61. _action = DOA_ONCLICK;
  62. _click = click;
  63. _pt = pt;
  64. _rc = *prc;
  65. return StartThread();
  66. }
  67. HRESULT OnMenuSelect(ULONG uId)
  68. {
  69. _action = DOA_ONMENUSELECT;
  70. _uId = uId;
  71. return StartThread();
  72. }
  73. ULONG _AddRef( );
  74. ULONG _Release( );
  75. private:
  76. DWORD _dwThreadId;
  77. HRESULT StartThread();
  78. static DWORD s_ThreadProc(void *pv);
  79. DWORD ThreadProc();
  80. ITfLangBarItemButton *_plbiButton;
  81. ITfLangBarItemBitmapButton *_plbiBitmapButton;
  82. ITfLangBarItemBitmap *_plbiBitmap;
  83. ITfLangBarItemBalloon *_plbiBalloon;
  84. typedef enum {
  85. DOA_ONCLICK = 0,
  86. DOA_ONMENUSELECT = 1,
  87. } DOA_ACTION;
  88. DOA_ACTION _action;
  89. ULONG _uId;
  90. TfLBIClick _click;
  91. POINT _pt;
  92. RECT _rc;
  93. HRESULT _hr;
  94. BOOL _fThreadStarted;
  95. LONG _ref;
  96. };
  97. #endif AYNCCAL_H