EventCenter.hpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. /***************************************************************************
  2. * E-Com Technology Ltd.
  3. *
  4. * ECOMPACS DICOM Utility Libraries
  5. ***************************************************************************/
  6. #ifndef _INCLUDE_EVENT_CENTER
  7. #define _INCLUDE_EVENT_CENTER
  8. #ifndef _IMAGE_VIEWER_DLL
  9. #define IMAGE_VIEWER_API _declspec(dllimport)
  10. #else
  11. #define IMAGE_VIEWER_API _declspec(dllexport)
  12. #endif
  13. #include "Delegate.hpp"
  14. //#include "MultiDelegate.hpp"
  15. //#include "UnsafeDelegate.hpp"
  16. //#include "UnsafeNotifyDelegate.hpp"
  17. //#include "TimerDelegate.hpp"
  18. class ImageShow;
  19. //-----------------------------------------------------------------------------
  20. // A general DelegateArg of DateTime
  21. //-----------------------------------------------------------------------------
  22. class EventArgsDateTime : public DelegateArgs
  23. {
  24. public:
  25. inline EventArgsDateTime (DDateTime * Now)
  26. {
  27. m_pNow = Now;
  28. }
  29. public:
  30. const DDateTime * m_pNow;
  31. };
  32. //-----------------------------------------------------------------------------
  33. // A general DelegateArg of EventArgs_CDC
  34. //-----------------------------------------------------------------------------
  35. class EventArgs_CDC : public DelegateArgs
  36. {
  37. public:
  38. inline EventArgs_CDC (CDC * pDC)
  39. {
  40. m_pDC = pDC;
  41. }
  42. public:
  43. CDC * m_pDC;
  44. };
  45. //-----------------------------------------------------------------------------
  46. // A general DelegateArg of int
  47. //-----------------------------------------------------------------------------
  48. class EventArgs_Int : public DelegateArgs
  49. {
  50. public:
  51. inline EventArgs_Int (int i)
  52. {
  53. m_int = i;
  54. }
  55. public:
  56. int m_int;
  57. };
  58. class EventArgs_2Int : public DelegateArgs
  59. {
  60. public:
  61. inline EventArgs_2Int (int i1, int i2)
  62. {
  63. m_int1 = i1;
  64. m_int2 = i2;
  65. }
  66. public:
  67. int m_int1;
  68. int m_int2;
  69. };
  70. class EventArgs_3Int : public DelegateArgs
  71. {
  72. public:
  73. inline EventArgs_3Int (int i1, int i2, int i3)
  74. {
  75. m_int1 = i1;
  76. m_int2 = i2;
  77. m_int3 = i3;
  78. }
  79. public:
  80. int m_int1;
  81. int m_int2;
  82. int m_int3;
  83. };
  84. class EventArgs_Double : public DelegateArgs
  85. {
  86. public:
  87. inline EventArgs_Double (double d)
  88. {
  89. m_double = d;
  90. }
  91. public:
  92. double m_double;
  93. };
  94. class EventArgs_String : public DelegateArgs
  95. {
  96. public:
  97. inline EventArgs_String (DString s)
  98. {
  99. m_String = s;
  100. }
  101. public:
  102. DString m_String;
  103. };
  104. class EventArgs_4String : public DelegateArgs
  105. {
  106. public:
  107. DString m_String [4];
  108. };
  109. class EventArgs_8String : public DelegateArgs
  110. {
  111. public:
  112. EventArgs_8String ()
  113. {
  114. }
  115. EventArgs_8String (const EventArgs_8String & from)
  116. {
  117. from.CopyTo (*this);
  118. }
  119. public:
  120. DString m_String [8];
  121. public:
  122. EventArgs_8String & CopyTo (EventArgs_8String & to) const
  123. {
  124. for (int Index=0; Index<8; Index++)
  125. {
  126. to.m_String [Index] = m_String [Index];
  127. }
  128. }
  129. bool IsEqual (const EventArgs_8String & to) const
  130. {
  131. for (int Index=0; Index<8; Index++)
  132. {
  133. if (to.m_String [Index] != m_String [Index])
  134. return false;
  135. }
  136. return true;
  137. }
  138. EventArgs_8String & operator = (const EventArgs_8String & from)
  139. {
  140. from.CopyTo (*this);
  141. }
  142. };
  143. inline bool __stdcall operator == (const EventArgs_8String& s1, const EventArgs_8String& s2)
  144. {
  145. return s1.IsEqual (s2);
  146. }
  147. class EventArgsDICOMDataSet : public DelegateArgs
  148. {
  149. public:
  150. inline EventArgsDICOMDataSet (DICOMDataSet * dds)
  151. {
  152. m_DDS = dds;
  153. }
  154. public:
  155. DICOMDataSet * m_DDS;
  156. };
  157. /*
  158. class EventSourceWindowLevel
  159. {
  160. public:
  161. void FireWindowLevel (const void * sender, int width, int center)
  162. {
  163. EventArgs_2Int e (width, center);
  164. OnWindowLevel (sender, &e);
  165. }
  166. void FireFinalWindowLevel (const void * sender, int width, int center)
  167. {
  168. EventArgs_2Int e (width, center);
  169. OnFinalWindowLevel (sender, &e);
  170. }
  171. public:
  172. static Delegate OnWindowLevel;
  173. static Delegate OnFinalWindowLevel;
  174. };
  175. */
  176. //-----------------------------------------------------------------------------
  177. // A general DelegateArg of ImageShow
  178. //-----------------------------------------------------------------------------
  179. class EventArgsImageShow: public DelegateArgs
  180. {
  181. public:
  182. inline EventArgsImageShow (ImageShow * show)
  183. {
  184. m_pShow = show;
  185. m_pPrevShow = NULL;
  186. }
  187. inline EventArgsImageShow (ImageShow * show, ImageShow * old)
  188. {
  189. m_pShow = show;
  190. m_pPrevShow = old;
  191. }
  192. public:
  193. ImageShow * m_pShow;
  194. ImageShow * m_pPrevShow;
  195. };
  196. //-----------------------------------------------------------------------------
  197. // A general DelegateArg of ImageShow
  198. //-----------------------------------------------------------------------------
  199. class EventArgsSeriesShow: public DelegateArgs
  200. {
  201. public:
  202. inline EventArgsSeriesShow (ImageShow * show, long SeriesID, DString SeriesInstanceUID)
  203. {
  204. m_pShow = show;
  205. m_SeriesID = SeriesID;
  206. m_SeriesInstanceUID = SeriesInstanceUID;
  207. }
  208. public:
  209. ImageShow * m_pShow;
  210. unsigned long m_SeriesID;
  211. DString m_SeriesInstanceUID;
  212. };
  213. #endif