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.

2517 lines
92 KiB

  1. /*****************************************************************************\
  2. * *
  3. * commctrl.h - - Interface for the Windows Common Controls *
  4. * *
  5. * Version 1.0 *
  6. * *
  7. * Copyright (c) 1991-1994, Microsoft Corp. All rights reserved. *
  8. * *
  9. \*****************************************************************************/
  10. /*REVIEW: this stuff needs Windows style in many places; find all REVIEWs. */
  11. #ifndef _INC_COMMCTRL
  12. #define _INC_COMMCTRL
  13. #ifdef WIN32
  14. #define _huge
  15. #endif
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /* Users of this header may define any number of these constants to avoid
  20. * the definitions of each functional group.
  21. * NOTOOLBAR Customizable bitmap-button toolbar control.
  22. * NOUPDOWN Up and Down arrow increment/decrement control.
  23. * NOSTATUSBAR Status bar and header bar controls.
  24. * NOMENUHELP APIs to help manage menus, especially with a status bar.
  25. * NOTRACKBAR Customizable column-width tracking control.
  26. * NODRAGLIST APIs to make a listbox source and sink drag&drop actions.
  27. * NOPROGRESS Progress gas gauge.
  28. * NOHOTKEY HotKey control
  29. */
  30. /*/////////////////////////////////////////////////////////////////////////*/
  31. /* InitCommonControls:
  32. * Any application requiring the use of any common control should call this
  33. * API upon application startup. There is no required shutdown.
  34. */
  35. void WINAPI InitCommonControls();
  36. // Define Ownerdraw type for Header controls BUGBUG: should be in windows.h?
  37. #define ODT_HEADER 100
  38. #define ODT_TAB 101
  39. #define ODT_LISTVIEW 102
  40. //====== Ranges for control message IDs
  41. // (making each control's messages unique makes validation and
  42. // debugging easier).
  43. //
  44. #define LVM_FIRST 0x1000 // ListView messages
  45. #define TV_FIRST 0x1100 // TreeView messages
  46. #define HDM_FIRST 0x1200 // Header messages
  47. //REVIEW: We need to add an "int cbHdr" field to NMHDR!
  48. LRESULT WINAPI SendNotify(HWND hwndTo, HWND hwndFrom, int code, NMHDR FAR* pnmhdr);
  49. /* LRESULT Cls_OnNotify(HWND hwnd, int idFrom, NMHDR FAR* pnmhdr); */
  50. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
  51. (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  52. #define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) \
  53. (void)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(id), (LPARAM)(NMHDR FAR*)(pnmhdr))
  54. // Generic WM_NOTIFY notification codes
  55. #define NM_OUTOFMEMORY (NM_FIRST-1)
  56. #define NM_CLICK (NM_FIRST-2)
  57. #define NM_DBLCLK (NM_FIRST-3)
  58. #define NM_RETURN (NM_FIRST-4)
  59. #define NM_RCLICK (NM_FIRST-5)
  60. #define NM_RDBLCLK (NM_FIRST-6)
  61. #define NM_SETFOCUS (NM_FIRST-7)
  62. #define NM_KILLFOCUS (NM_FIRST-8)
  63. #define NM_STARTWAIT (NM_FIRST-9)
  64. #define NM_ENDWAIT (NM_FIRST-10)
  65. #define NM_BTNCLK (NM_FIRST-10)
  66. // WM_NOTIFY codes (NMHDR.code values)
  67. // these are not required to be in seperate ranges but that makes
  68. // validation and debugging easier
  69. #define NM_FIRST (0U- 0U) // generic to all controls
  70. #define NM_LAST (0U- 99U)
  71. #define LVN_FIRST (0U-100U) // listview
  72. #define LVN_LAST (0U-199U)
  73. #define HDN_FIRST (0U-300U) // header
  74. #define HDN_LAST (0U-399U)
  75. #define TVN_FIRST (0U-400U) // treeview
  76. #define TVN_LAST (0U-499U)
  77. #define TTN_FIRST (0U-520U) // tooltips
  78. #define TTN_LAST (0U-549U)
  79. #define TCN_FIRST (0U-550U) // tab control
  80. #define TCN_LAST (0U-600U)
  81. #define CDN_FIRST (0U-601U) // common dialog (new)
  82. #define CDN_LAST (0U-699U)
  83. #define TBN_FIRST (0U-700U) // toolbar
  84. #define TBN_LAST (0U-720U)
  85. //====== IMAGE APIS ==================================================
  86. #define CLR_NONE 0xFFFFFFFFL
  87. #define CLR_DEFAULT 0xFF000000L
  88. #define CLR_HILIGHT 0xFF000001L
  89. struct _IMAGELIST;
  90. typedef struct _IMAGELIST NEAR* HIMAGELIST;
  91. // fMask is TRUE to create a masked (two-bitmap) image list.
  92. // cInitial is initial size of bitmap, cGrow is size to increase by.
  93. HIMAGELIST WINAPI ImageList_Create(int cx, int cy, BOOL fMask, int cInitial, int cGrow);
  94. BOOL WINAPI ImageList_Destroy(HIMAGELIST himl);
  95. // loads one resource, figures out cy and cInitial from bmp,
  96. // and makes mask from a specified color (unless CLR_NONE given)
  97. HIMAGELIST WINAPI ImageList_LoadImage(HINSTANCE hi, LPCSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
  98. #define ImageList_LoadBitmap(hi, lpbmp, cx, cGrow, crMask) \
  99. ImageList_LoadImage(hi, lpbmp, cx, cGrow, crMask, IMAGE_BITMAP, 0)
  100. // Number of images in list.
  101. int WINAPI ImageList_GetImageCount(HIMAGELIST himl);
  102. // Add, Remove, replace images. Add returns index of Added item, or -1 if error.
  103. int WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
  104. int WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hbmImage, COLORREF crMask);
  105. BOOL WINAPI ImageList_Remove(HIMAGELIST himl, int i);
  106. BOOL WINAPI ImageList_Replace(HIMAGELIST himl, int i, HBITMAP hbmImage, HBITMAP hbmMask);
  107. // Add or replace given an icon handle. hicon is not saved; can be destroyed
  108. // after call. Add returns index of added item, else -1.
  109. int WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hicon);
  110. int WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, int i, HICON hicon);
  111. HICON WINAPI ImageList_ExtractIcon(HINSTANCE hAppInst, HIMAGELIST himl, int i);
  112. int WINAPI ImageList_AddFromImageList(HIMAGELIST himlDest, HIMAGELIST himlSrc, int iSrc);
  113. #define ILD_NORMAL 0x0000 // use current bkcolor
  114. #define ILD_TRANSPARENT 0x0001 // force transparent icon style (override bk color)
  115. #define ILD_MASK 0x0010 // draw the mask
  116. #define ILD_BLEND 0x000E // blend
  117. #define ILD_BLEND25 0x0002 // blend 25%
  118. #define ILD_BLEND50 0x0004 // blend 50%
  119. #define ILD_BLEND75 0x0008 // blend 75%
  120. #define ILD_OVERLAYMASK 0x0F00 // use these as indexes into special items
  121. #define INDEXTOOVERLAYMASK(i) ((i) << 8) //
  122. #define ILD_SELECTED ILD_BLEND50 // draw as selected
  123. #define ILD_FOCUS ILD_BLEND25 // draw as focused (selection)
  124. // Draw item i into hdcDst at x, y. Flags define the drawing style.
  125. BOOL WINAPI ImageList_Draw(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, UINT fStyle);
  126. // Draw item i into hdcDst at x, y. Flags define the drawing style.
  127. BOOL WINAPI ImageList_Draw2(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, COLORREF rgb, UINT fStyle);
  128. // Get bounding rectangle of image in image bitmaps.
  129. BOOL WINAPI ImageList_GetImageRect(HIMAGELIST himl, int i, RECT FAR* prcImage);
  130. // Set & get background color for speedy drawing. Set to CLR_NONE for true
  131. // cursor-style AND/XOR transparency.
  132. COLORREF WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk);
  133. COLORREF WINAPI ImageList_GetBkColor(HIMAGELIST himl);
  134. // Set the image iImage as one of the special images for us in combine
  135. // drawing. to draw with these specify the index of this
  136. BOOL WINAPI ImageList_SetOverlayImage(HIMAGELIST himl, int iImage, int iOverlay);
  137. #ifdef WIN32
  138. #ifdef _OBJBASE_H_
  139. // Read and write an imagelist from/to an IStream.
  140. HIMAGELIST WINAPI ImageList_Read(LPSTREAM pstm);
  141. BOOL WINAPI ImageList_Write(HIMAGELIST himl, LPSTREAM pstm);
  142. #endif
  143. #endif
  144. typedef struct _IMAGEINFO
  145. {
  146. HBITMAP hbmImage;
  147. HBITMAP hbmMask;
  148. int cPlanes;
  149. int cBitsPerPixel;
  150. RECT rcImage;
  151. } IMAGEINFO;
  152. // Get information about an image for direct manipulation. rcImage is
  153. // part of hbmImage and hbmMask that make up the image. hbmMask is
  154. // NULL if not a masked imagelist.
  155. BOOL WINAPI ImageList_GetImageInfo(HIMAGELIST himl, int i, IMAGEINFO FAR* pImageInfo);
  156. // Start tracking an image i, starting at x, y, offset by dx/dyHotspot.
  157. BOOL WINAPI ImageList_StartDrag(HIMAGELIST himl, HWND hwndLock, int i, int x, int y, int dxHotspot, int dyHotspot);
  158. // End a dragging operation.
  159. void WINAPI ImageList_EndDrag();
  160. // Called on mouse move to move dragging image.
  161. BOOL WINAPI ImageList_DragMove(int x, int y);
  162. // Create new IMAGELIST that is the merge of two existing images.
  163. HIMAGELIST WINAPI ImageList_Merge(HIMAGELIST himl1, int i1, HIMAGELIST himl2, int i2, int dx, int dy);
  164. //================ HEADER APIS =============================================
  165. //
  166. // Class name: SysHeader (WC_HEADER)
  167. //
  168. // The SysHeader control provides for column and row headers much like those
  169. // found in MSMail and Excel. Header items appear as text on a gray
  170. // background. Items can behave as pushbuttons, in which case they have a
  171. // raised face.
  172. //
  173. // SysHeaders support changing width or height of items using the mouse.
  174. // These controls do not support a keyboard interface, so they do not accept
  175. // the input focus.
  176. //
  177. // There are notifications that allow applications to determine when an item
  178. // has been clicked or double clicked, width change has occured, drag tracking
  179. // is occuring, etc.
  180. //
  181. //////////////////////////////////////////////////////////////////////////////
  182. #ifdef WIN32
  183. #define WC_HEADER "SysHeader32"
  184. #else
  185. #define WC_HEADER "SysHeader"
  186. #endif
  187. // Header control styles
  188. #define HDS_HORZ 0x00000000 // Horizontal header
  189. #define HDS_BUTTONS 0x00000002 // Items act as buttons
  190. #define HDS_HIDDEN 0x00000008 // no header in details mode
  191. // The HD_ITEM structure describes a header item.
  192. // The first field contains a combination of HDI_* flags
  193. // indicating which fields contain valid data.
  194. //
  195. typedef struct _HD_ITEM
  196. {
  197. UINT mask;
  198. int cxy; // width (HDS_HORZ) or height (HDS_VERT)
  199. LPSTR pszText;
  200. HBITMAP hbm; // Bitmap to use (implies HDF_BITMAP)
  201. int cchTextMax; // Valid only for GetItem: contains size of buffer
  202. int fmt; // HDF_* value
  203. LPARAM lParam;
  204. } HD_ITEM;
  205. // HD_ITEM mask flags
  206. #define HDI_WIDTH 0x0001
  207. #define HDI_HEIGHT HDI_WIDTH
  208. #define HDI_TEXT 0x0002
  209. #define HDI_FORMAT 0x0004
  210. #define HDI_LPARAM 0x0008
  211. #define HDI_BITMAP 0x0010
  212. // HD_ITEM fmt field values
  213. // First justification values
  214. #define HDF_LEFT 0
  215. #define HDF_RIGHT 1
  216. #define HDF_CENTER 2
  217. #define HDF_JUSTIFYMASK 0x0003
  218. // Now other formating options
  219. #define HDF_OWNERDRAW 0x8000
  220. #define HDF_STRING 0x4000
  221. #define HDF_BITMAP 0x2000
  222. // Returns number of items in header.
  223. //
  224. // int Header_GetItemCount(HWND hwndHD);
  225. //
  226. #define HDM_GETITEMCOUNT (HDM_FIRST + 0)
  227. #define Header_GetItemCount(hwndHD) \
  228. (int)SendMessage((hwndHD), HDM_GETITEMCOUNT, 0, 0L)
  229. // Insert header item at specified index. Item is inserted at end if
  230. // i is greater than or equal to the number of items in the header.
  231. // Returns the index of the inserted item.
  232. //
  233. // int Header_InsertItem(HWND hwndHD, int i, const HD_ITEM FAR* pitem);
  234. //
  235. #define HDM_INSERTITEM (HDM_FIRST + 1)
  236. #define Header_InsertItem(hwndHD, i, phdi) \
  237. (int)SendMessage((hwndHD), HDM_INSERTITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  238. // Delete a header item at the specified index.
  239. //
  240. // BOOL Header_DeleteItem(HWND hwndHD, int i);
  241. //
  242. #define HDM_DELETEITEM (HDM_FIRST + 2)
  243. #define Header_DeleteItem(hwndHD, i) \
  244. (BOOL)SendMessage((hwndHD), HDM_DELETEITEM, (WPARAM)(int)(i), 0L)
  245. // Get header item at index i. The mask field of the pointed-to
  246. // HD_ITEM structure indicates which fields will be set by this
  247. // function; other fields are not changed.
  248. //
  249. // The cchTextMax field of *pitem contains the maximum
  250. // length of the returned string.
  251. //
  252. // BOOL Header_GetItem(HWND hwndHD, int i, HD_ITEM FAR* phdi);
  253. //
  254. #define HDM_GETITEM (HDM_FIRST + 3)
  255. #define Header_GetItem(hwndHD, i, phdi) \
  256. (BOOL)SendMessage((hwndHD), HDM_GETITEM, (WPARAM)(int)(i), (LPARAM)(HD_ITEM FAR*)(phdi))
  257. // Set header item at index i. The mask field of the pointed-to
  258. // HD_ITEM structure indicates which header item attributes will
  259. // be changed by this call; other fields of *pitem that do not
  260. // correspond to pitem->mask are ignored.
  261. //
  262. // The cchTextMax of *pitem is ignored.
  263. //
  264. // BOOL Header_SetItem(HWND hwndHD, int i, const HD_ITEM FAR* phdi);
  265. //
  266. #define HDM_SETITEM (HDM_FIRST + 4)
  267. #define Header_SetItem(hwndHD, i, phdi) \
  268. (BOOL)SendMessage((hwndHD), HDM_SETITEM, (WPARAM)(int)(i), (LPARAM)(const HD_ITEM FAR*)(phdi))
  269. // Calculate size and position of header within a rectangle.
  270. // Results are returned in a WINDOWPOS structure you supply,
  271. // and the layout rectangle is adjusted to exclude the leftover area.
  272. //
  273. typedef struct _HD_LAYOUT
  274. {
  275. RECT FAR* prc;
  276. WINDOWPOS FAR* pwpos;
  277. } HD_LAYOUT;
  278. // BOOL Header_Layout(HWND hwndHD, HD_LAYOUT FAR* playout);
  279. //
  280. #define HDM_LAYOUT (HDM_FIRST + 5)
  281. #define Header_Layout(hwndHD, playout) \
  282. (BOOL)SendMessage((hwndHD), HDM_LAYOUT, 0, (LPARAM)(HD_LAYOUT FAR*)(playout))
  283. #define HHT_NOWHERE 0x0001
  284. #define HHT_ONHEADER 0x0002
  285. #define HHT_ONDIVIDER 0x0004
  286. #define HHT_ONDIVOPEN 0x0008
  287. #define HHT_ABOVE 0x0100
  288. #define HHT_BELOW 0x0200
  289. #define HHT_TORIGHT 0x0400
  290. #define HHT_TOLEFT 0x0800
  291. typedef struct _HD_HITTESTINFO
  292. {
  293. POINT pt; // in: client coords
  294. UINT flags; // out: HHT_ flags
  295. int iItem; // out: item
  296. } HD_HITTESTINFO;
  297. #define HDM_HITTEST (HDM_FIRST + 6)
  298. // Header Notifications
  299. //
  300. // All header notifications are via the WM_NOTIFY message.
  301. // lParam of WM_NOTIFY points to a HD_NOTIFY structure for
  302. // all of the following notifications.
  303. // *pitem contains item being changed. pitem->mask indicates
  304. // which fields are valid (others have indeterminate state)
  305. //
  306. #define HDN_ITEMCHANGING (HDN_FIRST-0)
  307. #define HDN_ITEMCHANGED (HDN_FIRST-1)
  308. // Item has been clicked or doubleclicked (HDS_BUTTONS only)
  309. // iButton contains button id: 0=left, 1=right, 2=middle.
  310. //
  311. #define HDN_ITEMCLICK (HDN_FIRST-2)
  312. #define HDN_ITEMDBLCLICK (HDN_FIRST-3)
  313. // Divider area has been clicked or doubleclicked (HDS_DIVIDERTRACK only)
  314. // iButton contains button id: 0=left, 1=right, 2=middle.
  315. //
  316. #define HDN_DIVIDERDBLCLICK (HDN_FIRST-5)
  317. // Begin/end divider tracking (HDS_DIVIDERTRACK only)
  318. // Return TRUE from HDN_BEGINTRACK notification to prevent tracking.
  319. //
  320. #define HDN_BEGINTRACK (HDN_FIRST-6)
  321. #define HDN_ENDTRACK (HDN_FIRST-7)
  322. // HDN_DRAG: cxy field contains new height/width, which may be < 0.
  323. // Changing this value will affect the tracked height/width (allowing
  324. // for gridding, pinning, etc).
  325. //
  326. // Return TRUE to cancel tracking.
  327. //
  328. #define HDN_TRACK (HDN_FIRST-8)
  329. typedef struct _HD_NOTIFY
  330. {
  331. NMHDR hdr;
  332. int iItem;
  333. int iButton; // *CLICK notifications: 0=left, 1=right, 2=middle
  334. HD_ITEM FAR* pitem; // May be NULL
  335. } HD_NOTIFY;
  336. #ifndef NOTOOLBAR
  337. #ifdef WIN32
  338. #define TOOLBARCLASSNAME "ToolbarWindow32"
  339. #else
  340. #define TOOLBARCLASSNAME "ToolbarWindow"
  341. #endif
  342. typedef struct _TBBUTTON {
  343. int iBitmap; /* index into bitmap of this button's picture */
  344. int idCommand; /* WM_COMMAND menu ID that this button sends */
  345. BYTE fsState; /* button's state */
  346. BYTE fsStyle; /* button's style */
  347. DWORD dwData; /* app defined data */
  348. int iString; /* index into string list */
  349. } TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
  350. typedef const TBBUTTON FAR* LPCTBBUTTON;
  351. typedef struct _COLORMAP {
  352. COLORREF from;
  353. COLORREF to;
  354. } COLORMAP, FAR* LPCOLORMAP;
  355. HWND WINAPI CreateToolbarEx(HWND hwnd, DWORD ws, UINT wID, int nBitmaps,
  356. HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
  357. int iNumButtons, int dxButton, int dyButton,
  358. int dxBitmap, int dyBitmap, UINT uStructSize);
  359. HBITMAP WINAPI CreateMappedBitmap(HINSTANCE hInstance, int idBitmap,
  360. UINT wFlags, LPCOLORMAP lpColorMap,
  361. int iNumMaps);
  362. #define CMB_MASKED 0x02 /* create image/mask pair in bitmap */
  363. /*REVIEW: TBSTATE_* should be TBF_* (for Flags) */
  364. #define TBSTATE_CHECKED 0x01 /* radio button is checked */
  365. #define TBSTATE_PRESSED 0x02 /* button is being depressed (any style) */
  366. #define TBSTATE_ENABLED 0x04 /* button is enabled */
  367. #define TBSTATE_HIDDEN 0x08 /* button is hidden */
  368. #define TBSTATE_INDETERMINATE 0x10 /* button is indeterminate */
  369. #define TBSTATE_WRAP 0x20 /* there is a line break after this button */
  370. /* (needs to be endabled, too) */
  371. #define TBSTYLE_BUTTON 0x00 /* this entry is button */
  372. #define TBSTYLE_SEP 0x01 /* this entry is a separator */
  373. #define TBSTYLE_CHECK 0x02 /* this is a check button (it stays down) */
  374. #define TBSTYLE_GROUP 0x04 /* this is a check button (it stays down) */
  375. #define TBSTYLE_CHECKGROUP (TBSTYLE_GROUP | TBSTYLE_CHECK) /* this group is a member of a group radio group */
  376. /* TOOLBAR window styles (not button, not trackbar) */
  377. #define TBSTYLE_TOOLTIPS 0x0100 /* make/use a tooltips control */
  378. #define TBSTYLE_WRAPABLE 0x0200 /* wrappable */
  379. #define TB_ENABLEBUTTON (WM_USER + 1)
  380. #define TB_CHECKBUTTON (WM_USER + 2)
  381. #define TB_PRESSBUTTON (WM_USER + 3)
  382. #define TB_HIDEBUTTON (WM_USER + 4)
  383. #define TB_INDETERMINATE (WM_USER + 5)
  384. #define TB_ISBUTTONENABLED (WM_USER + 9)
  385. #define TB_ISBUTTONCHECKED (WM_USER + 10)
  386. #define TB_ISBUTTONPRESSED (WM_USER + 11)
  387. #define TB_ISBUTTONHIDDEN (WM_USER + 12)
  388. #define TB_ISBUTTONINDETERMINATE (WM_USER + 13)
  389. #define TB_SETSTATE (WM_USER + 17)
  390. #define TB_GETSTATE (WM_USER + 18)
  391. #define TB_ADDBITMAP (WM_USER + 19)
  392. #ifdef WIN32
  393. typedef struct {
  394. HINSTANCE hInst; // module handle or NULL, or -1
  395. UINT nID; // if hInst == NULL, HBITMAP, else ID
  396. } TBADDBITMAP, *LPTBADDBITMAP;
  397. #define HINST_COMMCTRL ((HINSTANCE)-1)
  398. #define IDB_STD_SMALL_COLOR 0
  399. #define IDB_STD_LARGE_COLOR 1
  400. #define IDB_VIEW_SMALL_COLOR 4
  401. #define IDB_VIEW_LARGE_COLOR 5
  402. #endif
  403. #define TB_ADDBUTTONS (WM_USER + 20)
  404. #define TB_INSERTBUTTON (WM_USER + 21)
  405. #define TB_DELETEBUTTON (WM_USER + 22)
  406. #define TB_GETBUTTON (WM_USER + 23)
  407. #define TB_BUTTONCOUNT (WM_USER + 24)
  408. #define TB_COMMANDTOINDEX (WM_USER + 25)
  409. #ifdef WIN32
  410. typedef struct {
  411. HKEY hkr;
  412. LPCSTR pszSubKey;
  413. LPCSTR pszValueName;
  414. } TBSAVEPARAMS;
  415. // wParam: BOOL (TRUE -> save state, FALSE -> restore
  416. // lParam: pointer to TBSAVERESTOREPARAMS
  417. #endif
  418. #define TB_SAVERESTORE (WM_USER + 26)
  419. #define TB_CUSTOMIZE (WM_USER + 27)
  420. #define TB_ADDSTRING (WM_USER + 28)
  421. #define TB_GETITEMRECT (WM_USER + 29)
  422. #define TB_BUTTONSTRUCTSIZE (WM_USER + 30)
  423. #define TB_SETBUTTONSIZE (WM_USER + 31)
  424. #define TB_SETBITMAPSIZE (WM_USER + 32)
  425. #define TB_AUTOSIZE (WM_USER + 33)
  426. #define TB_SETBUTTONTYPE (WM_USER + 34)
  427. #define TB_GETTOOLTIPS (WM_USER + 35)
  428. #define TB_SETTOOLTIPS (WM_USER + 36)
  429. #define TB_SETPARENT (WM_USER + 37)
  430. #define TB_SETROWS (WM_USER + 39)
  431. #define TB_GETROWS (WM_USER + 40)
  432. #define TB_SETCMDID (WM_USER + 42)
  433. #ifdef WIN32
  434. #define TBBF_LARGE 0x0001
  435. // returns TBBF_ flags
  436. #define TB_GETBITMAPFLAGS (WM_USER + 41)
  437. #define TBN_GETBUTTONINFO (TBN_FIRST-0)
  438. #define TBN_BEGINDRAG (TBN_FIRST-1)
  439. #define TBN_ENDDRAG (TBN_FIRST-2)
  440. #define TBN_BEGINADJUST (TBN_FIRST-3)
  441. #define TBN_ENDADJUST (TBN_FIRST-4)
  442. #define TBN_RESET (TBN_FIRST-5)
  443. #define TBN_QUERYINSERT (TBN_FIRST-6)
  444. #define TBN_QUERYDELETE (TBN_FIRST-7)
  445. #define TBN_TOOLBARCHANGE (TBN_FIRST-8)
  446. #define TBN_CUSTHELP (TBN_FIRST-9)
  447. typedef struct {
  448. NMHDR hdr;
  449. int iItem;
  450. TBBUTTON tbButton;
  451. int cchText;
  452. LPSTR pszText;
  453. } TBNOTIFY, FAR *LPTBNOTIFY;
  454. #endif
  455. #endif /* NOTOOLBAR */
  456. /*//////////////////////////////////////////////////////////////////////*/
  457. #ifndef NOTOOLTIPS
  458. #ifdef WIN32
  459. #define TOOLTIPS_CLASS "tooltips_class32"
  460. #else
  461. #define TOOLTIPS_CLASS "tooltips_class"
  462. #endif
  463. typedef struct {
  464. UINT cbSize;
  465. UINT uFlags;
  466. HWND hwnd;
  467. UINT uId;
  468. RECT rect;
  469. HINSTANCE hinst;
  470. LPSTR lpszText;
  471. } TOOLINFO, NEAR *PTOOLINFO, FAR *LPTOOLINFO;
  472. #define TTS_ALWAYSTIP 0x01 // check over inactive windows as well
  473. #define TTS_NOPREFIX 0x02
  474. #define TTF_WIDISHWND 0x01
  475. #define TTM_ACTIVATE (WM_USER + 1) // wparam = BOOL (true or false = activate or deactivate)
  476. #define TTM_SETDELAYTIME (WM_USER + 3)
  477. #define TTM_ADDTOOL (WM_USER + 4)
  478. #define TTM_DELTOOL (WM_USER + 5)
  479. #define TTM_NEWTOOLRECT (WM_USER + 6)
  480. #define TTM_RELAYEVENT (WM_USER + 7)
  481. // lParam has TOOLINFO with hwnd and wid. this gets filled in
  482. #define TTM_GETTOOLINFO (WM_USER + 8)
  483. // lParam has TOOLINFO
  484. #define TTM_SETTOOLINFO (WM_USER + 9)
  485. // returns true or false for found, not found.
  486. // fills in LPHITTESTINFO->ti
  487. #define TTM_HITTEST (WM_USER +10)
  488. #define TTM_GETTEXT (WM_USER +11)
  489. #define TTM_UPDATETIPTEXT (WM_USER +12)
  490. #define TTM_GETTOOLCOUNT (WM_USER +13)
  491. #define TTM_ENUMTOOLS (WM_USER +14)
  492. typedef struct _TT_HITTESTINFO {
  493. HWND hwnd;
  494. POINT pt;
  495. TOOLINFO ti;
  496. } TTHITTESTINFO, FAR * LPHITTESTINFO;
  497. // WM_NOTIFY message sent to parent window to get tooltip text
  498. // if TTF_QUERYFORTIP is set on any tips
  499. #define TTN_NEEDTEXT (TTN_FIRST - 0)
  500. // WM_NOTIFY structure sent if TTF_QUERYFORTIP is set
  501. // the host can
  502. // 1) fill in the szText,
  503. // 2) point lpszText to their own text
  504. // 3) put a resource id number in lpszText
  505. // and point hinst to the hinstance to load from
  506. typedef struct {
  507. NMHDR hdr;
  508. LPSTR lpszText;
  509. char szText[80];
  510. HINSTANCE hinst;
  511. } TOOLTIPTEXT, FAR *LPTOOLTIPTEXT;
  512. #endif //NOTOOLTIPS
  513. /*/////////////////////////////////////////////////////////////////////////*/
  514. #ifndef NOSTATUSBAR
  515. /*REVIEW: Here exists the only known documentation for status bars. */
  516. // SBS_* styles need to not overlap with CCS_* values
  517. // want a size gripper on a status bar. this only applies if the
  518. // DrawFrameControl function is available.
  519. #define SBARS_SIZEGRIP 0x0100
  520. /* DrawStatusText:
  521. * This is used if the app wants to draw status in its client rect,
  522. * instead of just creating a window. Note that this same function is
  523. * used internally in the status bar window's WM_PAINT message.
  524. * hDC is the DC to draw to. The font that is selected into hDC will
  525. * be used. The RECT lprc is the only portion of hDC that will be drawn
  526. * to: the outer edge of lprc will have the highlights (the area outside
  527. * of the highlights will not be drawn in the BUTTONFACE color: the app
  528. * must handle that). The area inside the highlights will be erased
  529. * properly when drawing the text.
  530. */
  531. void WINAPI DrawStatusText(HDC hDC, LPRECT lprc, LPCSTR szText, UINT uFlags);
  532. HWND WINAPI CreateStatusWindow(LONG style, LPCSTR lpszText, HWND hwndParent, UINT wID);
  533. #ifdef WIN32
  534. #define STATUSCLASSNAME "msctls_statusbar32"
  535. #else
  536. #define STATUSCLASSNAME "msctls_statusbar"
  537. #endif
  538. #define SB_SETTEXT (WM_USER+1)
  539. #define SB_GETTEXT (WM_USER+2)
  540. #define SB_GETTEXTLENGTH (WM_USER+3)
  541. /* Just like WM_?ETTEXT*, with wParam specifying the pane that is referenced
  542. * (at most 255).
  543. * Note that you can use the WM_* versions to reference the 0th pane (this
  544. * is useful if you want to treat a "default" status bar like a static text
  545. * control).
  546. * For SETTEXT, wParam is the pane or'ed with SBT_* style bits (defined below).
  547. * If the text is "normal" (not OWNERDRAW), then a single pane may have left,
  548. * center, and right justified text by separating the parts with a single tab,
  549. * plus if lParam is NULL, then the pane has no text. The pane will be
  550. * invalidated, but not draw until the next PAINT message.
  551. * For GETTEXT and GETTEXTLENGTH, the LOWORD of the return will be the length,
  552. * and the HIWORD will be the SBT_* style bits.
  553. */
  554. #define SB_SETPARTS (WM_USER+4)
  555. /* wParam is the number of panes, and lParam points to an array of points
  556. * specifying the right hand side of each pane. A right hand side of -1 means
  557. * it goes all the way to the right side of the control minus the X border
  558. */
  559. #define SB_SETBORDERS (WM_USER+5)
  560. /* lParam points to an array of 3 integers: X border, Y border, between pane
  561. * border. If any is less than 0, the default will be used for that one.
  562. */
  563. #define SB_GETPARTS (WM_USER+6)
  564. /* lParam is a pointer to an array of integers that will get filled in with
  565. * the right hand side of each pane and wParam is the size (in integers)
  566. * of the lParam array (so we do not go off the end of it).
  567. * Returns the number of panes.
  568. */
  569. #define SB_GETBORDERS (WM_USER+7)
  570. /* lParam is a pointer to an array of 3 integers that will get filled in with
  571. * the X border, the Y border, and the between pane border.
  572. */
  573. #define SB_SETMINHEIGHT (WM_USER+8)
  574. /* wParam is the minimum height of the status bar "drawing" area. This is
  575. * the area inside the highlights. This is most useful if a pane is used
  576. * for an OWNERDRAW item, and is ignored if the SBS_NORESIZE flag is set.
  577. * Note that WM_SIZE (wParam=0, lParam=0L) must be sent to the control for
  578. * any size changes to take effect.
  579. */
  580. #define SB_SIMPLE (WM_USER+9)
  581. /* wParam specifies whether to set (non-zero) or unset (zero) the "simple"
  582. * mode of the status bar. In simple mode, only one pane is displayed, and
  583. * its text is set with LOWORD(wParam)==255 in the SETTEXT message.
  584. * OWNERDRAW is not allowed, but other styles are.
  585. * The pane gets invalidated, but not painted until the next PAINT message,
  586. * so you can set new text without flicker (I hope).
  587. * This can be used with the WM_INITMENU and WM_MENUSELECT messages to
  588. * implement help text when scrolling through a menu.
  589. */
  590. #define SB_GETRECT (WM_USER + 10)
  591. // wParam is the nth part
  592. // lparam is lprc
  593. // returns true if found a rect for wParam
  594. #define SBT_OWNERDRAW 0x1000
  595. /* The lParam of the SB_SETTEXT message will be returned in the DRAWITEMSTRUCT
  596. * of the WM_DRAWITEM message. Note that the fields CtlType, itemAction, and
  597. * itemState of the DRAWITEMSTRUCT are undefined for a status bar.
  598. * The return value for GETTEXT will be the itemData.
  599. */
  600. #define SBT_NOBORDERS 0x0100
  601. /* No borders will be drawn for the pane.
  602. */
  603. #define SBT_POPOUT 0x0200
  604. /* The text pops out instead of in
  605. */
  606. #define HBT_SPRING 0x0400
  607. /* this means that the item is "springy", meaning that it has a minimum
  608. * width, but will grow if there is extra room in the window. Note that
  609. * multiple springs are allowed, and the extra room will be distributed
  610. * among them.
  611. */
  612. #endif /* NOSTATUSBAR */
  613. /*/////////////////////////////////////////////////////////////////////////*/
  614. #ifndef NOMENUHELP
  615. void WINAPI MenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, HINSTANCE hInst, HWND hwndStatus, UINT FAR *lpwIDs);
  616. BOOL WINAPI ShowHideMenuCtl(HWND hWnd, UINT uFlags, LPINT lpInfo);
  617. void WINAPI GetEffectiveClientRect(HWND hWnd, LPRECT lprc, LPINT lpInfo);
  618. /*REVIEW: is this internal? */
  619. #define MINSYSCOMMAND SC_SIZE
  620. #endif /* NOMENUHELP */
  621. /*/////////////////////////////////////////////////////////////////////////*/
  622. // slider control
  623. #ifndef NOTRACKBAR
  624. /*
  625. This control keeps its ranges in LONGs. but for
  626. convienence and symetry with scrollbars
  627. WORD parameters are are used for some messages.
  628. if you need a range in LONGs don't use any messages
  629. that pack values into loword/hiword pairs
  630. The trackbar messages:
  631. message wParam lParam return
  632. TBM_GETPOS ------ ------ Current logical position of trackbar.
  633. TBM_GETRANGEMIN ------ ------ Current logical minimum position allowed.
  634. TBM_GETRANGEMAX ------ ------ Current logical maximum position allowed.
  635. TBM_SETTIC
  636. TBM_SETPOS
  637. TBM_SETRANGEMIN
  638. TBM_SETRANGEMAX
  639. */
  640. #ifdef WIN32
  641. #define TRACKBAR_CLASS "msctls_trackbar32"
  642. #else
  643. #define TRACKBAR_CLASS "msctls_trackbar"
  644. #endif
  645. /* Trackbar styles */
  646. /* add ticks automatically on TBM_SETRANGE message */
  647. #define TBS_AUTOTICKS 0x0001
  648. #define TBS_VERT 0x0002 /* vertical trackbar */
  649. #define TBS_HORZ 0x0000 /* default */
  650. #define TBS_TOP 0x0004 /* Ticks on top */
  651. #define TBS_BOTTOM 0x0000 /* Ticks on bottom (default) */
  652. #define TBS_LEFT 0x0004 /* Ticks on left */
  653. #define TBS_RIGHT 0x0000 /* Ticks on right (default) */
  654. #define TBS_BOTH 0x0008 /* Ticks on both side */
  655. #define TBS_NOTICKS 0x0010
  656. #define TBS_ENABLESELRANGE 0x0020
  657. /* Trackbar messages */
  658. /* returns current position (LONG) */
  659. #define TBM_GETPOS (WM_USER)
  660. /* set the min of the range to LPARAM */
  661. #define TBM_GETRANGEMIN (WM_USER+1)
  662. /* set the max of the range to LPARAM */
  663. #define TBM_GETRANGEMAX (WM_USER+2)
  664. /* wParam is index of tick to get (ticks are in the range of min - max) */
  665. #define TBM_GETTIC (WM_USER+3)
  666. /* wParam is index of tick to set */
  667. #define TBM_SETTIC (WM_USER+4)
  668. /* set the position to the value of lParam (wParam is the redraw flag) */
  669. #define TBM_SETPOS (WM_USER+5)
  670. /* LOWORD(lParam) = min, HIWORD(lParam) = max, wParam == fRepaint */
  671. #define TBM_SETRANGE (WM_USER+6)
  672. /* lParam is range min (use this to keep LONG precision on range) */
  673. #define TBM_SETRANGEMIN (WM_USER+7)
  674. /* lParam is range max (use this to keep LONG precision on range) */
  675. #define TBM_SETRANGEMAX (WM_USER+8)
  676. /* remove the ticks */
  677. #define TBM_CLEARTICS (WM_USER+9)
  678. /* select a range LOWORD(lParam) min, HIWORD(lParam) max */
  679. #define TBM_SETSEL (WM_USER+10)
  680. /* set selection rang (LONG form) */
  681. #define TBM_SETSELSTART (WM_USER+11)
  682. #define TBM_SETSELEND (WM_USER+12)
  683. // #define TBM_SETTICTOK (WM_USER+13)
  684. /* return a pointer to the list of tics (DWORDS) */
  685. #define TBM_GETPTICS (WM_USER+14)
  686. /* get the pixel position of a given tick */
  687. #define TBM_GETTICPOS (WM_USER+15)
  688. /* get the number of tics */
  689. #define TBM_GETNUMTICS (WM_USER+16)
  690. /* get the selection range */
  691. #define TBM_GETSELSTART (WM_USER+17)
  692. #define TBM_GETSELEND (WM_USER+18)
  693. /* clear the selection */
  694. #define TBM_CLEARSEL (WM_USER+19)
  695. /* set tic frequency */
  696. #define TBM_SETTICFREQ (WM_USER+20)
  697. /* Set/get the page size */
  698. #define TBM_SETPAGESIZE (WM_USER+21) // lParam = lPageSize . Returns old pagesize
  699. #define TBM_GETPAGESIZE (WM_USER+22)
  700. /* Set/get the line size */
  701. #define TBM_SETLINESIZE (WM_USER+23)
  702. #define TBM_GETLINESIZE (WM_USER+24)
  703. /* Get the thumb's and channel's rect size */
  704. #define TBM_GETTHUMBRECT (WM_USER+25) // lParam = lprc . for return value
  705. #define TBM_GETCHANNELRECT (WM_USER+26) // lParam = lprc . for return value
  706. /*REVIEW: these match the SB_ (scroll bar messages); define them that way? */
  707. #define TB_LINEUP 0
  708. #define TB_LINEDOWN 1
  709. #define TB_PAGEUP 2
  710. #define TB_PAGEDOWN 3
  711. #define TB_THUMBPOSITION 4
  712. #define TB_THUMBTRACK 5
  713. #define TB_TOP 6
  714. #define TB_BOTTOM 7
  715. #define TB_ENDTRACK 8
  716. #endif
  717. /*/////////////////////////////////////////////////////////////////////////*/
  718. #ifndef NODRAGLIST
  719. typedef struct {
  720. UINT uNotification;
  721. HWND hWnd;
  722. POINT ptCursor;
  723. } DRAGLISTINFO, FAR *LPDRAGLISTINFO;
  724. #define DL_BEGINDRAG (WM_USER+133)
  725. #define DL_DRAGGING (WM_USER+134)
  726. #define DL_DROPPED (WM_USER+135)
  727. #define DL_CANCELDRAG (WM_USER+136)
  728. #define DL_CURSORSET 0
  729. #define DL_STOPCURSOR 1
  730. #define DL_COPYCURSOR 2
  731. #define DL_MOVECURSOR 3
  732. #define DRAGLISTMSGSTRING "commctrl_DragListMsg"
  733. BOOL WINAPI MakeDragList(HWND hLB);
  734. void WINAPI DrawInsert(HWND handParent, HWND hLB, int nItem);
  735. int WINAPI LBItemFromPt(HWND hLB, POINT pt, BOOL bAutoScroll);
  736. #endif /* NODRAGLIST */
  737. /*/////////////////////////////////////////////////////////////////////////*/
  738. // spinner control
  739. #ifndef NOUPDOWN
  740. /*
  741. // OVERVIEW:
  742. //
  743. // The UpDown control is a simple pair of buttons which increment or
  744. // decrement an integer value. The operation is similar to a vertical
  745. // scrollbar; except that the control only has line-up and line-down
  746. // functionality, and changes the current position automatically.
  747. //
  748. // The control also can be linked with a companion control, usually an
  749. // "edit" control, to simplify dialog-box management. This companion is
  750. // termed a "buddy" in this documentation. Any sibling HWND may be
  751. // assigned as the control's buddy, or the control may be allowed to
  752. // choose one automatically. Once chosen, the UpDown can size itself to
  753. // match the buddy's right or left border, and/or automatically set the
  754. // text of the buddy control to make the current position visible.
  755. //
  756. // ADDITIONAL NOTES:
  757. //
  758. // The "upper" and "lower" limits must not cover a range larger than 32,767
  759. // positions. It is acceptable to have the range inverted, i.e., to have
  760. // (lower > upper). The upper button always moves the current position
  761. // towards the "upper" number, and the lower button always moves towards the
  762. // "lower" number. If the range is zero (lower == upper), or the control
  763. // is disabled (EnableWindow(hCtrl, FALSE)), the control draws grayed
  764. // arrows in both buttons. The UDS_WRAP style makes the range cyclic; that
  765. // is, the numbers will wrap once one end of the range is reached.
  766. //
  767. // The buddy window must have the same parent as the UpDown control.
  768. //
  769. // If either of the UDS_ALIGN* styles are used, the updown control will
  770. // locate itself on the "inside" of the buddy by resizing the buddy
  771. // accordingly. so the original size of the buddy will now emcompass
  772. // both a slightly smaller buddy and the updown control.
  773. //
  774. // If the buddy window resizes, and the UDS_ALIGN* styles are used, it
  775. // is necessary to send the UDM_SETBUDDY message to re-anchor the UpDown
  776. // control on the appropriate border of the buddy window.
  777. //
  778. // The UDS_AUTOBUDDY style uses GetWindow(hCtrl, GW_HWNDPREV) to pick
  779. // the best buddy window. In the case of a DIALOG resource, this will
  780. // choose the previous control listed in the resource script. If the
  781. // windows will change in Z-order, sending UDM_SETBUDDY with a NULL handle
  782. // will pick a new buddy; otherwise the original auto-buddy choice is
  783. // maintained.
  784. //
  785. // The UDS_SETBUDDYINT style uses its own SetDlgItemInt-style
  786. // functionality to set the caption text of the buddy. All WIN.INI [Intl]
  787. // values are honored by this routine.
  788. //
  789. // The UDS_ARROWKEYS style will subclass the buddy window, in order to steal
  790. // the VK_UP and VK_DOWN arrow key messages.
  791. //
  792. // The UDS_HORZ sytle will draw the two buttons side by side with
  793. // left and right arrows instead of up and down arrows. It will also
  794. // send the WM_HSCROLL message instead
  795. //
  796. */
  797. #ifdef WIN32
  798. #define UPDOWN_CLASS "msctls_updown32"
  799. #else
  800. #define UPDOWN_CLASS "msctls_updown"
  801. #endif
  802. /* Structures */
  803. typedef struct _UDACCEL {
  804. UINT nSec;
  805. UINT nInc;
  806. } UDACCEL, FAR *LPUDACCEL;
  807. #define UD_MAXVAL 0x7fff
  808. #define UD_MINVAL (-UD_MAXVAL)
  809. /* STYLE BITS */
  810. #define UDS_WRAP 0x0001
  811. #define UDS_SETBUDDYINT 0x0002
  812. #define UDS_ALIGNRIGHT 0x0004
  813. #define UDS_ALIGNLEFT 0x0008
  814. #define UDS_AUTOBUDDY 0x0010
  815. #define UDS_ARROWKEYS 0x0020
  816. #define UDS_HORZ 0x0040
  817. #define UDS_NOTHOUSANDS 0x0080
  818. /* MESSAGES */
  819. #define UDM_SETRANGE (WM_USER+101)
  820. /* wParam: not used, 0
  821. // lParam: short LOWORD, new upper; short HIWORD, new lower limit
  822. // return: not used
  823. */
  824. #define UDM_GETRANGE (WM_USER+102)
  825. /* wParam: not used, 0
  826. // lParam: not used, 0
  827. // return: short LOWORD, upper; short HIWORD, lower limit
  828. */
  829. #define UDM_SETPOS (WM_USER+103)
  830. /* wParam: not used, 0
  831. // lParam: short LOWORD, new pos; HIWORD not used, 0
  832. // return: short LOWORD, old pos; HIWORD not used
  833. */
  834. #define UDM_GETPOS (WM_USER+104)
  835. /* wParam: not used, 0
  836. // lParam: not used, 0
  837. // return: short LOWORD, current pos; HIWORD not used
  838. */
  839. #define UDM_SETBUDDY (WM_USER+105)
  840. /* wParam: HWND, new buddy
  841. // lParam: not used, 0
  842. // return: HWND LOWORD, old buddy; HIWORD not used
  843. */
  844. #define UDM_GETBUDDY (WM_USER+106)
  845. /* wParam: not used, 0
  846. // lParam: not used, 0
  847. // return: HWND LOWORD, current buddy; HIWORD not used
  848. */
  849. #define UDM_SETACCEL (WM_USER+107)
  850. /* wParam: UINT, number of acceleration steps
  851. // lParam: LPUDACCEL, pointer to array of UDACCEL elements
  852. // Elements should be sorted in increasing nSec order.
  853. // return: BOOL LOWORD, nonzero if successful; HIWORD not used
  854. */
  855. #define UDM_GETACCEL (WM_USER+108)
  856. /* wParam: UINT, number of elements in the UDACCEL array
  857. // lParam: LPUDACCEL, pointer to UDACCEL buffer to receive array
  858. // return: UINT LOWORD, number of elements returned in buffer
  859. */
  860. #define UDM_SETBASE (WM_USER+109)
  861. /* wParam: UINT, new radix base (10 for decimal, 16 for hex, etc.)
  862. // lParam: not used, 0
  863. // return: not used
  864. */
  865. #define UDM_GETBASE (WM_USER+110)
  866. /* wParam: not used, 0
  867. // lParam: not used, 0
  868. // return: UINT LOWORD, current radix base; HIWORD not used
  869. */
  870. /* NOTIFICATIONS */
  871. // This code is used when we send a WM_COMMAND to specific a
  872. // up/down control notification.
  873. // It will be received Before the WM_VSCROLL notification.
  874. #define UDM_DELTAPOS 1
  875. // wParam: UpDown Control ID
  876. // lParam: HIWORD -> Notification code (UDM_DELTAPOS)
  877. // lParam: LOWORD -> Position change delta as a signed 16 bit int.
  878. /* WM_VSCROLL
  879. // Note that unlike a scrollbar, the position is automatically changed by
  880. // the control, and the LOWORD(lParam) is always the new position. Only
  881. // SB_THUMBTRACK and SB_THUMBPOSITION scroll codes are sent in the wParam.
  882. */
  883. /* HELPER APIs */
  884. HWND WINAPI CreateUpDownControl(DWORD dwStyle, int x, int y, int cx, int cy,
  885. HWND hParent, int nID, HINSTANCE hInst,
  886. HWND hBuddy,
  887. int nUpper, int nLower, int nPos);
  888. /* Does the CreateWindow call followed by setting the various
  889. // state information:
  890. // hBuddy The companion control (usually an "edit").
  891. // nUpper The range limit corresponding to the upper button.
  892. // nLower The range limit corresponding to the lower button.
  893. // nPos The initial position.
  894. // Returns the handle to the control or NULL on failure.
  895. */
  896. #endif /* NOUPDOWN */
  897. /*/////////////////////////////////////////////////////////////////////////*/
  898. // progress indicator
  899. #ifndef NOPROGRESS
  900. #ifdef WIN32
  901. #define PROGRESS_CLASS "msctls_progress32"
  902. #else
  903. #define PROGRESS_CLASS "msctls_progress"
  904. #endif
  905. /*
  906. // OVERVIEW:
  907. //
  908. // The progress bar control is a "gas gauge" that can be used to show the
  909. // progress of a lengthy operation.
  910. //
  911. // The application sets the range and current position (similar to a
  912. // scrollbar) and has the ability to advance the current position in
  913. // a variety of ways.
  914. //
  915. // Text can be displayed in the progress bar as either a percentage
  916. // of the entire range (using the PBS_SHOWPERCENT style) or as the
  917. // value of the current position (using the PBS_SHOWPOS style). If
  918. // neither bit is set, no text is shown in the bar.
  919. //
  920. // When PBM_STEPIT is used to advance the current position, the gauge
  921. // will wrap when it reaches the end and start again at the start.
  922. // The position is clamped at either end in other cases.
  923. //
  924. */
  925. /*/////////////////////////////////////////////////////////////////////////*/
  926. /* STYLE BITS */
  927. #define PBS_SHOWPERCENT 0x01 // BUGBUG: not implemented yet
  928. #define PBS_SHOWPOS 0x02 // BUGBUG: not implemented yet
  929. /* MESSAGES */
  930. #define PBM_SETRANGE (WM_USER+1)
  931. /* wParam: not used, 0
  932. // lParam: int LOWORD, bottom of range; int HIWORD top of range
  933. // return: int LOWORD, previous bottom; int HIWORD old top
  934. */
  935. #define PBM_SETPOS (WM_USER+2)
  936. /* wParam: int new position
  937. // lParam: not used, 0
  938. // return: int LOWORD, previous position; HIWORD not used
  939. */
  940. #define PBM_DELTAPOS (WM_USER+3)
  941. /* wParam: int amount to advance current position
  942. // lParam: not used, 0
  943. // return: int LOWORD, previous position; HIWORD not used
  944. */
  945. #define PBM_SETSTEP (WM_USER+4)
  946. /* wParam: int new step
  947. // lParam: not used, 0
  948. // return: int LOWORD, previous step; HIWORD not used
  949. */
  950. #define PBM_STEPIT (WM_USER+5)
  951. /* advance current position by current step
  952. // wParam: not used 0
  953. // lParam: not used, 0
  954. // return: int LOWORD, previous position; HIWORD not used
  955. */
  956. #endif /* NOPROGRESS */
  957. #ifndef NOHOTKEY
  958. /*
  959. // OVERVIEW: k
  960. //
  961. // The hotkey control is designed as an edit control for hotkey
  962. // entry. the application supplies a set of control/alt/shift
  963. // combinations that are considered invalid and a default combination
  964. // to be used OR'd with an invalid combination.
  965. //
  966. // Hotkey values are returned as a pair of bytes, one for the
  967. // virtual key code of the key and the other specifying the
  968. // modifier combinations used with the key.
  969. //
  970. */
  971. // possible modifiers
  972. #define HOTKEYF_SHIFT 0x01
  973. #define HOTKEYF_CONTROL 0x02
  974. #define HOTKEYF_ALT 0x04
  975. #define HOTKEYF_EXT 0x08 // keyboard extended bit
  976. // possible modifier combinations (for defining invalid combos)
  977. #define HKCOMB_NONE 0x0001 // no modifiers
  978. #define HKCOMB_S 0x0002 // only shift
  979. #define HKCOMB_C 0x0004 // only control
  980. #define HKCOMB_A 0x0008 // only alt
  981. #define HKCOMB_SC 0x0010 // shift+control
  982. #define HKCOMB_SA 0x0020 // shift+alt
  983. #define HKCOMB_CA 0x0040 // control+alt
  984. #define HKCOMB_SCA 0x0080 // shift+control+alt
  985. // wHotkey: WORD lobyte, virtual key code
  986. // WORD hibyte, modifers (combination of HOTKEYF_).
  987. #define HKM_SETHOTKEY (WM_USER+1)
  988. /* wParam: wHotkey;
  989. // lParam: not used, 0
  990. // return: not used
  991. */
  992. #define HKM_GETHOTKEY (WM_USER+2)
  993. /* wParam: not used, 0
  994. // lParam: not used, 0
  995. // return: wHotkey;
  996. */
  997. #define HKM_SETRULES (WM_USER+3)
  998. /* wParam: UINT, invalid modifier combinations (using HKCOMB_*)
  999. // lParam: UINT loword, default modifier combination (using HOTKEYF_*)
  1000. // hiword not used
  1001. // return: not used
  1002. */
  1003. #ifdef WIN32
  1004. #define HOTKEY_CLASS "msctls_hotkey32"
  1005. #else
  1006. #define HOTKEY_CLASS "msctls_hotkey"
  1007. #endif
  1008. #endif /* NOHOTKEY */
  1009. /*/////////////////////////////////////////////////////////////////////////*/
  1010. /* Note that the following flags are checked every time the window gets a
  1011. * WM_SIZE message, so the style of the window can be changed "on-the-fly".
  1012. * If NORESIZE is set, then the app is responsible for all control placement
  1013. * and sizing. If NOPARENTALIGN is set, then the app is responsible for
  1014. * placement. If neither is set, the app just needs to send a WM_SIZE
  1015. * message for the window to be positioned and sized correctly whenever the
  1016. * parent window size changes.
  1017. * Note that for STATUS bars, CCS_BOTTOM is the default, for HEADER bars,
  1018. * CCS_NOMOVEY is the default, and for TOOL bars, CCS_TOP is the default.
  1019. */
  1020. #define CCS_TOP 0x00000001L
  1021. /* This flag means the status bar should be "top" aligned. If the
  1022. * NOPARENTALIGN flag is set, then the control keeps the same top, left, and
  1023. * width measurements, but the height is adjusted to the default, otherwise
  1024. * the status bar is positioned at the top of the parent window such that
  1025. * its client area is as wide as the parent window and its client origin is
  1026. * the same as its parent.
  1027. * Similarly, if this flag is not set, the control is bottom-aligned, either
  1028. * with its original rect or its parent rect, depending on the NOPARENTALIGN
  1029. * flag.
  1030. */
  1031. #define CCS_NOMOVEY 0x00000002L
  1032. /* This flag means the control may be resized and moved horizontally (if the
  1033. * CCS_NORESIZE flag is not set), but it will not move vertically when a
  1034. * WM_SIZE message comes through.
  1035. */
  1036. #define CCS_BOTTOM 0x00000003L
  1037. /* Same as CCS_TOP, only on the bottom.
  1038. */
  1039. #define CCS_NORESIZE 0x00000004L
  1040. /* This flag means that the size given when creating or resizing is exact,
  1041. * and the control should not resize itself to the default height or width
  1042. */
  1043. #define CCS_NOPARENTALIGN 0x00000008L
  1044. /* This flag means that the control should not "snap" to the top or bottom
  1045. * or the parent window, but should keep the same placement it was given
  1046. */
  1047. #define CCS_NOHILITE 0x00000010L
  1048. /* Don't draw the one pixel highlight at the top of the control
  1049. */
  1050. #define CCS_ADJUSTABLE 0x00000020L
  1051. /* This allows a toolbar (header bar?) to be configured by the user.
  1052. */
  1053. #define CCS_NODIVIDER 0x00000040L
  1054. /* Don't draw the 2 pixel highlight at top of control (toolbar)
  1055. */
  1056. /*/////////////////////////////////////////////////////////////////////////*/
  1057. //================ LISTVIEW APIS ===========================================
  1058. //
  1059. // Class name: SysListView (WC_LISTVIEW)
  1060. //
  1061. // The SysListView control provides for a group of items which are displayed
  1062. // as a name and/or an associated icon and associated sub-items, in one of
  1063. // several organizations, depending on current style settings:
  1064. // * The Icon Format (LVS_ICON)
  1065. // The control arranges standard-sized icons on an invisible grid
  1066. // with their text caption below the icon. The user can drag icons to
  1067. // rearrange them freely, even overlapping each other.
  1068. // * The Small Icon Format (LVS_SMALLICON)
  1069. // The control arranges half-sized icons on an invisible columnar grid
  1070. // like a multi-column owner-draw listbox, with the caption of each
  1071. // item to the icon's right. The user can still rearrange items
  1072. // freely to taste. Converting from LVS_ICON to LVS_SMALLICON and back
  1073. // will attempt to preserve approximate relative positions of
  1074. // repositioned items.
  1075. // * The List Format (LVS_LIST)
  1076. // The control enforces a multi-column list of small-icon items with
  1077. // each item's caption to the right. No free rearranging is possible.
  1078. // * The Report Format (LVS_REPORT)
  1079. // The control enforces a single-column list of small-icon items with
  1080. // each item's caption to the right, and further columns used for item-
  1081. // specific sub-item text. The columns are capped with a SysHeader
  1082. // bar (unless specified) which allows the user to change the relative
  1083. // widths of each sub-item column.
  1084. //
  1085. // The icons and small-icons presented may be assigned as indices into
  1086. // an ImageList of the appropriate size. These ImageLists (either custom
  1087. // lists or copies of the system lists) are assigned to the control by the
  1088. // owner at initialization time or at any later time.
  1089. //
  1090. // Text and icon values may be "late-bound," or assigned by a callback
  1091. // routine as required by the control. For example, if it would be slow to
  1092. // compute the correct icon or caption for an item, the item can be assigned
  1093. // special values which indicate that they should be computed only as the
  1094. // items become visible (say, for a long list of items being scrolled into
  1095. // view).
  1096. //
  1097. // Each item has a state, which can be (nearly) any combination of the
  1098. // following attributes, mostly managed automatically by the control:
  1099. // * Selected (LVIS_SELECTED)
  1100. // The item appears selected. The appearance of selected items
  1101. // depends on whether the control has the focus, and the selection
  1102. // system colors.
  1103. // * Focused (LVIS_FOCUSED)
  1104. // One item at a time may be focused. The item is surrounded with a
  1105. // standard focus-rectangle.
  1106. // * Marked (LVIS_CUT)
  1107. // REVIEW: Call this "Checked"?
  1108. // * Disabled (LVIS_DISABLED)
  1109. // The item is drawn with the standard disabled style and coloring.
  1110. // * Hidden (LVIS_HIDDEN)
  1111. // The item is not visible nor does it respond to user interaction.
  1112. // * Drop-Highlighted (LVIS_DROPHILITED)
  1113. // The item appears marked when the user drags an object over it, if
  1114. // it can accept the object as a drop-target.
  1115. // * Link/Alias/Shortcut (LVIS_LINK)
  1116. // The item's text has a standard link-indicator appended (Foo >>).
  1117. //
  1118. // There are notifications that allow applications to determine when an item
  1119. // has been clicked or double clicked, caption text changes have occured,
  1120. // drag tracking is occuring, widths of columns have changed, etc.
  1121. //
  1122. //////////////////////////////////////////////////////////////////////////////
  1123. #ifdef WIN32
  1124. #define WC_LISTVIEW "SysListView32"
  1125. #else
  1126. #define WC_LISTVIEW "SysListView"
  1127. #endif
  1128. // ListView styles
  1129. //
  1130. // view type styles (we only have 16 bits to use here)
  1131. #define LVS_ICON 0x0000
  1132. #define LVS_REPORT 0x0001
  1133. #define LVS_SMALLICON 0x0002
  1134. #define LVS_LIST 0x0003
  1135. #define LVS_TYPEMASK 0x0003
  1136. // shared styles
  1137. #define LVS_SINGLESEL 0x0004
  1138. #define LVS_SHOWSELALWAYS 0x0008
  1139. #define LVS_SORTASCENDING 0x0010
  1140. #define LVS_SORTDESCENDING 0x0020
  1141. #define LVS_SHAREIMAGELISTS 0x0040
  1142. #define LVS_NOLABELWRAP 0x0080
  1143. #define LVS_AUTOARRANGE 0x0100
  1144. #define LVS_EDITLABELS 0x0200
  1145. #define LVS_NOITEMDATA 0x1000
  1146. #define LVS_NOSCROLL 0x2000
  1147. /// the fields below are reserved for style specific settings.
  1148. #define LVS_TYPESTYLEMASK 0xfc00 // the mask for all these styles
  1149. // Large icon.
  1150. #define LVS_ALIGNTOP 0x0000
  1151. #define LVS_ALIGNBOTTOM 0x0400
  1152. #define LVS_ALIGNLEFT 0x0800
  1153. #define LVS_ALIGNRIGHT 0x0c00
  1154. #define LVS_ALIGNMASK 0x0c00
  1155. // Report view.
  1156. #define LVS_OWNERDRAWFIXED 0x0400
  1157. #define LVS_NOCOLUMNHEADER 0x4000
  1158. #define LVS_NOSORTHEADER 0x8000
  1159. // COLORREF ListView_GetBkColor(HWND hwnd);
  1160. #define LVM_GETBKCOLOR (LVM_FIRST + 0)
  1161. #define ListView_GetBkColor(hwnd) \
  1162. (COLORREF)SendMessage((hwnd), LVM_GETBKCOLOR, 0, 0L)
  1163. // BOOL ListView_SetBkColor(HWND hwnd, COLORREF clrBk);
  1164. #define LVM_SETBKCOLOR (LVM_FIRST + 1)
  1165. #define ListView_SetBkColor(hwnd, clrBk) \
  1166. (BOOL)SendMessage((hwnd), LVM_SETBKCOLOR, 0, (LPARAM)(COLORREF)(clrBk))
  1167. // HIMAGELIST ListView_GetImageList(HWND hwnd, int iImageList);
  1168. #define LVM_GETIMAGELIST (LVM_FIRST + 2)
  1169. #define ListView_GetImageList(hwnd, iImageList) \
  1170. (HIMAGELIST)SendMessage((hwnd), LVM_GETIMAGELIST, (WPARAM)(INT)(iImageList), 0L)
  1171. #define LVSIL_NORMAL 0
  1172. #define LVSIL_SMALL 1
  1173. #define LVSIL_STATE 2
  1174. // HIMAGELIST ListView_SetImageList(HWND hwnd, HIMAGELIST himl, int iImageList);
  1175. #define LVM_SETIMAGELIST (LVM_FIRST + 3)
  1176. #define ListView_SetImageList(hwnd, himl, iImageList) \
  1177. (HIMAGELIST)(UINT)SendMessage((hwnd), LVM_SETIMAGELIST, (WPARAM)(iImageList), (LPARAM)(UINT)(HIMAGELIST)(himl))
  1178. // int ListView_GetItemCount(HWND hwnd);
  1179. #define LVM_GETITEMCOUNT (LVM_FIRST + 4)
  1180. #define ListView_GetItemCount(hwnd) \
  1181. (int)SendMessage((hwnd), LVM_GETITEMCOUNT, 0, 0L)
  1182. // ListView Item structure
  1183. #define LVIF_TEXT 0x0001 // LV_ITEM.mask flags (indicate valid fields in LV_ITEM)
  1184. #define LVIF_IMAGE 0x0002
  1185. #define LVIF_PARAM 0x0004
  1186. #define LVIF_STATE 0x0008
  1187. // State flags
  1188. #define LVIS_FOCUSED 0x0001 // LV_ITEM.state flags
  1189. #define LVIS_SELECTED 0x0002
  1190. #define LVIS_CUT 0x0004 // LVIS_MARKED
  1191. #define LVIS_DROPHILITED 0x0008
  1192. #define LVIS_DISABLED 0x0010
  1193. #define LVIS_HIDDEN 0x0020
  1194. #define LVIS_LINK 0x0040
  1195. #define LVIS_OVERLAYMASK 0x0F00 // used as ImageList overlay image indexes
  1196. #define LVIS_STATEIMAGEMASK 0xF000 // client bits for state image drawing
  1197. #define LVIS_USERMASK LVIS_STATEIMAGEMASK // BUGBUG: remove me.
  1198. #define INDEXTOSTATEIMAGEMASK(i) ((i) << 12)
  1199. typedef struct _LV_ITEM
  1200. {
  1201. UINT mask; // LVIF_ flags
  1202. int iItem;
  1203. int iSubItem;
  1204. UINT state; // LVIS_ flags
  1205. UINT stateMask; // LVIS_ flags (valid bits in state)
  1206. LPSTR pszText;
  1207. int cchTextMax;
  1208. int iImage;
  1209. LPARAM lParam;
  1210. } LV_ITEM;
  1211. // Values used to cause text/image GETDISPINFO callbacks
  1212. #define LPSTR_TEXTCALLBACK ((LPSTR)-1L)
  1213. #define I_IMAGECALLBACK (-1)
  1214. // BOOL ListView_GetItem(HWND hwnd, LV_ITEM FAR* pitem);
  1215. #define LVM_GETITEM (LVM_FIRST + 5)
  1216. #define ListView_GetItem(hwnd, pitem) \
  1217. (BOOL)SendMessage((hwnd), LVM_GETITEM, 0, (LPARAM)(LV_ITEM FAR*)(pitem))
  1218. // Sets items and subitems.
  1219. //
  1220. // BOOL ListView_SetItem(HWND hwnd, const LV_ITEM FAR* pitem);
  1221. #define LVM_SETITEM (LVM_FIRST + 6)
  1222. #define ListView_SetItem(hwnd, pitem) \
  1223. (BOOL)SendMessage((hwnd), LVM_SETITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  1224. // int ListView_InsertItem(HWND hwnd, const LV_ITEM FAR* pitem);
  1225. #define LVM_INSERTITEM (LVM_FIRST + 7)
  1226. #define ListView_InsertItem(hwnd, pitem) \
  1227. (int)SendMessage((hwnd), LVM_INSERTITEM, 0, (LPARAM)(const LV_ITEM FAR*)(pitem))
  1228. // Deletes the specified item along with all its subitems.
  1229. //
  1230. // BOOL ListView_DeleteItem(HWND hwnd, int i);
  1231. #define LVM_DELETEITEM (LVM_FIRST + 8)
  1232. #define ListView_DeleteItem(hwnd, i) \
  1233. (BOOL)SendMessage((hwnd), LVM_DELETEITEM, (WPARAM)(int)(i), 0L)
  1234. // BOOL ListView_DeleteAllItems(HWND hwnd);
  1235. #define LVM_DELETEALLITEMS (LVM_FIRST + 9)
  1236. #define ListView_DeleteAllItems(hwnd) \
  1237. (BOOL)SendMessage((hwnd), LVM_DELETEALLITEMS, 0, 0L)
  1238. // UINT ListView_GetCallbackMask(HWND hwnd);
  1239. #define LVM_GETCALLBACKMASK (LVM_FIRST + 10)
  1240. #define ListView_GetCallbackMask(hwnd) \
  1241. (BOOL)SendMessage((hwnd), LVM_GETCALLBACKMASK, 0, 0)
  1242. // BOOL ListView_SetCallbackMask(HWND hwnd, UINT mask);
  1243. #define LVM_SETCALLBACKMASK (LVM_FIRST + 11)
  1244. #define ListView_SetCallbackMask(hwnd, mask) \
  1245. (BOOL)SendMessage((hwnd), LVM_SETCALLBACKMASK, (WPARAM)(UINT)(mask), 0)
  1246. // ListView_GetNextItem flags (can be used in combination)
  1247. #define LVNI_ALL 0x0000
  1248. #define LVNI_FOCUSED 0x0001 // return only focused item
  1249. #define LVNI_SELECTED 0x0002 // return only selected items
  1250. #define LVNI_CUT 0x0004 // return only marked items
  1251. #define LVNI_DROPHILITED 0x0008 // return only drophilited items
  1252. #define LVNI_HIDDEN 0x0010 // return only hidden items
  1253. #define LVNI_PREVIOUS 0x0020 // Go backwards
  1254. #define LVNI_ABOVE 0x0100 // return item geometrically above
  1255. #define LVNI_BELOW 0x0200 // "" below
  1256. #define LVNI_TOLEFT 0x0400 // "" to left
  1257. #define LVNI_TORIGHT 0x0800 // "" to right (NOTE: these four are
  1258. // mutually exclusive, but
  1259. // can be used with other LVNI's)
  1260. // int ListView_GetNextItem(HWND hwnd, int i, UINT flags);
  1261. #define LVM_GETNEXTITEM (LVM_FIRST + 12)
  1262. #define ListView_GetNextItem(hwnd, i, flags) \
  1263. (int)SendMessage((hwnd), LVM_GETNEXTITEM, (WPARAM)(int)(i), MAKELPARAM((flags), 0))
  1264. // ListView_FindInfo definitions
  1265. #define LVFI_PARAM 0x0001
  1266. #define LVFI_STRING 0x0002
  1267. #define LVFI_SUBSTRING 0x0004
  1268. #define LVFI_PARTIAL 0x0008
  1269. #define LVFI_NOCASE 0x0010
  1270. #define LVFI_WRAP 0x0020
  1271. typedef struct _LV_FINDINFO
  1272. {
  1273. UINT flags;
  1274. LPCSTR psz;
  1275. LPARAM lParam;
  1276. } LV_FINDINFO;
  1277. // int ListView_FindItem(HWND hwnd, int iStart, const LV_FINDINFO FAR* plvfi);
  1278. #define LVM_FINDITEM (LVM_FIRST + 13)
  1279. #define ListView_FindItem(hwnd, iStart, plvfi) \
  1280. (int)SendMessage((hwnd), LVM_FINDITEM, (WPARAM)(int)(iStart), (LPARAM)(const LV_FINDINFO FAR*)(plvfi))
  1281. #define LVIR_BOUNDS 0
  1282. #define LVIR_ICON 1
  1283. #define LVIR_LABEL 2
  1284. // Rectangle bounding all or part of item, based on LVIR_* code. Rect is returned in view coords
  1285. // BOOL ListView_GetItemRect(HWND hwndLV, int i, RECT FAR* prc, int code);
  1286. #define LVM_GETITEMRECT (LVM_FIRST + 14)
  1287. #define ListView_GetItemRect(hwnd, i, prc, code) \
  1288. ((prc)->left = (code), (BOOL)SendMessage((hwnd), LVM_GETITEMRECT, (WPARAM)(int)(i), (LPARAM)(RECT FAR*)(prc)))
  1289. // Move top-left corner of item to (x, y), specified in view rect relative coords
  1290. // (icon and small view only)
  1291. // BOOL ListView_SetItemPosition(HWND hwndLV, int i, int x, int y);
  1292. #define LVM_SETITEMPOSITION (LVM_FIRST + 15)
  1293. #define ListView_SetItemPosition(hwndLV, i, x, y) \
  1294. (BOOL)SendMessage((hwndLV), LVM_SETITEMPOSITION, (WPARAM)(int)(i), MAKELPARAM((x), (y)))
  1295. // BOOL ListView_GetItemPosition(HWND hwndLV, int i, POINT FAR* ppt);
  1296. #define LVM_GETITEMPOSITION (LVM_FIRST + 16)
  1297. #define ListView_GetItemPosition(hwndLV, i, ppt) \
  1298. (BOOL)SendMessage((hwndLV), LVM_GETITEMPOSITION, (WPARAM)(int)(i), (LPARAM)(POINT FAR*)(ppt))
  1299. // Get column width of string
  1300. // int ListView_GetStringWidth(HWND hwndLV, LPCSTR psz);
  1301. #define LVM_GETSTRINGWIDTH (LVM_FIRST + 17)
  1302. #define ListView_GetStringWidth(hwndLV, psz) \
  1303. (int)SendMessage((hwndLV), LVM_GETSTRINGWIDTH, 0, (LPARAM)(LPCSTR)(psz))
  1304. // Hit test item. Returns item at (x,y), or -1 if not on an item.
  1305. // Combination of LVHT_ values *pflags, indicating where the cursor
  1306. // is relative to edges of ListView window (above, below, right, left)
  1307. // or whether (x, y) is over icon, label, or inside window but not on item.
  1308. // int ListView_HitTest(HWND hwndLV, LV_HITTESTINFO FAR* pinfo);
  1309. // ItemHitTest flag values
  1310. #define LVHT_NOWHERE 0x0001
  1311. #define LVHT_ONITEMICON 0x0002
  1312. #define LVHT_ONITEMLABEL 0x0004
  1313. #define LVHT_ONITEMSTATEICON 0x0008
  1314. #define LVHT_ONITEM (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON)
  1315. #define LVHT_ABOVE 0x0008
  1316. #define LVHT_BELOW 0x0010
  1317. #define LVHT_TORIGHT 0x0020
  1318. #define LVHT_TOLEFT 0x0040
  1319. typedef struct _LV_HITTESTINFO
  1320. {
  1321. POINT pt; // in: client coords
  1322. UINT flags; // out: LVHT_ flags
  1323. int iItem; // out: item
  1324. } LV_HITTESTINFO;
  1325. // int ListView_HitTest(HWND hwndLV, LV_HITTESTINFO FAR* pinfo);
  1326. #define LVM_HITTEST (LVM_FIRST + 18)
  1327. #define ListView_HitTest(hwndLV, pinfo) \
  1328. (int)SendMessage((hwndLV), LVM_HITTEST, 0, (LPARAM)(LV_HITTESTINFO FAR*)(pinfo))
  1329. // Return view rectangle, relative to window
  1330. // BOOL ListView_GetViewRect(HWND hwndLV, RECT FAR* prcVis);
  1331. // Scroll an item into view if not wholly or partially visible
  1332. // BOOL ListView_EnsureVisible(HWND hwndLV, int i, BOOL fPartialOK);
  1333. #define LVM_ENSUREVISIBLE (LVM_FIRST + 19)
  1334. #define ListView_EnsureVisible(hwndLV, i, fPartialOK) \
  1335. (BOOL)SendMessage((hwndLV), LVM_ENSUREVISIBLE, (WPARAM)(int)(i), MAKELPARAM((fPartialOK), 0))
  1336. // Scroll listview -- offsets origin of view rectangle by dx, dy
  1337. // BOOL ListView_Scroll(HWND hwndLV, int dx, int dy);
  1338. #define LVM_SCROLL (LVM_FIRST + 20)
  1339. #define ListView_Scroll(hwndLV, dx, dy) \
  1340. (BOOL)SendMessage((hwndLV), LVM_SCROLL, 0, MAKELPARAM((dx), (dy)))
  1341. // Force eventual redraw of range of items (redraw doesn't occur
  1342. // until WM_PAINT processed -- call UpdateWindow() after to redraw right away)
  1343. // BOOL ListView_RedrawItems(HWND hwndLV, int iFirst, int iLast);
  1344. #define LVM_REDRAWITEMS (LVM_FIRST + 21)
  1345. #define ListView_RedrawItems(hwndLV, iFirst, iLast) \
  1346. (BOOL)SendMessage((hwndLV), LVM_REDRAWITEMS, 0, MAKELPARAM((iFirst), (iLast)))
  1347. // Arrange style
  1348. #define LVA_DEFAULT 0x0000
  1349. #define LVA_ALIGNLEFT 0x0001
  1350. #define LVA_ALIGNTOP 0x0002
  1351. #define LVA_ALIGNRIGHT 0x0003
  1352. #define LVA_ALIGNBOTTOM 0x0004
  1353. #define LVA_SNAPTOGRID 0x0005
  1354. #define LVA_SORTASCENDING 0x0100 // can be used in combo with above LVA_* values
  1355. #define LVA_SORTDESCENDING 0x0200 // ""
  1356. // Arrange icons according to LVA_* code
  1357. // BOOL ListView_Arrange(HWND hwndLV, UINT code);
  1358. #define LVM_ARRANGE (LVM_FIRST + 22)
  1359. #define ListView_Arrange(hwndLV, code) \
  1360. (BOOL)SendMessage((hwndLV), LVM_ARRANGE, (WPARAM)(UINT)(code), 0L)
  1361. // Begin editing the label of a control. Implicitly selects and focuses
  1362. // item. Send WM_CANCELMODE to cancel.
  1363. // HWND ListView_EditLabel(HWND hwndLV, int i);
  1364. #define LVM_EDITLABEL (LVM_FIRST + 23)
  1365. #define ListView_EditLabel(hwndLV, i) \
  1366. (HWND)SendMessage((hwndLV), LVM_EDITLABEL, (WPARAM)(int)(i), 0L)
  1367. // Return edit control being used for editing. Subclass OK, but
  1368. // don't destroy. Will be destroyed when editing is finished.
  1369. //HWND ListView_GetEditControl(HWND hwndLV);
  1370. #define LVM_GETEDITCONTROL (LVM_FIRST + 24)
  1371. #define ListView_GetEditControl(hwndLV) \
  1372. (HWND)SendMessage((hwndLV), LVM_GETEDITCONTROL, 0, 0L)
  1373. typedef struct _LV_COLUMN
  1374. {
  1375. UINT mask;
  1376. int fmt;
  1377. int cx;
  1378. LPSTR pszText;
  1379. int cchTextMax;
  1380. int iSubItem; // subitem to display
  1381. } LV_COLUMN;
  1382. // LV_COLUMN mask values
  1383. #define LVCF_FMT 0x0001
  1384. #define LVCF_WIDTH 0x0002
  1385. #define LVCF_TEXT 0x0004
  1386. #define LVCF_SUBITEM 0x0008
  1387. // Column format codes
  1388. #define LVCFMT_LEFT 0
  1389. #define LVCFMT_RIGHT 1
  1390. #define LVCFMT_CENTER 2
  1391. // Set/Query column info
  1392. // BOOL ListView_GetColumn(HWND hwndLV, int iCol, LV_COLUMN FAR* pcol);
  1393. #define LVM_GETCOLUMN (LVM_FIRST + 25)
  1394. #define ListView_GetColumn(hwnd, iCol, pcol) \
  1395. (BOOL)SendMessage((hwnd), LVM_GETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(LV_COLUMN FAR*)(pcol))
  1396. // BOOL ListView_SetColumn(HWND hwndLV, int iCol, LV_COLUMN FAR* pcol);
  1397. #define LVM_SETCOLUMN (LVM_FIRST + 26)
  1398. #define ListView_SetColumn(hwnd, iCol, pcol) \
  1399. (BOOL)SendMessage((hwnd), LVM_SETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  1400. // insert/delete report view column
  1401. // int ListView_InsertColumn(HWND hwndLV, int iCol, const LV_COLUMN FAR* pcol);
  1402. #define LVM_INSERTCOLUMN (LVM_FIRST + 27)
  1403. #define ListView_InsertColumn(hwnd, iCol, pcol) \
  1404. (int)SendMessage((hwnd), LVM_INSERTCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN FAR*)(pcol))
  1405. // BOOL ListView_DeleteColumn(HWND hwndLV, int iCol);
  1406. #define LVM_DELETECOLUMN (LVM_FIRST + 28)
  1407. #define ListView_DeleteColumn(hwnd, iCol) \
  1408. (BOOL)SendMessage((hwnd), LVM_DELETECOLUMN, (WPARAM)(int)(iCol), 0)
  1409. #define LVM_GETCOLUMNWIDTH (LVM_FIRST + 29)
  1410. #define ListView_GetColumnWidth(hwnd, iCol) \
  1411. (int)SendMessage((hwnd), LVM_GETCOLUMNWIDTH, (WPARAM)(int)(iCol), 0)
  1412. #define LVSCW_AUTOSIZE -1
  1413. #define LVSCW_AUTOSIZE_USEHEADER -2
  1414. #define LVM_SETCOLUMNWIDTH (LVM_FIRST + 30)
  1415. #define ListView_SetColumnWidth(hwnd, iCol, cx) \
  1416. (BOOL)SendMessage((hwnd), LVM_SETCOLUMNWIDTH, (WPARAM)(int)(iCol), MAKELPARAM((cx), 0))
  1417. // HIMAGELIST ListView_CreateDragImage(HWND hwndLV, int iItem, LPPOINT lpptUpLeft);
  1418. #define LVM_CREATEDRAGIMAGE (LVM_FIRST + 33)
  1419. #define ListView_CreateDragImage(hwnd, i, lpptUpLeft) \
  1420. (HIMAGELIST)SendMessage((hwnd), LVM_CREATEDRAGIMAGE, (WPARAM)(int)(i), (LPARAM)(LPPOINT)(lpptUpLeft))
  1421. // BOOL ListView_GetViewRect(HWND hwndLV, RECT FAR* prc);
  1422. #define LVM_GETVIEWRECT (LVM_FIRST + 34)
  1423. #define ListView_GetViewRect(hwnd, prc) \
  1424. (BOOL)SendMessage((hwnd), LVM_GETVIEWRECT, 0, (LPARAM)(RECT FAR*)(prc))
  1425. // get/set text and textbk color for text drawing. these override
  1426. // the standard window/windowtext settings. they do NOT override
  1427. // when drawing selected text.
  1428. // COLORREF ListView_GetTextColor(HWND hwnd);
  1429. #define LVM_GETTEXTCOLOR (LVM_FIRST + 35)
  1430. #define ListView_GetTextColor(hwnd) \
  1431. (COLORREF)SendMessage((hwnd), LVM_GETTEXTCOLOR, 0, 0L)
  1432. // BOOL ListView_SetTextColor(HWND hwnd, COLORREF clrText);
  1433. #define LVM_SETTEXTCOLOR (LVM_FIRST + 36)
  1434. #define ListView_SetTextColor(hwnd, clrText) \
  1435. (BOOL)SendMessage((hwnd), LVM_SETTEXTCOLOR, 0, (LPARAM)(COLORREF)(clrText))
  1436. // COLORREF ListView_GetTextBkColor(HWND hwnd);
  1437. #define LVM_GETTEXTBKCOLOR (LVM_FIRST + 37)
  1438. #define ListView_GetTextBkColor(hwnd) \
  1439. (COLORREF)SendMessage((hwnd), LVM_GETTEXTBKCOLOR, 0, 0L)
  1440. // BOOL ListView_SetTextBkColor(HWND hwnd, COLORREF clrTextBk);
  1441. #define LVM_SETTEXTBKCOLOR (LVM_FIRST + 38)
  1442. #define ListView_SetTextBkColor(hwnd, clrTextBk) \
  1443. (BOOL)SendMessage((hwnd), LVM_SETTEXTBKCOLOR, 0, (LPARAM)(COLORREF)(clrTextBk))
  1444. // messages for getting the index of the first visible item
  1445. #define LVM_GETTOPINDEX (LVM_FIRST + 39)
  1446. #define ListView_GetTopIndex(hwndLV, ppt) \
  1447. (int)SendMessage((hwndLV), LVM_GETTOPINDEX, 0, 0)
  1448. // Message for getting the count of items per page
  1449. #define LVM_GETCOUNTPERPAGE (LVM_FIRST + 40)
  1450. #define ListView_GetCountPerPage(hwndLV, ppt) \
  1451. (int)SendMessage((hwndLV), LVM_GETCOUNTPERPAGE, 0, 0)
  1452. // Message for getting the listview origin, which is needed for SetItemPos...
  1453. #define LVM_GETORIGIN (LVM_FIRST + 41)
  1454. #define ListView_GetOrigin(hwndLV, ppt) \
  1455. (BOOL)SendMessage((hwndLV), LVM_GETORIGIN, (WPARAM)0, (LPARAM)(POINT FAR*)(ppt))
  1456. // Message for getting the count of items per page
  1457. #define LVM_UPDATE (LVM_FIRST + 42)
  1458. #define ListView_Update(hwndLV, i) \
  1459. (BOOL)SendMessage((hwndLV), LVM_UPDATE, (WPARAM)i, 0L)
  1460. // set and item's state. this macro will return VOID. but the
  1461. // message returns BOOL success.
  1462. #define LVM_SETITEMSTATE (LVM_FIRST + 43)
  1463. #define ListView_SetItemState(hwndLV, i, data, mask) \
  1464. { LV_ITEM lvi;\
  1465. lvi.stateMask = mask;\
  1466. lvi.state = data;\
  1467. SendMessage((hwndLV), LVM_SETITEMSTATE, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&lvi);\
  1468. }
  1469. // get the item's state
  1470. #define LVM_GETITEMSTATE (LVM_FIRST + 44)
  1471. #define ListView_GetItemState(hwndLV, i, mask) \
  1472. (UINT)SendMessage((hwndLV), LVM_GETITEMSTATE, (WPARAM)i, (LPARAM)mask)
  1473. // get the item text.
  1474. // if you want the int return value of how the buff size, you call it yourself.
  1475. #define LVM_GETITEMTEXT (LVM_FIRST + 45)
  1476. #define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_) \
  1477. { LV_ITEM lvi;\
  1478. lvi.iSubItem = iSubItem_;\
  1479. lvi.cchTextMax = cchTextMax_;\
  1480. lvi.pszText = pszText_;\
  1481. SendMessage((hwndLV), LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&lvi);\
  1482. }
  1483. // get the item text.
  1484. // if you want the int return value (BOOL) success do it yourself
  1485. #define LVM_SETITEMTEXT (LVM_FIRST + 46)
  1486. #define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_) \
  1487. { LV_ITEM lvi;\
  1488. lvi.iSubItem = iSubItem_;\
  1489. lvi.pszText = pszText_;\
  1490. SendMessage((hwndLV), LVM_SETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM FAR *)&lvi);\
  1491. }
  1492. // tell the listview that you are going to add nItems lot of items
  1493. #define LVM_SETITEMCOUNT (LVM_FIRST + 47)
  1494. #define ListView_SetItemCount(hwndLV, cItems) \
  1495. SendMessage((hwndLV), LVM_SETITEMCOUNT, (WPARAM)cItems, 0)
  1496. typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM);
  1497. // tell the listview to resort the items
  1498. #define LVM_SORTITEMS (LVM_FIRST + 48)
  1499. #define ListView_SortItems(hwndLV, _pfnCompare, _lPrm) \
  1500. (BOOL)SendMessage((hwndLV), LVM_SORTITEMS, (WPARAM)(LPARAM)_lPrm, \
  1501. (LPARAM)(PFNLVCOMPARE)_pfnCompare)
  1502. // void ListView_SetItemPosition(HWND hwndLV, int i, int x, int y);
  1503. #define LVM_SETITEMPOSITION32 (LVM_FIRST + 49)
  1504. #define ListView_SetItemPosition32(hwndLV, i, x, y) \
  1505. { POINT ptNewPos = {x,y}; \
  1506. SendMessage((hwndLV), LVM_SETITEMPOSITION32, (WPARAM)(int)(i), (LPARAM)&ptNewPos); \
  1507. }
  1508. // get the number of items selected
  1509. #define LVM_GETSELECTEDCOUNT (LVM_FIRST + 50)
  1510. #define ListView_GetSelectedCount(hwndLV) \
  1511. (UINT)SendMessage((hwndLV), LVM_GETSELECTEDCOUNT, 0, 0L)
  1512. #define LVM_GETITEMSPACING (LVM_FIRST + 51)
  1513. #define ListView_GetItemSpacing(hwndLV, fSmall) \
  1514. (DWORD)SendMessage((hwndLV), LVM_GETITEMSPACING, fSmall, 0L)
  1515. // ListView notification codes
  1516. // Structure used by all ListView control notifications.
  1517. // Not all fields supply useful info for all notifications:
  1518. // iItem will be -1 and others 0 if not used.
  1519. // Some return a BOOL, too.
  1520. //
  1521. typedef struct _NM_LISTVIEW
  1522. {
  1523. NMHDR hdr;
  1524. int iItem;
  1525. int iSubItem;
  1526. UINT uNewState; // Combination of LVIS_* (if uChanged & LVIF_STATE)
  1527. UINT uOldState; // Combination of LVIS_*
  1528. UINT uChanged; // Combination of LVIF_* indicating what changed
  1529. POINT ptAction; // Only valid for LVN_BEGINDRAG and LVN_BEGINRDRAG
  1530. LPARAM lParam; // Only valid for LVN_DELETEITEM
  1531. } NM_LISTVIEW;
  1532. #define LVN_ITEMCHANGING (LVN_FIRST-0) // lParam -> NM_LISTVIEW: item changing. Return FALSE to disallow
  1533. #define LVN_ITEMCHANGED (LVN_FIRST-1) // item changed.
  1534. #define LVN_INSERTITEM (LVN_FIRST-2)
  1535. #define LVN_DELETEITEM (LVN_FIRST-3)
  1536. #define LVN_DELETEALLITEMS (LVN_FIRST-4)
  1537. #define LVN_BEGINLABELEDIT (LVN_FIRST-5) // lParam -> LV_DISPINFO: start of label editing
  1538. #define LVN_ENDLABELEDIT (LVN_FIRST-6) // lParam -> LV_DISPINFO: end of label editing
  1539. // (iItem == -1 if cancel)
  1540. //(LVN_FIRST-7) not used
  1541. #define LVN_COLUMNCLICK (LVN_FIRST-8) // column identified by iItem was clicked
  1542. #define LVN_BEGINDRAG (LVN_FIRST-9) // Start of drag operation requested
  1543. // (return FALSE if the app handles it)
  1544. #define LVN_ENDDRAG (LVN_FIRST-10) // End of dragging operation.
  1545. #define LVN_BEGINRDRAG (LVN_FIRST-11) // Start of button 2 dragging
  1546. #define LVN_ENDRDRAG (LVN_FIRST-12) // End of button 2 drag (not used yet)
  1547. #ifdef PW2
  1548. #define LVN_PEN (LVN_FIRST-20) // pen notifications
  1549. #endif //PW2
  1550. // LVN_DISPINFO notification
  1551. #define LVN_GETDISPINFO (LVN_FIRST-50) // lParam -> LV_DISPINFO
  1552. #define LVN_SETDISPINFO (LVN_FIRST-51) // lParam -> LV_DISPINFO
  1553. typedef struct _LV_DISPINFO {
  1554. NMHDR hdr;
  1555. LV_ITEM item;
  1556. } LV_DISPINFO;
  1557. // LVN_KEYDOWN notification
  1558. #define LVN_KEYDOWN (LVN_FIRST-55)
  1559. typedef struct _LV_KEYDOWN
  1560. {
  1561. NMHDR hdr;
  1562. WORD wVKey;
  1563. UINT flags;
  1564. } LV_KEYDOWN;
  1565. // ====== TREEVIEW APIs =================================================
  1566. //
  1567. // Class name: SysTreeView (WC_TREEVIEW)
  1568. //
  1569. // The SysTreeView control provides for a group of items which are
  1570. // displayed in a hierarchical organization. Each item may contain
  1571. // independent "sub-item" entries which are displayed below and indented
  1572. // from the parent item.
  1573. //
  1574. // Operation of this control is similar to the SysListView control above,
  1575. // except that sub-items are distinct entries, not supporting text elements
  1576. // belonging to the owning object (which is the case for the Report View
  1577. // mode of the SysListView).
  1578. //
  1579. // There are notifications that allow applications to determine when an item
  1580. // has been clicked or double clicked, caption text changes have occured,
  1581. // drag tracking is occuring, widths of columns have changed, node items
  1582. // are expanded, etc.
  1583. //
  1584. // NOTE: All "messages" below are documented as APIs; eventually these
  1585. // will be changed to window messages, and corresponding macros will be
  1586. // written that have the same signature as the APIs shown below.
  1587. //
  1588. #ifdef WIN32
  1589. #define WC_TREEVIEW "SysTreeView32"
  1590. #else
  1591. #define WC_TREEVIEW "SysTreeView"
  1592. #endif
  1593. // TreeView window styles
  1594. #define TVS_HASBUTTONS 0x0001 // draw "plus" & "minus" sign on nodes with children
  1595. #define TVS_HASLINES 0x0002 // draw lines between nodes
  1596. #define TVS_LINESATROOT 0x0004
  1597. #define TVS_EDITLABELS 0x0008 // alow text edit in place
  1598. #define TVS_DISABLEDRAGDROP 0x0010 // disable draggine notification of nodes
  1599. #define TVS_SHOWSELALWAYS 0x0020
  1600. typedef struct _TREEITEM FAR* HTREEITEM;
  1601. #define TVIF_TEXT 0x0001 // TV_ITEM.mask flags
  1602. #define TVIF_IMAGE 0x0002
  1603. #define TVIF_PARAM 0x0004
  1604. #define TVIF_STATE 0x0008
  1605. #define TVIF_HANDLE 0x0010
  1606. #define TVIF_SELECTEDIMAGE 0x0020
  1607. #define TVIF_CHILDREN 0x0040
  1608. // State flags
  1609. #define TVIS_FOCUSED 0x0001 // TV_ITEM.state flags
  1610. #define TVIS_SELECTED 0x0002
  1611. #define TVIS_CUT 0x0004 // TVIS_MARKED
  1612. #define TVIS_DROPHILITED 0x0008
  1613. #define TVIS_DISABLED 0x0010
  1614. #define TVIS_EXPANDED 0x0020
  1615. #define TVIS_EXPANDEDONCE 0x0040
  1616. #define TVIS_OVERLAYMASK 0x0F00 // used as ImageList overlay image indexes
  1617. #define TVIS_STATEIMAGEMASK 0xF000
  1618. #define TVIS_USERMASK 0xF000
  1619. #define I_CHILDRENCALLBACK (-1) // cChildren value for children callback
  1620. typedef struct _TV_ITEM {
  1621. UINT mask; // TVIF_ flags
  1622. HTREEITEM hItem; // The item to be changed
  1623. UINT state; // TVIS_ flags
  1624. UINT stateMask; // TVIS_ flags (valid bits in state)
  1625. LPSTR pszText; // The text for this item
  1626. int cchTextMax; // The length of the pszText buffer
  1627. int iImage; // The index of the image for this item
  1628. int iSelectedImage; // the index of the selected imagex
  1629. int cChildren; // # of child nodes, I_CHILDRENCALLBACK for callback
  1630. LPARAM lParam; // App defined data
  1631. } TV_ITEM, FAR *LPTV_ITEM;
  1632. #define TVI_ROOT ((HTREEITEM)0xFFFF0000)
  1633. #define TVI_FIRST ((HTREEITEM)0xFFFF0001)
  1634. #define TVI_LAST ((HTREEITEM)0xFFFF0002)
  1635. #define TVI_SORT ((HTREEITEM)0xFFFF0003)
  1636. typedef struct _TV_INSERTSTRUCT {
  1637. HTREEITEM hParent; // a valid HTREEITEM or TVI_ value
  1638. HTREEITEM hInsertAfter; // a valid HTREEITEM or TVI_ value
  1639. TV_ITEM item;
  1640. } TV_INSERTSTRUCT, FAR *LPTV_INSERTSTRUCT;
  1641. #define TVM_INSERTITEM (TV_FIRST + 0)
  1642. #define TreeView_InsertItem(hwnd, lpis) \
  1643. (HTREEITEM)SendMessage((hwnd), TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT)(lpis))
  1644. #define TVM_DELETEITEM (TV_FIRST + 1)
  1645. #define TreeView_DeleteItem(hwnd, hitem) \
  1646. (BOOL)SendMessage((hwnd), TVM_DELETEITEM, 0, (LPARAM)(HTREEITEM)(hitem))
  1647. #define TreeView_DeleteAllItems(hwnd) \
  1648. (BOOL)SendMessage((hwnd), TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT)
  1649. #define TVM_EXPAND (TV_FIRST + 2)
  1650. #define TreeView_Expand(hwnd, hitem, code) \
  1651. (BOOL)SendMessage((hwnd), TVM_EXPAND, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  1652. // TreeView_Expand codes
  1653. #define TVE_COLLAPSE 0x0001
  1654. #define TVE_EXPAND 0x0002
  1655. #define TVE_TOGGLE 0x0003
  1656. #define TVE_COLLAPSERESET 0x8000 // remove all children when collapsing
  1657. #define TVM_GETITEMRECT (TV_FIRST + 4)
  1658. #define TreeView_GetItemRect(hwnd, hitem, prc, code) \
  1659. (*(HTREEITEM FAR *)prc = (hitem), (BOOL)SendMessage((hwnd), TVM_GETITEMRECT, (WPARAM)(code), (LPARAM)(RECT FAR*)(prc)))
  1660. #define TVM_GETCOUNT (TV_FIRST + 5)
  1661. #define TreeView_GetCount(hwnd) \
  1662. (UINT)SendMessage((hwnd), TVM_GETCOUNT, 0, 0)
  1663. #define TVM_GETINDENT (TV_FIRST + 6)
  1664. #define TreeView_GetIndent(hwnd) \
  1665. (UINT)SendMessage((hwnd), TVM_GETINDENT, 0, 0)
  1666. #define TVM_SETINDENT (TV_FIRST + 7)
  1667. #define TreeView_SetIndent(hwnd, indent) \
  1668. (BOOL)SendMessage((hwnd), TVM_SETINDENT, (WPARAM)indent, 0)
  1669. #define TVM_GETIMAGELIST (TV_FIRST + 8)
  1670. #define TreeView_GetImageList(hwnd, iImage) \
  1671. (HIMAGELIST)SendMessage((hwnd), TVM_GETIMAGELIST, iImage, 0)
  1672. #define TVSIL_NORMAL 0
  1673. #define TVSIL_STATE 2 // use TVIS_STATEIMAGEMASK as index into state imagelist
  1674. #define TVM_SETIMAGELIST (TV_FIRST + 9)
  1675. #define TreeView_SetImageList(hwnd, himl, iImage) \
  1676. (HIMAGELIST)SendMessage((hwnd), TVM_SETIMAGELIST, iImage, (LPARAM)(UINT)(HIMAGELIST)(himl))
  1677. #define TVM_GETNEXTITEM (TV_FIRST + 10)
  1678. #define TreeView_GetNextItem(hwnd, hitem, code) \
  1679. (HTREEITEM)SendMessage((hwnd), TVM_GETNEXTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  1680. // TreeView_GetNextItem & TreeView_SelectItem codes
  1681. #define TVGN_ROOT 0x0000 // GetNextItem()
  1682. #define TVGN_NEXT 0x0001 // GetNextItem()
  1683. #define TVGN_PREVIOUS 0x0002 // GetNextItem()
  1684. #define TVGN_PARENT 0x0003 // GetNextItem()
  1685. #define TVGN_CHILD 0x0004 // GetNextItem()
  1686. #define TVGN_FIRSTVISIBLE 0x0005 // GetNextItem() & SelectItem()
  1687. #define TVGN_NEXTVISIBLE 0x0006 // GetNextItem()
  1688. #define TVGN_PREVIOUSVISIBLE 0x0007 // GetNextItem()
  1689. #define TVGN_DROPHILITE 0x0008 // GetNextItem() & SelectItem()
  1690. #define TVGN_CARET 0x0009 // GetNextItem() & SelectItem()
  1691. #define TreeView_GetChild(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_CHILD)
  1692. #define TreeView_GetNextSibling(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_NEXT)
  1693. #define TreeView_GetPrevSibling(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUS)
  1694. #define TreeView_GetParent(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_PARENT)
  1695. #define TreeView_GetFirstVisible(hwnd) TreeView_GetNextItem(hwnd, NULL, TVGN_FIRSTVISIBLE)
  1696. #define TreeView_GetNextVisible(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTVISIBLE)
  1697. #define TreeView_GetPrevVisible(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUSVISIBLE)
  1698. #define TreeView_GetSelection(hwnd) TreeView_GetNextItem(hwnd, NULL, TVGN_CARET)
  1699. #define TreeView_GetDropHilight(hwnd) TreeView_GetNextItem(hwnd, NULL, TVGN_DROPHILITE)
  1700. #define TreeView_GetRoot(hwnd) TreeView_GetNextItem(hwnd, NULL, TVGN_ROOT)
  1701. #define TVM_SELECTITEM (TV_FIRST + 11)
  1702. #define TreeView_Select(hwnd, hitem, code) \
  1703. (HTREEITEM)SendMessage((hwnd), TVM_SELECTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem))
  1704. #define TreeView_SelectItem(hwnd, hitem) TreeView_Select(hwnd, hitem, TVGN_CARET)
  1705. #define TreeView_SelectDropTarget(hwnd, hitem) TreeView_Select(hwnd, hitem, TVGN_DROPHILITE)
  1706. #define TVM_GETITEM (TV_FIRST + 12)
  1707. #define TreeView_GetItem(hwnd, pitem) \
  1708. (BOOL)SendMessage((hwnd), TVM_GETITEM, 0, (LPARAM)(TV_ITEM FAR*)(pitem))
  1709. #define TVM_SETITEM (TV_FIRST + 13)
  1710. #define TreeView_SetItem(hwnd, pitem) \
  1711. (BOOL)SendMessage((hwnd), TVM_SETITEM, 0, (LPARAM)(const TV_ITEM FAR*)(pitem))
  1712. #define TVM_EDITLABEL (TV_FIRST + 14)
  1713. #define TreeView_EditLabel(hwnd, hitem) \
  1714. (HWND)SendMessage((hwnd), TVM_EDITLABEL, 0, (LPARAM)(HTREEITEM)(hitem))
  1715. #define TVM_GETEDITCONTROL (TV_FIRST + 15)
  1716. #define TreeView_GetEditControl(hwnd) \
  1717. (HWND)SendMessage((hwnd), TVM_GETEDITCONTROL, 0, 0)
  1718. #define TVM_GETVISIBLECOUNT (TV_FIRST + 16)
  1719. #define TreeView_GetVisibleCount(hwnd) \
  1720. (UINT)SendMessage((hwnd), TVM_GETVISIBLECOUNT, 0, 0)
  1721. #define TVM_HITTEST (TV_FIRST + 17)
  1722. #define TreeView_HitTest(hwnd, lpht) \
  1723. (HTREEITEM)SendMessage((hwnd), TVM_HITTEST, 0, (LPARAM)(LPTV_HITTESTINFO)(lpht))
  1724. typedef struct _TV_HITTESTINFO {
  1725. POINT pt; // in: client coords
  1726. UINT flags; // out: TVHT_ flags
  1727. HTREEITEM hItem; // out:
  1728. } TV_HITTESTINFO, FAR *LPTV_HITTESTINFO;
  1729. #define TVHT_NOWHERE 0x0001
  1730. #define TVHT_ONITEMICON 0x0002
  1731. #define TVHT_ONITEMLABEL 0x0004
  1732. #define TVHT_ONITEM (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON)
  1733. #define TVHT_ONITEMINDENT 0x0008
  1734. #define TVHT_ONITEMBUTTON 0x0010
  1735. #define TVHT_ONITEMRIGHT 0x0020
  1736. #define TVHT_ONITEMSTATEICON 0x0040
  1737. #define TVHT_ABOVE 0x0100
  1738. #define TVHT_BELOW 0x0200
  1739. #define TVHT_TORIGHT 0x0400
  1740. #define TVHT_TOLEFT 0x0800
  1741. #define TVM_CREATEDRAGIMAGE (TV_FIRST + 18)
  1742. #define TreeView_CreateDragImage(hwnd, hitem) \
  1743. (HIMAGELIST)SendMessage((hwnd), TVM_CREATEDRAGIMAGE, 0, (LPARAM)(HTREEITEM)(hitem))
  1744. #define TVM_SORTCHILDREN (TV_FIRST + 19)
  1745. #define TreeView_SortChildren(hwnd, hitem, recurse) \
  1746. (BOOL)SendMessage((hwnd), TVM_SORTCHILDREN, (WPARAM)recurse, (LPARAM)(HTREEITEM)(hitem))
  1747. #define TVM_ENSUREVISIBLE (TV_FIRST + 20)
  1748. #define TreeView_EnsureVisible(hwnd, hitem) \
  1749. (BOOL)SendMessage((hwnd), TVM_ENSUREVISIBLE, 0, (LPARAM)(HTREEITEM)(hitem))
  1750. #define TVM_SORTCHILDRENCB (TV_FIRST + 21)
  1751. #define TreeView_SortChildrenCB(hwnd, psort, recurse) \
  1752. (BOOL)SendMessage((hwnd), TVM_SORTCHILDRENCB, (WPARAM)recurse, \
  1753. (LPARAM)(LPTV_SORTCB)(psort))
  1754. typedef int (CALLBACK *PFNTVCOMPARE)(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  1755. typedef struct _TV_SORTCB
  1756. {
  1757. HTREEITEM hParent;
  1758. PFNTVCOMPARE lpfnCompare;
  1759. LPARAM lParam;
  1760. } TV_SORTCB, FAR *LPTV_SORTCB;
  1761. // common notificaton structure for WM_NOTIFY sent to parent
  1762. // some fields are only valid on some notify messages
  1763. typedef struct _NM_TREEVIEW {
  1764. NMHDR hdr;
  1765. UINT action; // notification specific action
  1766. TV_ITEM itemOld;
  1767. TV_ITEM itemNew;
  1768. POINT ptDrag;
  1769. } NM_TREEVIEW, FAR *LPNM_TREEVIEW;
  1770. #define TVN_SELCHANGING (TVN_FIRST-1)
  1771. #define TVN_SELCHANGED (TVN_FIRST-2)
  1772. // lParam -> NM_TREEVIEW
  1773. // NM_TREEVIEW.itemNew.hItem & NM_TREEVIEW.itemNew.lParam are valid
  1774. // NM_TREEVIEW.itemOld.hItem & NM_TREEVIEW.itemOld.lParam are valid
  1775. // NM_TREEVIEW.action is a TVE_ value indicating how the selcection changed
  1776. // TVN_SELCHANGING & TVN_SELCHANGED action values
  1777. #define TVC_UNKNOWN 0x0000
  1778. #define TVC_BYMOUSE 0x0001
  1779. #define TVC_BYKEYBOARD 0x0002
  1780. #define TVN_GETDISPINFO (TVN_FIRST-3)
  1781. #define TVN_SETDISPINFO (TVN_FIRST-4)
  1782. // lParam -> TV_DISPINFO structure
  1783. // TV_DISPINFO.item.hItem & TV_DISPINFO.item.lParam are valid
  1784. typedef struct _TV_DISPINFO {
  1785. NMHDR hdr;
  1786. TV_ITEM item;
  1787. } TV_DISPINFO;
  1788. #define TVN_ITEMEXPANDING (TVN_FIRST-5)
  1789. #define TVN_ITEMEXPANDED (TVN_FIRST-6)
  1790. // lParam -> NM_TREEVIEW
  1791. // NM_TREEVIEW.itemNew.hItem & NM_TREEVIEW.itemNew.state & NM_TREEVIEW.itemNew.lParam are valid
  1792. // NM_TREEVIEW.action is TVE_ action and flags
  1793. #define TVN_BEGINDRAG (TVN_FIRST-7)
  1794. #define TVN_BEGINRDRAG (TVN_FIRST-8)
  1795. // lParam -> NM_TREEVIEW
  1796. // NM_TREEVIEW.itemNew.hItem & NM_TREEVIEW.itemNew.lParam are valid
  1797. // NM_TREEVIEW.ptDrag is start of drag in client coords
  1798. #define TVN_DELETEITEM (TVN_FIRST-9)
  1799. // lParam -> NM_TREEVIEW
  1800. // NM_TREEVIEW.itemOld.hItem & NM_TREEVIEW.itemOld.lParam are valid
  1801. #define TVN_BEGINLABELEDIT (TVN_FIRST-10)
  1802. #define TVN_ENDLABELEDIT (TVN_FIRST-11)
  1803. // lParam -> NM_TREEVIEW
  1804. // TV_DISPINFO.item.hItem & TV_DISPINFO.item.state & TV_DISPINFO.item.lParam are valid
  1805. #define TVN_KEYDOWN (TVN_FIRST-12)
  1806. // lParam -> TV_KEYDOWN
  1807. typedef struct _TV_KEYDOWN {
  1808. NMHDR hdr;
  1809. WORD wVKey;
  1810. UINT flags;
  1811. } TV_KEYDOWN;
  1812. //============================================================================
  1813. //
  1814. // Class name: SysTabControl (WC_TABCONTROL)
  1815. //
  1816. #ifdef WIN32
  1817. #define WC_TABCONTROL "SysTabControl32"
  1818. #else
  1819. #define WC_TABCONTROL "SysTabControl"
  1820. #endif
  1821. // window styles to control tab control behavior
  1822. #define TCS_FORCEICONLEFT 0x0010 // 0nly for fixed width mode
  1823. #define TCS_FORCELABELLEFT 0x0020 // 0nly for fixed width mode
  1824. #define TCS_SHAREIMAGELISTS 0x0040
  1825. #define TCS_TABS 0x0000 // default
  1826. #define TCS_BUTTONS 0x0100
  1827. #define TCS_SINGLELINE 0x0000 // default
  1828. #define TCS_MULTILINE 0x0200
  1829. #define TCS_RIGHTJUSTIFY 0x0000 // default
  1830. #define TCS_FIXEDWIDTH 0x0400
  1831. #define TCS_RAGGEDRIGHT 0x0800
  1832. #define TCS_FOCUSONBUTTONDOWN 0x1000
  1833. #define TCS_OWNERDRAWFIXED 0x2000
  1834. #define TCS_TOOLTIPS 0x4000
  1835. #define TCS_FOCUSNEVER 0x8000
  1836. #define TCM_FIRST 0x1300 // Tab Control messages
  1837. // COLORREF TabCtrl_GetBkColor(HWND hwnd);
  1838. #define TCM_GETBKCOLOR (TCM_FIRST + 0)
  1839. #define TabCtrl_GetBkColor(hwnd) \
  1840. (COLORREF)SendMessage((hwnd), TCM_GETBKCOLOR, 0, 0L)
  1841. // BOOL TabCtrl_SetBkColor(HWND hwnd, COLORREF clrBk);
  1842. #define TCM_SETBKCOLOR (TCM_FIRST + 1)
  1843. #define TabCtrl_SetBkColor(hwnd, clrBk) \
  1844. (BOOL)SendMessage((hwnd), TCM_SETBKCOLOR, 0, (LPARAM)(COLORREF)(clrBk))
  1845. // HIMAGELIST TabCtrl_GetImageList(HWND hwnd);
  1846. #define TCM_GETIMAGELIST (TCM_FIRST + 2)
  1847. #define TabCtrl_GetImageList(hwnd) \
  1848. (HIMAGELIST)SendMessage((hwnd), TCM_GETIMAGELIST, 0, 0L)
  1849. // this returns the old image list (null if no previous)
  1850. // BOOL TabCtrl_SetImageList(HWND hwnd, HIMAGELIST himl);
  1851. #define TCM_SETIMAGELIST (TCM_FIRST + 3)
  1852. #define TabCtrl_SetImageList(hwnd, himl) \
  1853. (HIMAGELIST)SendMessage((hwnd), TCM_SETIMAGELIST, 0, (LPARAM)(UINT)(HIMAGELIST)(himl))
  1854. // int TabCtrl_GetItemCount(HWND hwnd);
  1855. #define TCM_GETITEMCOUNT (TCM_FIRST + 4)
  1856. #define TabCtrl_GetItemCount(hwnd) \
  1857. (int)SendMessage((hwnd), TCM_GETITEMCOUNT, 0, 0L)
  1858. // TabView Item structure
  1859. #define TCIF_TEXT 0x0001 // TabView mask flags
  1860. #define TCIF_IMAGE 0x0002
  1861. #define TCIF_PARAM 0x0008
  1862. typedef struct _TC_ITEMHEADER
  1863. {
  1864. UINT mask; // TCIF_ bits
  1865. UINT lpReserved1;
  1866. UINT lpReserved2;
  1867. LPSTR pszText;
  1868. int cchTextMax;
  1869. int iImage;
  1870. } TC_ITEMHEADER;
  1871. typedef struct _TC_ITEM
  1872. {
  1873. // This block must be identical to TC_TEIMHEADER
  1874. UINT mask; // TCIF_ bits
  1875. UINT lpReserved1;
  1876. UINT lpReserved2;
  1877. LPSTR pszText;
  1878. int cchTextMax;
  1879. int iImage;
  1880. LPARAM lParam;
  1881. } TC_ITEM;
  1882. // BOOL TabCtrl_GetItem(HWND hwnd, int iItem, TC_ITEM FAR* pitem);
  1883. #define TCM_GETITEM (TCM_FIRST + 5)
  1884. #define TabCtrl_GetItem(hwnd, iItem, pitem) \
  1885. (BOOL)SendMessage((hwnd), TCM_GETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  1886. // BOOL TabCtrl_SetItem(HWND hwnd, int iItem, TC_ITEM FAR* pitem);
  1887. #define TCM_SETITEM (TCM_FIRST + 6)
  1888. #define TabCtrl_SetItem(hwnd, iItem, pitem) \
  1889. (BOOL)SendMessage((hwnd), TCM_SETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM FAR*)(pitem))
  1890. // int TabCtrl_InsertItem(HWND hwnd, int iItem, const TC_ITEM FAR* pitem);
  1891. #define TCM_INSERTITEM (TCM_FIRST + 7)
  1892. #define TabCtrl_InsertItem(hwnd, iItem, pitem) \
  1893. (int)SendMessage((hwnd), TCM_INSERTITEM, (WPARAM)(int)iItem, (LPARAM)(const TC_ITEM FAR*)(pitem))
  1894. // Deletes the specified item along with all its subitems.
  1895. //
  1896. // BOOL TabCtrl_DeleteItem(HWND hwnd, int i);
  1897. #define TCM_DELETEITEM (TCM_FIRST + 8)
  1898. #define TabCtrl_DeleteItem(hwnd, i) \
  1899. (BOOL)SendMessage((hwnd), TCM_DELETEITEM, (WPARAM)(int)(i), 0L)
  1900. // BOOL TabCtrl_DeleteAllItems(HWND hwnd);
  1901. #define TCM_DELETEALLITEMS (TCM_FIRST + 9)
  1902. #define TabCtrl_DeleteAllItems(hwnd) \
  1903. (BOOL)SendMessage((hwnd), TCM_DELETEALLITEMS, 0, 0L)
  1904. // Rectangle bounding all or part of item, based on code. Rect is returned in view coords
  1905. // BOOL TabCtrl_GetItemRect(HWND hwndTC, int i, RECT FAR* prc);
  1906. #define TCM_GETITEMRECT (TCM_FIRST + 10)
  1907. #define TabCtrl_GetItemRect(hwnd, i, prc) \
  1908. (BOOL)SendMessage((hwnd), TCM_GETITEMRECT, (WPARAM)(int)(i), (LPARAM)(RECT FAR*)(prc))
  1909. // BOOL TabCtrl_GetCurSel(HWND hwndTC);
  1910. #define TCM_GETCURSEL (TCM_FIRST + 11)
  1911. #define TabCtrl_GetCurSel(hwnd) \
  1912. (int)SendMessage((hwnd), TCM_GETCURSEL, 0, 0)
  1913. #define TCM_SETCURSEL (TCM_FIRST + 12)
  1914. #define TabCtrl_SetCurSel(hwnd, i) \
  1915. (int)SendMessage((hwnd), TCM_SETCURSEL, (WPARAM)i, 0)
  1916. // ItemHitTest flag values
  1917. #define TCHT_NOWHERE 0x0001
  1918. #define TCHT_ONITEMICON 0x0002
  1919. #define TCHT_ONITEMLABEL 0x0004
  1920. #define TCHT_ONITEM (TCHT_ONITEMICON | TCHT_ONITEMLABEL)
  1921. typedef struct _TC_HITTESTINFO
  1922. {
  1923. POINT pt; // in
  1924. UINT flags; // out
  1925. } TC_HITTESTINFO, FAR * LPTC_HITTESTINFO;
  1926. // int TabCtrl_HitTest(HWND hwndTC, TC_HITTESTINFO FAR* pinfo);
  1927. #define TCM_HITTEST (TCM_FIRST + 13)
  1928. #define TabCtrl_HitTest(hwndTC, pinfo) \
  1929. (int)SendMessage((hwndTC), TCM_HITTEST, 0, (LPARAM)(TC_HITTESTINFO FAR*)(pinfo))
  1930. // Set the size of extra byte (abExtra[]) for each item.
  1931. #define TCM_SETITEMEXTRA (TCM_FIRST + 14)
  1932. #define TabCtrl_SetItemExtra(hwndTC, cb) \
  1933. (BOOL)SendMessage((hwndTC), TCM_SETITEMEXTRA, (WPARAM)(cb), 0L)
  1934. // get/set text and textbk color for text drawing. these override
  1935. // the standard window/windowtext settings. they do NOT override
  1936. // when drawing selected text.
  1937. // COLORREF TabCtrl_GetTextColor(HWND hwnd);
  1938. #define TCM_GETTEXTCOLOR (TCM_FIRST + 35)
  1939. #define TabCtrl_GetTextColor(hwnd) \
  1940. (COLORREF)SendMessage((hwnd), TCM_GETTEXTCOLOR, 0, 0L)
  1941. // BOOL TabCtrl_SetTextColor(HWND hwnd, COLORREF clrText);
  1942. #define TCM_SETTEXTCOLOR (TCM_FIRST + 36)
  1943. #define TabCtrl_SetTextColor(hwnd, clrText) \
  1944. (BOOL)SendMessage((hwnd), TCM_SETTEXTCOLOR, 0, (LPARAM)(COLORREF)(clrText))
  1945. // COLORREF TabCtrl_GetTextBkColor(HWND hwnd);
  1946. #define TCM_GETTEXTBKCOLOR (TCM_FIRST + 37)
  1947. #define TabCtrl_GetTextColor(hwnd) \
  1948. (COLORREF)SendMessage((hwnd), TCM_GETTEXTCOLOR, 0, 0L)
  1949. // BOOL TabCtrl_SetTextBkColor(HWND hwnd, COLORREF clrTextBk);
  1950. #define TCM_SETTEXTBKCOLOR (TCM_FIRST + 38)
  1951. #define TabCtrl_SetTextBkColor(hwnd, clrTextBk) \
  1952. (BOOL)SendMessage((hwnd), TCM_SETTEXTBKCOLOR, 0, (LPARAM)(COLORREF)(clrTextBk))
  1953. #define TCM_ADJUSTRECT (TCM_FIRST + 40)
  1954. #define TabCtrl_AdjustRect(hwnd, bLarger, prc) \
  1955. (void)SendMessage(hwnd, TCM_ADJUSTRECT, (WPARAM)(BOOL)bLarger, (LPARAM)(RECT FAR *)prc)
  1956. #define TCM_SETITEMSIZE (TCM_FIRST + 41)
  1957. #define TabCtrl_SetItemSize(hwnd, x, y) \
  1958. (DWORD)SendMessage((hwnd), TCM_SETITEMSIZE, 0, MAKELPARAM(x,y))
  1959. #define TCM_REMOVEIMAGE (TCM_FIRST + 42)
  1960. #define TabCtrl_RemoveImage(hwnd, i) \
  1961. (void)SendMessage((hwnd), TCM_REMOVEIMAGE, i, 0L)
  1962. #define TCM_SETPADDING (TCM_FIRST + 43)
  1963. #define TabCtrl_SetPadding(hwnd, cx, cy) \
  1964. (void)SendMessage((hwnd), TCM_SETPADDING, 0, MAKELPARAM(cx, cy))
  1965. #define TCM_GETROWCOUNT (TCM_FIRST + 44)
  1966. #define TabCtrl_GetRowCount(hwnd) \
  1967. (int)SendMessage((hwnd), TCM_GETROWCOUNT, 0, 0L)
  1968. /* all params are NULL
  1969. * returns the hwnd for tooltips control or NULL
  1970. */
  1971. #define TCM_GETTOOLTIPS (TCM_FIRST + 45)
  1972. #define TabCtrl_GetToolTips(hwnd) \
  1973. (HWND)SendMessage((hwnd), TCM_GETTOOLTIPS, 0, 0L)
  1974. /* wParam: HWND of ToolTips control to use
  1975. * lParam unused
  1976. */
  1977. #define TCM_SETTOOLTIPS (TCM_FIRST + 46)
  1978. #define TabCtrl_SetToolTips(hwnd, hwndTT) \
  1979. (void)SendMessage((hwnd), TCM_SETTOOLTIPS, (WPARAM)hwndTT, 0L)
  1980. // this returns the item with the current focus.. which might not be
  1981. // the currently selected item, if the user is in the process of selecting a new
  1982. // item
  1983. // BOOL TabCtrl_GetCurFocus(HWND hwndTC);
  1984. #define TCM_GETCURFOCUS (TCM_FIRST + 47)
  1985. #define TabCtrl_GetCurFocus(hwnd) \
  1986. (int)SendMessage((hwnd), TCM_GETCURFOCUS, 0, 0)
  1987. // TabView notification codes
  1988. #define TCN_KEYDOWN (TCN_FIRST - 0)
  1989. typedef struct _TC_KEYDOWN
  1990. {
  1991. NMHDR hdr;
  1992. WORD wVKey;
  1993. UINT flags;
  1994. } TC_KEYDOWN;
  1995. // selection has changed
  1996. #define TCN_SELCHANGE (TCN_FIRST - 1)
  1997. // selection changing away from current tab
  1998. // return: FALSE to continue, or TRUE to not change
  1999. #define TCN_SELCHANGING (TCN_FIRST - 2)
  2000. /*/////////////////////////////////////////////////////////////////////////*/
  2001. // Animate control
  2002. #ifndef NOANIMATE
  2003. /*
  2004. // OVERVIEW:
  2005. //
  2006. // The Animte control is a simple animation control, you can use it to
  2007. // have animaed controls in dialogs.
  2008. //
  2009. // what it animates are simple .AVI files from a resource.
  2010. // a simple AVI is a uncompressed or RLE compressed AVI file.
  2011. //
  2012. // the .AVI file must be placed in the resource with a type of "AVI"
  2013. //
  2014. // example:
  2015. //
  2016. // myapp.rc:
  2017. // MyAnimation AVI foobar.avi // must be simple RLE avifile
  2018. //
  2019. // myapp.c:
  2020. // Animate_Open(hwndA, "MyAnimation"); // open the resource
  2021. // Animate_Play(hwndA, 0, -1, -1); // play from start to finish and repeat
  2022. */
  2023. #ifdef WIN32
  2024. #define ANIMATE_CLASS "SysAnimate32"
  2025. #else
  2026. #define ANIMATE_CLASS "SysAnimate"
  2027. #endif
  2028. /* STYLE BITS */
  2029. #define ACS_CENTER 0x0001 // center animation in window
  2030. #define ACS_TRANSPARENT 0x0002 // make animation transparent.
  2031. #define ACS_AUTOPLAY 0x0004 // start playing on open
  2032. /* MESSAGES */
  2033. #define ACM_OPEN (WM_USER+100)
  2034. /* wParam: not used, 0
  2035. // lParam: name of resource/file to open
  2036. // return: bool
  2037. */
  2038. #define ACM_PLAY (WM_USER+101)
  2039. /* wParam: repeat count -1 = repeat forever.
  2040. // lParam: LOWORD=frame start 0 = first frame.
  2041. // HIWORD=play end -1 = last frame.
  2042. // return: bool
  2043. */
  2044. #define ACM_STOP (WM_USER+102)
  2045. /* wParam: not used
  2046. // lParam: not used
  2047. // return: bool
  2048. */
  2049. /* notify codes, sent via WM_COMMAND */
  2050. #define ACN_START 1 // file has started playing
  2051. #define ACN_STOP 2 // file has stopped playing
  2052. /* HELPER MACROS */
  2053. #define Animate_Create(hwndP, id, dwStyle, hInstance) \
  2054. CreateWindow(ANIMATE_CLASS, NULL, \
  2055. dwStyle, 0, 0, 0, 0, hwndP, (HMENU)(id), hInstance, NULL)
  2056. #define Animate_Open(hwnd, szName) (BOOL)SendMessage(hwnd, ACM_OPEN, 0, (LPARAM)(LPSTR)(szName))
  2057. #define Animate_Play(hwnd, from, to, rep) (BOOL)SendMessage(hwnd, ACM_PLAY, (WPARAM)(UINT)(rep), (LPARAM)MAKELONG(from, to))
  2058. #define Animate_Stop(hwnd) (BOOL)SendMessage(hwnd, ACM_STOP, 0, 0)
  2059. #define Animate_Close(hwnd) Animate_Open(hwnd, NULL)
  2060. #define Animate_Seek(hwnd, frame) Animate_Play(hwnd, frame, frame, 0)
  2061. #endif /* NOANIMATE */
  2062. // BUGBUG: move some place else
  2063. #ifdef __cplusplus
  2064. } /* end of 'extern "C" {' */
  2065. #endif
  2066. #endif /* _INC_COMMCTRL */