home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 19.ddi / OWLINC.PAK / DISPATCH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  9.2 KB  |  335 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1992, 1993 by Borland International
  3. //   include\owl\dispatch.h
  4. //   Dispatch functions to crack a Windows message and pass control to a
  5. //   pointer to member function.
  6. //----------------------------------------------------------------------------
  7. #if !defined(__OWL_DISPATCH_H)
  8. #define __OWL_DISPATCH_H
  9.  
  10. #if !defined(__OWL_POINT_H)
  11.   #include <owl\point.h>
  12. #endif
  13.  
  14. //
  15. //  class GENERIC
  16. //  ----- -------
  17. //  generic class for casting pointer to objects and pointer to member functions
  18. //
  19. class _OWLFASTTHIS GENERIC;   // conditionally define to correct calling model
  20.  
  21. //
  22. //  typedef TAnyPMF
  23. //  ------- -------
  24. //  generic pointer to member function
  25. //
  26. typedef void (GENERIC::*TAnyPMF)();
  27.  
  28. //
  29. //  typedef TAnyDispatcher
  30. //  ------- --------------
  31. //  all message dispatcher functions take four parameters:
  32. //  - reference to an object
  33. //  - pointer to member function (signature varies according to the cracking
  34. //    that the function performs)
  35. //  - WPARAM
  36. //  - LPARAM
  37. //
  38. typedef LRESULT _OWLFUNC (*TAnyDispatcher)(GENERIC&, TAnyPMF, WPARAM, LPARAM);
  39.  
  40. //
  41. //  LEGEND: in order to keep signature names from getting too long, the
  42. //          following abbreviations are used:
  43. //
  44. //  - v (void return)
  45. //  - i (int)
  46. //  - U (UINT)
  47. //  - B (BOOL)
  48. //  - H (HANDLE)
  49. //  - W (HWND)
  50. //  - S (LPSTR)
  51. //
  52.  
  53. //
  54. //  LRESULT_WPARAM_LPARAM_Dispatch
  55. //  ------------------------------
  56. //  does no message cracking (passes wParam and lParam) and returns result
  57. //  of pointer to member function
  58. //
  59. LRESULT _OWLFUNC
  60. LRESULT_WPARAM_LPARAM_Dispatch(GENERIC& generic,
  61.                                LRESULT (GENERIC::*pmf)(WPARAM, LPARAM),
  62.                                WPARAM   wParam,
  63.                                LPARAM   lParam);
  64.  
  65. //
  66. //  v_Dispatch
  67. //  ------------
  68. //  passes no arguments and always returns 0
  69. //
  70. LRESULT _OWLFUNC
  71. v_Dispatch(GENERIC& generic,
  72.            void    (GENERIC::*pmf)(),
  73.            WPARAM   wParam,
  74.            LPARAM   lParam);
  75.  
  76. //
  77. //  v_WPARAM_LPARAM_Dispatch
  78. //  ------------------------
  79. //  does no message cracking (passes wParam and lParam) and always returns 0
  80. //
  81. LRESULT _OWLFUNC
  82. v_WPARAM_LPARAM_Dispatch(GENERIC& generic,
  83.                          void    (GENERIC::*pmf)(WPARAM, LPARAM),
  84.                          WPARAM   wParam,
  85.                          LPARAM   lParam);
  86.  
  87. //
  88. //  v_U_U_Dispatch
  89. //  --------------
  90. //  passes two UINTs and always returns 0
  91. //
  92. //  first UINT is wParam and second one is lParam for 32-bit int and
  93. //  LOWORD(lParam) for 16-bit int
  94. //
  95. LRESULT _OWLFUNC
  96. v_U_U_Dispatch(GENERIC& generic,
  97.                void    (GENERIC::*pmf)(UINT, UINT),
  98.                WPARAM   wParam,
  99.                LPARAM   lParam);
  100.  
  101. //
  102. //  v_U_U_U_Dispatch
  103. //  ----------------
  104. //  passes three UINTs and always returns 0
  105. //
  106. //  first UINT is wParam, second UINT is LOWORD(lParam), and third UINT
  107. //  is HIWORD(lParam)
  108. //
  109. LRESULT _OWLFUNC
  110. v_U_U_U_Dispatch(GENERIC& generic,
  111.                  void    (GENERIC::*pmf)(UINT, UINT, UINT),
  112.                  WPARAM   wParam,
  113.                  LPARAM   lParam);
  114.  
  115. //
  116. //  U_U_U_U_Dispatch
  117. //  ----------------
  118. //  passes three UINTs and returns result of pointer to member function
  119. //
  120. //  first UINT is wParam, second UINT is LOWORD(lParam), and third UINT
  121. //  is HIWORD(lParam)
  122. //
  123. LRESULT _OWLFUNC
  124. U_U_U_U_Dispatch(GENERIC& generic,
  125.                  UINT    (GENERIC::*pmf)(UINT, UINT, UINT),
  126.                  WPARAM   wParam,
  127.                  LPARAM   lParam);
  128.  
  129. //
  130. //  v_LPARAM_Dispatch
  131. //  -----------------
  132. //  passes LPARAM as the only parameter and always returns 0
  133. //
  134. LRESULT _OWLFUNC
  135. v_LPARAM_Dispatch(GENERIC& generic,
  136.                   void    (GENERIC::*pmf)(LPARAM),
  137.                   WPARAM   wParam,
  138.                   LPARAM   lParam);
  139.  
  140. //
  141. //  i_LPARAM_Dispatch
  142. //  -----------------
  143. //  passes LPARAM as the only parameter and returns result of pointer to
  144. //  member function
  145. //
  146. LRESULT _OWLFUNC
  147. i_LPARAM_Dispatch(GENERIC& generic,
  148.                   int     (GENERIC::*pmf)(LPARAM),
  149.                   WPARAM   wParam,
  150.                   LPARAM   lParam);
  151.  
  152. //
  153. //  v_WPARAM_Dispatch
  154. //  -----------------
  155. //  passes WPARAM as the only parameter and always returns 0
  156. //
  157. LRESULT _OWLFUNC
  158. v_WPARAM_Dispatch(GENERIC& generic,
  159.                   void    (GENERIC::*pmf)(WPARAM),
  160.                   WPARAM   wParam,
  161.                   LPARAM   lParam);
  162.  
  163. //
  164. //  i_WPARAM_Dispatch
  165. //  -----------------
  166. //  passes WPARAM as the only parameter and returns result of pointer to
  167. //  member function
  168. //
  169. LRESULT _OWLFUNC
  170. i_WPARAM_Dispatch(GENERIC& generic,
  171.                   BOOL    (GENERIC::*pmf)(WPARAM),
  172.                   WPARAM   wParam,
  173.                   LPARAM   lParam);
  174.  
  175. //
  176. //  v_U_U_W_Dispatch
  177. //  ----------------
  178. //  passes two UINTs and an HWND and always returns 0
  179. //
  180. LRESULT _OWLFUNC
  181. v_U_U_W_Dispatch(GENERIC& generic,
  182.                  void    (GENERIC::*pmf)(UINT, UINT, HWND),
  183.                  WPARAM   wParam,
  184.                  LPARAM   lParam);
  185.  
  186. //
  187. //  LRESULT_U_U_W_Dispatch
  188. //  ----------------
  189. //  passes two UINTs and an HWND and returns the result of pointer to member
  190. //  function
  191. //
  192. LRESULT _OWLFUNC
  193. LRESULT_U_U_W_Dispatch(GENERIC& generic,
  194.                        LRESULT (GENERIC::*pmf)(UINT, UINT, HWND),
  195.                        WPARAM   wParam,
  196.                        LPARAM   lParam);
  197.  
  198. //
  199. //  v_U_POINT_Dispatch
  200. //  ------------------
  201. //  passes a UINT and a reference to a POINT and always returns 0
  202. //
  203. LRESULT _OWLFUNC
  204. v_U_POINT_Dispatch(GENERIC& generic,
  205.                    void    (GENERIC::*pmf)(UINT, TPoint&),
  206.                    WPARAM   wParam,
  207.                    LPARAM   lParam);
  208.  
  209. //
  210. //  v_POINT_Dispatch
  211. //  ----------------
  212. //  passes a reference to a POINT and always returns 0
  213. //
  214. LRESULT _OWLFUNC
  215. v_POINT_Dispatch(GENERIC& generic,
  216.                  void    (GENERIC::*pmf)(TPoint&),
  217.                  WPARAM   wParam,
  218.                  LPARAM   lParam);
  219.  
  220. //
  221. //  U_LPARAM_Dispatch
  222. //  ------------------------
  223. //  passes lParam and returns the result of pointer to member
  224. //  function
  225. //
  226. LRESULT _OWLFUNC
  227. U_LPARAM_Dispatch(GENERIC& generic,
  228.                   UINT    (GENERIC::*pmf)(LPARAM),
  229.                   WPARAM   wParam,
  230.                   LPARAM   lParam);
  231.  
  232. //
  233. //  U_WPARAM_LPARAM_Dispatch
  234. //  ------------------------
  235. //  passes wParam and lParam and returns the result of pointer to member
  236. //  function
  237. //
  238. LRESULT _OWLFUNC
  239. U_WPARAM_LPARAM_Dispatch(GENERIC& generic,
  240.                          UINT    (GENERIC::*pmf)(WPARAM, LPARAM),
  241.                          WPARAM   wParam,
  242.                          LPARAM   lParam);
  243.  
  244. //
  245. //  U_POINT_Dispatch
  246. //  ----------------
  247. //  passes a reference to POINT and returns the result of pointer to member
  248. //  function
  249. //
  250. LRESULT _OWLFUNC
  251. U_POINT_Dispatch(GENERIC& generic,
  252.                  UINT    (GENERIC::*pmf)(TPoint&),
  253.                  WPARAM   wParam,
  254.                  LPARAM   lParam);
  255.  
  256. //
  257. //  U_Dispatch
  258. //  ------------
  259. //  passes no arguments and returns the result of pointer to member function
  260. //
  261. LRESULT _OWLFUNC
  262. U_Dispatch(GENERIC& generic,
  263.            UINT    (GENERIC::*pmf)(),
  264.            WPARAM   wParam,
  265.            LPARAM   lParam);
  266.  
  267. //
  268. //  i_U_W_U_Dispatch
  269. //  ----------------
  270. //  passes a UINT, HWND, and UINT and returns the result of pointer to member
  271. //  function
  272. //
  273. LRESULT _OWLFUNC
  274. i_U_W_U_Dispatch(GENERIC& generic,
  275.                  int     (GENERIC::*pmf)(UINT, HWND, UINT),
  276.                  WPARAM   wParam,
  277.                  LPARAM   lParam);
  278.  
  279. //
  280. //  v_W_W_Dispatch - EvMDIActivate-specific
  281. //  --------------
  282. //  passes two HWNDs and always returns 0
  283. //
  284. LRESULT _OWLFUNC
  285. v_W_W_Dispatch(GENERIC& generic,
  286.                void    (GENERIC::*pmf)(HWND, HWND),
  287.                WPARAM   wParam,
  288.                LPARAM   lParam);
  289.  
  290. //
  291. //  v_U_B_W_Dispatch
  292. //  ----------------
  293. //  passes a UINT, a BOOL, and an HWND and always returns 0
  294. //
  295. LRESULT _OWLFUNC
  296. v_U_B_W_Dispatch(GENERIC& generic,
  297.                  void    (GENERIC::*pmf)(UINT, BOOL, HWND),
  298.                  WPARAM   wParam,
  299.                  LPARAM   lParam);
  300.  
  301. //
  302. //  HBRUSH_HDC_W_U_Dispatch
  303. //  -----------------------
  304. //  passes an HDC, an HWND, and a UINT and returns a HBRUSH
  305. //
  306. LRESULT _OWLFUNC
  307. HBRUSH_HDC_W_U_Dispatch(GENERIC& generic,
  308.                         HBRUSH  (GENERIC::*pmf)(HDC, HWND, UINT),
  309.                         WPARAM   wParam,
  310.                         LPARAM   lParam);
  311.  
  312. //
  313. //  v_POINTER_Dispatch
  314. //  ------------------
  315. //  passes a LPARAM as a void* pointer and always returns 0
  316. //
  317. LRESULT _OWLFUNC
  318. v_POINTER_Dispatch(GENERIC& generic,
  319.                    void    (GENERIC::*pmf)(void*),
  320.                    WPARAM   wParam,
  321.                    LPARAM   lParam);
  322.  
  323. //
  324. //  v_ParentNotify_Dispatch
  325. //  -----------------------
  326. //  message-specific cracking for WM_PARENTNOTIFY
  327. //
  328. LRESULT _OWLFUNC
  329. v_ParentNotify_Dispatch(GENERIC& generic,
  330.                  int     (GENERIC::*pmf)(UINT, UINT, UINT),
  331.                  WPARAM   wParam,
  332.                  LPARAM   lParam);
  333.  
  334. #endif  // __OWL_DISPATCH_H
  335.