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.

315 lines
5.1 KiB

  1. //============================================================================
  2. // Copyright (c) 1995, Microsoft Corporation
  3. //
  4. // File: tldef.h
  5. //
  6. // History:
  7. // Abolade Gbadegesin Nov-20-1995 Created.
  8. //
  9. // Private implementation declarations for TreeList control.
  10. //============================================================================
  11. #ifndef _TLDEF_H_
  12. #define _TLDEF_H_
  13. typedef struct _TLITEM {
  14. struct _TLITEM *pParent;
  15. LIST_ENTRY leSiblings;
  16. LIST_ENTRY lhChildren;
  17. LIST_ENTRY lhSubitems;
  18. INT iLevel;
  19. INT iIndex;
  20. UINT nChildren;
  21. LV_ITEM lvi;
  22. PTSTR pszText;
  23. LPARAM lParam;
  24. INT iImage;
  25. UINT uiFlag;
  26. } TLITEM;
  27. typedef struct _TLSUBITEM {
  28. LIST_ENTRY leItems;
  29. DWORD dwFlags;
  30. INT iSubItem;
  31. PTSTR pszText;
  32. } TLSUBITEM;
  33. typedef struct _TL {
  34. HWND hwnd;
  35. UINT iCtrlId;
  36. HWND hwndList;
  37. HWND hwndParent;
  38. TLITEM root;
  39. UINT nColumns;
  40. UINT cyItem;
  41. UINT cyText;
  42. UINT cxIndent;
  43. HDC hdcImages;
  44. HBITMAP hbmp;
  45. HBITMAP hbmpMem;
  46. UINT cxBmp;
  47. UINT cyBmp;
  48. HBITMAP hbmpStart;
  49. HBRUSH hbrBk;
  50. } TL;
  51. #define TLI_EXPANDED 0x0001
  52. #define TL_ICONCOUNT (IID_TL_IconLast - IID_TL_IconBase + 1)
  53. #define TL_ICONID(index) ((index) + IID_TL_IconBase)
  54. #define TL_ICONINDEX(id) ((id) - IID_TL_IconBase)
  55. #define TL_GetPtr(hwnd) (TL *)GetWindowLongPtr((hwnd), 0)
  56. #define TL_SetPtr(hwnd,ptr) (TL *)SetWindowLongPtr((hwnd), 0, (ULONG_PTR)(ptr))
  57. #define TL_StateImageValue(p) (((p)->lvi.state >> 12) & 0xf)
  58. #define TL_StateImageIndex(p) (TL_StateImageValue(p) - 1)
  59. #define TL_IsExpanded(p) ((p)->uiFlag & TLI_EXPANDED)
  60. #define TL_IsVisible(p) ((p)->iIndex != -1)
  61. #define TL_VerticalLine 0
  62. #define TL_RootChildless 1
  63. #define TL_RootParentCollapsed 2
  64. #define TL_RootParentExpanded 3
  65. #define TL_MidChildless 4
  66. #define TL_MidParentCollapsed 5
  67. #define TL_MidParentExpanded 6
  68. #define TL_EndChildless 7
  69. #define TL_EndParentCollapsed 8
  70. #define TL_EndParentExpanded 9
  71. #define TL_ImageCount 10
  72. LRESULT
  73. CALLBACK
  74. TL_WndProc(
  75. HWND hwnd,
  76. UINT uiMsg,
  77. WPARAM wParam,
  78. LPARAM lParam
  79. );
  80. BOOL
  81. TL_OnCreate(
  82. TL *ptl,
  83. CREATESTRUCT *pcs
  84. );
  85. VOID
  86. TL_OnDestroy(
  87. TL *ptl
  88. );
  89. BOOL
  90. TL_NotifyParent(
  91. TL *ptl,
  92. NMHDR *pnmh
  93. );
  94. LRESULT
  95. TL_OnNotify(
  96. TL *ptl,
  97. INT iCtrlId,
  98. NMHDR *pnmh
  99. );
  100. HTLITEM
  101. TL_OnInsertItem(
  102. TL *ptl,
  103. TL_INSERTSTRUCT *ptlis
  104. );
  105. BOOL
  106. TL_OnDeleteItem(
  107. TL *ptl,
  108. HTLITEM hitem
  109. );
  110. BOOL
  111. TL_OnDeleteAllItems(
  112. TL *ptl
  113. );
  114. VOID
  115. TL_DeleteAndNotify(
  116. TL *ptl,
  117. TLITEM *pItem
  118. );
  119. BOOL
  120. TL_OnGetItem(
  121. TL *ptl,
  122. LV_ITEM *plvi
  123. );
  124. BOOL
  125. TL_OnSetItem(
  126. TL *ptl,
  127. LV_ITEM *plvi
  128. );
  129. UINT
  130. TL_OnGetItemCount(
  131. TL *ptl
  132. );
  133. HTLITEM
  134. TL_OnGetNextItem(
  135. TL *ptl,
  136. UINT uiFlag,
  137. HTLITEM hItem
  138. );
  139. #define TL_Enumerate(ptl,pitem) \
  140. TL_OnGetNextItem((ptl), TLGN_ENUMERATE, (HTLITEM)(pitem))
  141. BOOL
  142. TL_OnExpand(
  143. TL *ptl,
  144. UINT uiFlag,
  145. HTLITEM hItem
  146. );
  147. BOOL
  148. TL_ItemExpand(
  149. TL *ptl,
  150. TLITEM *pItem
  151. );
  152. BOOL
  153. TL_ItemCollapse(
  154. TL *ptl,
  155. TLITEM *pItem
  156. );
  157. INT
  158. TL_OnInsertColumn(
  159. TL *ptl,
  160. INT iCol,
  161. LV_COLUMN *pCol
  162. );
  163. BOOL
  164. TL_OnDeleteColumn(
  165. TL *ptl,
  166. INT iCol
  167. );
  168. BOOL
  169. TL_OnSetSelection(
  170. TL *ptl,
  171. HTLITEM hItem
  172. );
  173. VOID
  174. TL_OnWindowPosChanged(
  175. TL *ptl,
  176. WINDOWPOS *pwp
  177. );
  178. VOID
  179. TL_OnEraseBackground(
  180. TL *ptl,
  181. HDC hdc
  182. );
  183. BOOL
  184. TL_OnDrawItem(
  185. TL *ptl,
  186. CONST DRAWITEMSTRUCT *pdis
  187. );
  188. BOOL
  189. TL_DrawItem(
  190. TL *ptl,
  191. CONST DRAWITEMSTRUCT *pdis
  192. );
  193. VOID
  194. TL_OnMeasureItem(
  195. TL *ptl,
  196. MEASUREITEMSTRUCT *pmis
  197. );
  198. HBITMAP
  199. TL_CreateColorBitmap(
  200. INT cx,
  201. INT cy
  202. );
  203. VOID
  204. TL_CreateTreeImages(
  205. TL *ptl
  206. );
  207. VOID
  208. TL_DottedLine(
  209. HDC hdc,
  210. INT x,
  211. INT y,
  212. INT dim,
  213. BOOL fVertical
  214. );
  215. VOID
  216. TL_DrawButton(
  217. HDC hdc,
  218. INT x,
  219. INT y,
  220. INT dim,
  221. HBRUSH hbrSign,
  222. HBRUSH hbrBox,
  223. HBRUSH hbrBk,
  224. BOOL bCollapsed
  225. );
  226. VOID
  227. TL_UpdateListIndices(
  228. TL *ptl,
  229. TLITEM *pStart
  230. );
  231. VOID
  232. TL_UpdateDescendantIndices(
  233. TL *ptl,
  234. TLITEM *pStart,
  235. INT *piIndex
  236. );
  237. VOID
  238. TL_UpdateAncestorIndices(
  239. TL *ptl,
  240. TLITEM *pStart,
  241. INT *piIndex
  242. );
  243. VOID
  244. TL_UpdateImage(
  245. TL *ptl,
  246. TLITEM *pItem,
  247. TLITEM **ppChanged
  248. );
  249. VOID
  250. TL_CountItems(
  251. TLITEM *pParent,
  252. INT *piCount
  253. );
  254. BOOL
  255. TL_OnRedraw(
  256. TL *ptl
  257. );
  258. #endif