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.

250 lines
7.4 KiB

  1. /* COLumn CLaSs struct */
  2. typedef struct _colcls
  3. {
  4. INT tcls; /* class type */
  5. INT (FAR *lpfnColProc)();
  6. INT ccolDep; /* # of dependent columns */
  7. DX dxUp; /* up card offsets */
  8. DY dyUp;
  9. DX dxDn; /* down card offsets */
  10. DY dyDn;
  11. INT dcrdUp; /* up # of cards between ofsetting */
  12. INT dcrdDn; /* down # of cards between ofsetting */
  13. } COLCLS;
  14. /* MOVE struct, only set up while dragging */
  15. typedef struct _move
  16. {
  17. INT icrdSel; /* current card sel */
  18. INT ccrdSel; /* # of cards selected */
  19. DEL delHit; /* negative of offset from card where mouse hit */
  20. BOOL fHdc; /* TRUE if hdc's are allocated */
  21. DY dyCol; /* height of col (BUG: can only drag vert cols) */
  22. HDC hdcScreen;
  23. HDC hdcCol; /* the column */
  24. HBITMAP hbmColOld; /* original hbm in hdcCol */
  25. HDC hdcScreenSave; /* save buffer for screen */
  26. HBITMAP hbmScreenSaveOld; /* original hbm in hdcScreenSave */
  27. HDC hdcT;
  28. HBITMAP hbmT;
  29. INT izip;
  30. } MOVE;
  31. /* COL struct, this is what a column o' cards is */
  32. typedef struct _col
  33. {
  34. COLCLS *pcolcls; /* class of this instance */
  35. INT (FAR *lpfnColProc)(); /* duplicate of fn in colcls struct (for efficiency) */
  36. RC rc; /* bounding rectangle of this col */
  37. MOVE *pmove; /* move info, only valid while draggin */
  38. INT icrdMac;
  39. INT icrdMax;
  40. CRD rgcrd[1];
  41. } COL;
  42. /* SCOre */
  43. typedef INT SCO;
  44. // Constants - earlier they were generated in the col.msg file.
  45. #define icolNil -1
  46. #define msgcNil 0
  47. #define msgcInit 1
  48. #define msgcEnd 2
  49. #define msgcClearCol 3
  50. #define msgcNumCards 4
  51. #define msgcHit 5
  52. #define msgcSel 6
  53. #define msgcEndSel 7
  54. #define msgcFlip 8
  55. #define msgcInvert 9
  56. #define msgcMouseUp 10
  57. #define msgcDblClk 11
  58. #define msgcRemove 12
  59. #define msgcInsert 13
  60. #define msgcMove 14
  61. #define msgcCopy 15
  62. #define msgcValidMove 16
  63. #define msgcValidMovePt 17
  64. #define msgcRender 18
  65. #define msgcPaint 19
  66. #define msgcDrawOutline 20
  67. #define msgcComputeCrdPos 21
  68. #define msgcDragInvert 22
  69. #define msgcGetPtInCrd 23
  70. #define msgcValidKbdColSel 24
  71. #define msgcValidKbdCrdSel 25
  72. #define msgcShuffle 26
  73. #define msgcAnimate 27
  74. #define msgcZip 28
  75. #ifdef DEBUG
  76. INT SendColMsg(COL *pcol, INT msgc, WPARAM wp1, LPARAM wp2);
  77. #else
  78. #define SendColMsg(pcol, msgc, wp1, wp2) \
  79. (*((pcol)->lpfnColProc))((pcol), (msgc), (wp1), (wp2))
  80. #endif
  81. INT DefColProc(COL *pcol, INT msgc, WPARAM wp1, LPARAM wp2);
  82. VOID OOM( VOID );
  83. VOID DrawOutline( PT *, INT, DX, DY );
  84. /*---------------------------------------------------------------------------
  85. --------------------> Message explanations <---------------------
  86. // WARNING: probably totally out-o-date
  87. msgcNil:
  88. Nil Message, not used
  89. wp1: N/A
  90. wp2: N/A
  91. returns: TRUE
  92. msgcInit:
  93. Sent when a column in created. (currently not used)
  94. wp1: N/A
  95. wp2: N/A
  96. returns TRUE
  97. msgcEnd:
  98. Sent when a column is destroyed. Frees pcol
  99. wp1: N/A
  100. wp2: N/A
  101. returns TRUE
  102. msgcClearCol:
  103. Sent to clear a column of it's cards
  104. wp1: N/A
  105. wp2: N/A
  106. returns TRUE
  107. msgcHit:
  108. Checks if a card is hit by the mouse. pcol->delHit is set to the
  109. point where the mouse hit the card relative to the upper right
  110. corner of the card. Sets pcol->icrdSel and pcol->ccrdSel
  111. wp1: ppt
  112. wp2: N/A
  113. returns: icrd if hit, icrdNil if no hit. May return icrdEmpty if hit
  114. an empty column
  115. msgcSel:
  116. Selects cards in the column for future moves. Sets pcol->icrdSel and
  117. pcol->ccrdSel;
  118. wp1: icrdFirst, first card to select; icrdEnd selects last card
  119. wp2: ccrdSel, # of cards to select; ccrdToEnd selects to end of col
  120. returns: TRUE/FALSE
  121. msgcFlip:
  122. Flips cards to fUp
  123. wp1: fUp, TRUE if to flip cards up, FALSE to flip down
  124. wp2: N/A
  125. returns: TRUE/FALSE
  126. msgcInvert:
  127. Inverts order of cards selected in pcol
  128. Often used for dealing to discard.
  129. wp1: N/A
  130. wp2: N/A
  131. returns: TRUE/FALSE
  132. msgcRemove:
  133. Removes cards from pcol and places them in pcolTemp (wp1)
  134. pcolTemp must be larger than the number of cards selected
  135. wp1: pcolTemp, must be of class tcls == tclsTemp
  136. wp2: N/A
  137. returns: TRUE/FALSE
  138. msgcInsert:
  139. Inserts all cards from pcolSrc into pcol at icrdInsAfter (wp2)
  140. pcol must be large enough to accomodate the cards.
  141. wp1: pcolTemp, must be of class tcls == tclsTemp
  142. wp2: icrdInsAfter, card to insert after. icrdToEnd if append to end of col
  143. returns: TRUE/FALSE
  144. msgcMove:
  145. Combines msgcRemove, msgcInsert, and rendering.
  146. Moves cards from pcolSrc into pcolDest at icrdInsAfter. Computes new
  147. card positions and sends render messages to both columns
  148. wp1: pcolSrc
  149. wp2: icrdInsAfter, card to insert after. may be '|'ed with flags:
  150. icrdInvert : Inverts order of cards
  151. returns: TRUE/FALSE
  152. msgcCopy:
  153. Copies pcolSrc into pcol. pcol must be large enough
  154. wp1: pcolSrc
  155. wp2: fAll, If true then entire structure is copied, else just the cards
  156. returns: TRUE/FALSE
  157. msgcValidMove: ***** MUST BE SUPPLIED BY GAME, NO DEFAULT ACTION ******
  158. Determines if a move is valid.
  159. wp1: pcolSrc
  160. wp2: N/A
  161. returns: TRUE/FALSE
  162. msgcValidMovePt:
  163. Determines if a card being dragged over a column is a valid move.
  164. Sends msgcValidMove if card overlaps
  165. wp1: pcolSrc
  166. wp2: pptMouse
  167. returns: icrdHit/icrdNil
  168. msgcRender
  169. Renders the column starting at icrdFirst
  170. wp1: icrdFirst
  171. wp2: N/A
  172. return: TRUE/FALSE
  173. msgcPaint:
  174. Renders column if it intersects the paint update rect
  175. wp1: ppaint, if NULL then renders entire column
  176. wp2: N/A
  177. returns: TRUE/FALSE
  178. msgcDrawOutline:
  179. Draws outline of cards when being dragged by mouse
  180. wp1: pptMouse
  181. wp2: N/A
  182. returns: TRUE/FALSE
  183. msgcComputeCrdPos:
  184. Computes position of cards based on colcls.{dxcrdUp|dxcrdDn|dycrdUp|dycrdDn}
  185. wp1: icrdFirst, first card to compute
  186. wp2: N/A
  187. returns: TRUE
  188. msgcDragInvert:
  189. Inverts the topmost card in the pile
  190. wp1: N/A
  191. wp2: N/A
  192. returns: TRUE/FALSE
  193. -----------------------------------------------------------------------------*/
  194. #define icrdNil 0x1fff
  195. #define icrdEmpty 0x1ffe
  196. #define icrdToEnd 0x1ffd
  197. #define ccrdToEnd -2
  198. #define icrdEnd 0x1ffc
  199. /* special flags |'d with icrd for msgcMove */
  200. #define bitFZip 0x2000
  201. #define icrdMask 0x1fff