Windows NT 4.0 source code leak
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.

1081 lines
34 KiB

4 years ago
  1. /******************************Module*Header*******************************\
  2. * Module Name: mmcntrls.h
  3. *
  4. * Contains a collection of common controls used by various MM apps...
  5. * mciwnd - uses toolbars and trackbars
  6. * cdplayer - uses toolbars, bitmap buttons and multiple drag lists
  7. * mplayer - uses toolbars and trackbars
  8. * soundrec - uses trackbars and bitmap buttons
  9. *
  10. *
  11. * Created: 15-02-94
  12. * Author: Stephen Estrop [StephenE]
  13. *
  14. * Copyright (c) 1994 Microsoft Corporation
  15. \**************************************************************************/
  16. /*REVIEW: this stuff needs Windows style in many places; find all REVIEWs. */
  17. #ifndef _INC_MMCNTRLS
  18. #define _INC_MMCNTRLS
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. #ifndef NOTOOLBAR
  23. #define InitToolbarClass private1
  24. #define CreateToolbarEx private2
  25. #define GetDitherBrush private3
  26. #define CreateDitherBrush private4
  27. #define FreeDitherBrush private5
  28. #endif
  29. #ifndef NOTRACKBAR
  30. #define InitTrackBar private6
  31. #endif
  32. #ifndef NOBITMAPBTN
  33. #define BtnCreateBitmapButtons private7
  34. #define BtnDestroyBitmapButtons private8
  35. #define BtnDrawButton private9
  36. #define BtnDrawFocusRect private10
  37. #define BtnUpdateColors private11
  38. #endif
  39. #ifndef NOSTATUSBAR
  40. #define CreateStatusWindowW private12
  41. #define CreateStatusWindowA private13
  42. #define DrawStatusTextA private14
  43. #define DrawStatusTextW private15
  44. #endif
  45. /* Users of this header may define any number of these constants to avoid
  46. * the definitions of each functional group.
  47. * NOTOOLBAR Customizable bitmap-button toolbar control.
  48. * NOMENUHELP APIs to help manage menus, especially with a status bar.
  49. * NOTRACKBAR Customizable column-width tracking control.
  50. * NODRAGLIST APIs to make a listbox source and sink drag&drop actions.
  51. * NOBITMAPBTN APIs to draw bitmaps on buttons
  52. */
  53. /*/////////////////////////////////////////////////////////////////////////*/
  54. #ifndef NOBITMAPBTN
  55. /* -------------------------------------------------------------------------
  56. ** Bitmap button styles
  57. ** -------------------------------------------------------------------------
  58. */
  59. /*
  60. ** If you want little tool tips to popup next to your toolbar buttons
  61. ** use the style below.
  62. */
  63. #define BBS_TOOLTIPS 0x00000100L /* make/use a tooltips control */
  64. /* -------------------------------------------------------------------------
  65. ** Bitmap button states
  66. ** -------------------------------------------------------------------------
  67. */
  68. #define BTNSTATE_PRESSED ODS_SELECTED
  69. #define BTNSTATE_DISABLED ODS_DISABLED
  70. #define BTNSTATE_HAS_FOCUS ODS_FOCUS
  71. /* -------------------------------------------------------------------------
  72. ** Bitmap button structures
  73. ** -------------------------------------------------------------------------
  74. */
  75. typedef struct {
  76. int iBitmap; /* Index into mondo bitmap of this button's picture */
  77. UINT uId; /* Button ID */
  78. UINT fsState; /* Button's state, see BTNSTATE_XXXX above */
  79. } BITMAPBTN, NEAR *PBITMAPBTN, FAR *LPBITMAPBTN;
  80. /* -------------------------------------------------------------------------
  81. ** Bitmap buttons public interfaces
  82. ** -------------------------------------------------------------------------
  83. */
  84. BOOL WINAPI
  85. BtnCreateBitmapButtons(
  86. HWND hwndOwner,
  87. HINSTANCE hBMInst,
  88. UINT wBMID,
  89. UINT uStyle,
  90. LPBITMAPBTN lpButtons,
  91. int nButtons,
  92. int dxBitmap,
  93. int dyBitmap
  94. );
  95. void WINAPI
  96. BtnDestroyBitmapButtons(
  97. HWND hwndOwner
  98. );
  99. void WINAPI
  100. BtnDrawButton(
  101. HWND hwndOwner,
  102. HDC hdc,
  103. int dxButton,
  104. int dyButton,
  105. LPBITMAPBTN lpButton
  106. );
  107. void WINAPI
  108. BtnDrawFocusRect(
  109. HDC hdc,
  110. const RECT *lpRect,
  111. UINT fsState
  112. );
  113. void WINAPI
  114. BtnUpdateColors(
  115. HWND hwndOwner
  116. );
  117. #endif
  118. /*/////////////////////////////////////////////////////////////////////////*/
  119. #ifndef NOTOOLBAR
  120. #define TOOLBARCLASSNAME TEXT("MCIWndToolbar")
  121. /* Note that LOWORD(dwData) is at the same offset as idsHelp in the old
  122. ** structure, since it was never used anyway.
  123. */
  124. typedef struct tagTBBUTTON
  125. {
  126. /*REVIEW: index, command, flag words, resource ids should be UINT */
  127. int iBitmap; /* index into bitmap of this button's picture */
  128. int idCommand; /* WM_COMMAND menu ID that this button sends */
  129. BYTE fsState; /* button's state */
  130. BYTE fsStyle; /* button's style */
  131. DWORD dwData; /* app defined data */
  132. int iString; /* index into string list */
  133. } TBBUTTON;
  134. typedef TBBUTTON NEAR* PTBBUTTON;
  135. typedef TBBUTTON FAR* LPTBBUTTON;
  136. typedef const TBBUTTON FAR* LPCTBBUTTON;
  137. /*REVIEW: is this internal? if not, call it TBADJUSTINFO, prefix tba */
  138. typedef struct tagADJUSTINFO
  139. {
  140. TBBUTTON tbButton;
  141. TCHAR szDescription[1];
  142. } ADJUSTINFO;
  143. typedef ADJUSTINFO NEAR* PADJUSTINFO;
  144. typedef ADJUSTINFO FAR* LPADJUSTINFO;
  145. /*REVIEW: is this internal? if not, call it TBCOLORMAP, prefix tbc */
  146. typedef struct tagCOLORMAP
  147. {
  148. COLORREF from;
  149. COLORREF to;
  150. } COLORMAP;
  151. typedef COLORMAP NEAR* PCOLORMAP;
  152. typedef COLORMAP FAR* LPCOLORMAP;
  153. BOOL WINAPI
  154. InitToolbarClass(
  155. HINSTANCE hInstance
  156. );
  157. /* This is likely to change several times in the near future. */
  158. HWND WINAPI
  159. CreateToolbarEx(
  160. HWND hwnd,
  161. DWORD ws,
  162. UINT wID,
  163. int nBitmaps,
  164. HINSTANCE hBMInst,
  165. UINT wBMID,
  166. LPCTBBUTTON lpButtons,
  167. int iNumButtons,
  168. int dxButton,
  169. int dyButton,
  170. int dxBitmap,
  171. int dyBitmap,
  172. UINT uStructSize
  173. );
  174. /*REVIEW: idBitmap, iNumMaps should be UINT */
  175. HBITMAP WINAPI
  176. CreateMappedBitmap(
  177. HINSTANCE hInstance,
  178. int idBitmap,
  179. WORD wFlags,
  180. LPCOLORMAP lpColorMap,
  181. int iNumMaps
  182. );
  183. #define CMB_DISCARDABLE 0x01 /* create bitmap as discardable */
  184. #define CMB_MASKED 0x02 /* create image/mask pair in bitmap */
  185. HBRUSH WINAPI
  186. GetDitherBrush(
  187. void
  188. );
  189. /*REVIEW: TBSTATE_* should be TBF_* (for Flags) */
  190. #define TBSTATE_CHECKED 0x01 /* radio button is checked */
  191. #define TBSTATE_PRESSED 0x02 /* button is being depressed (any style) */
  192. #define TBSTATE_ENABLED 0x04 /* button is enabled */
  193. #define TBSTATE_HIDDEN 0x08 /* button is hidden */
  194. #define TBSTATE_INDETERMINATE 0x10 /* button is indeterminate */
  195. /* (needs to be endabled, too) */
  196. /*REVIEW: TBSTYLE_* should be TBS_* (for Style) */
  197. #define TBSTYLE_BUTTON 0x00 /* this entry is button */
  198. #define TBSTYLE_SEP 0x01 /* this entry is a separator */
  199. #define TBSTYLE_CHECK 0x02 /* this is a check button (it stays down) */
  200. #define TBSTYLE_GROUP 0x04 /* this is a check button (it stays down) */
  201. #define TBSTYLE_CHECKGROUP (TBSTYLE_GROUP | TBSTYLE_CHECK) /* this group is a member of a group radio group */
  202. /* Because MciWnd and Mplayer require toolbar style with a miss-aligned
  203. ** button style, set this flag when creating a the toolbar
  204. ** with button alignment identical to one in comctl32.dll
  205. */
  206. #define TBS_NORMAL 0x00000080L /* normal style */
  207. /*
  208. ** If you want little tool tips to popup next to your toolbar buttons
  209. ** use the style below.
  210. */
  211. #define TBS_TOOLTIPS 0x00000100L /* make/use a tooltips control */
  212. #define TBSTYLE_TOOLTIPS TBS_TOOLTIPS
  213. /*REVIEW: ifdef _INC_WINDOWSX, should we provide message crackers? */
  214. #define TB_ENABLEBUTTON (WM_USER + 1)
  215. /* wParam: UINT, button ID
  216. ** lParam: BOOL LOWORD, enable if nonzero; HIWORD not used, 0
  217. ** return: not used
  218. */
  219. #define TB_CHECKBUTTON (WM_USER + 2)
  220. /* wParam: UINT, button ID
  221. ** lParam: BOOL LOWORD, check if nonzero; HIWORD not used, 0
  222. ** return: not used
  223. */
  224. #define TB_PRESSBUTTON (WM_USER + 3)
  225. /* wParam: UINT, button ID
  226. ** lParam: BOOL LOWORD, press if nonzero; HIWORD not used, 0
  227. ** return: not used
  228. */
  229. #define TB_HIDEBUTTON (WM_USER + 4)
  230. /* wParam: UINT, button ID
  231. ** lParam: BOOL LOWORD, hide if nonzero; HIWORD not used, 0
  232. ** return: not used
  233. */
  234. #define TB_INDETERMINATE (WM_USER + 5)
  235. /* wParam: UINT, button ID
  236. ** lParam: BOOL LOWORD, make indeterminate if nonzero; HIWORD not used, 0
  237. ** return: not used
  238. */
  239. /*REVIEW: Messages up to WM_USER+8 are reserved until we define more state bits */
  240. #define TB_ISBUTTONENABLED (WM_USER + 9)
  241. /* wParam: UINT, button ID
  242. ** lParam: not used, 0
  243. ** return: BOOL LOWORD, enabled if nonzero; HIWORD not used
  244. */
  245. #define TB_ISBUTTONCHECKED (WM_USER + 10)
  246. /* wParam: UINT, button ID
  247. ** lParam: not used, 0
  248. ** return: BOOL LOWORD, checked if nonzero; HIWORD not used
  249. */
  250. #define TB_ISBUTTONPRESSED (WM_USER + 11)
  251. /* wParam: UINT, button ID
  252. ** lParam: not used, 0
  253. ** return: BOOL LOWORD, pressed if nonzero; HIWORD not used
  254. */
  255. #define TB_ISBUTTONHIDDEN (WM_USER + 12)
  256. /* wParam: UINT, button ID
  257. ** lParam: not used, 0
  258. ** return: BOOL LOWORD, hidden if nonzero; HIWORD not used
  259. */
  260. #define TB_ISBUTTONINDETERMINATE (WM_USER + 13)
  261. /* wParam: UINT, button ID
  262. ** lParam: not used, 0
  263. ** return: BOOL LOWORD, indeterminate if nonzero; HIWORD not used
  264. */
  265. /*REVIEW: Messages up to WM_USER+16 are reserved until we define more state bits */
  266. #define TB_SETSTATE (WM_USER + 17)
  267. /* wParam: UINT, button ID
  268. ** lParam: UINT LOWORD, state bits; HIWORD not used, 0
  269. ** return: not used
  270. */
  271. #define TB_GETSTATE (WM_USER + 18)
  272. /* wParam: UINT, button ID
  273. ** lParam: not used, 0
  274. ** return: UINT LOWORD, state bits; HIWORD not used
  275. */
  276. #define TB_ADDBITMAP (WM_USER + 19)
  277. #ifdef WIN32
  278. // lparam - pointer to
  279. typedef struct tagTB_ADDBITMAPINFO {
  280. UINT idResource;
  281. HANDLE hBitmap;
  282. } TB_ADDBITMAPINFO;
  283. #endif
  284. /* wParam: UINT, number of button graphics in bitmap
  285. ** lParam: one of:
  286. ** HINSTANCE LOWORD, module handle; UINT HIWORD, resource id
  287. ** HINSTANCE LOWORD, NULL; HBITMAP HIWORD, bitmap handle
  288. ** return: one of:
  289. ** int LOWORD, index for first new button; HIWORD not used
  290. ** int LOWORD, -1 indicating error; HIWORD not used
  291. */
  292. #define TB_ADDBUTTONS (WM_USER + 20)
  293. /* wParam: UINT, number of buttons to add
  294. ** lParam: LPTBBUTTON, pointer to array of TBBUTTON structures
  295. ** return: not used
  296. */
  297. #define TB_INSERTBUTTON (WM_USER + 21)
  298. /* wParam: UINT, index for insertion (appended if index doesn't exist)
  299. ** lParam: LPTBBUTTON, pointer to one TBBUTTON structure
  300. ** return: not used
  301. */
  302. #define TB_DELETEBUTTON (WM_USER + 22)
  303. /* wParam: UINT, index of button to delete
  304. ** lParam: not used, 0
  305. ** return: not used
  306. */
  307. #define TB_GETBUTTON (WM_USER + 23)
  308. /* wParam: UINT, index of button to get
  309. ** lParam: LPTBBUTTON, pointer to TBBUTTON buffer to receive button
  310. ** return: not used
  311. */
  312. #define TB_BUTTONCOUNT (WM_USER + 24)
  313. /* wParam: not used, 0
  314. ** lParam: not used, 0
  315. ** return: UINT LOWORD, number of buttons; HIWORD not used
  316. */
  317. #define TB_COMMANDTOINDEX (WM_USER + 25)
  318. /* wParam: UINT, command id
  319. ** lParam: not used, 0
  320. ** return: UINT LOWORD, index of button (-1 if command not found);
  321. ** HIWORD not used
  322. **/
  323. #define TB_SAVERESTORE (WM_USER + 26)
  324. /* wParam: BOOL, save state if nonzero (otherwise restore)
  325. ** lParam: LPSTR FAR*, pointer to two LPSTRs:
  326. ** (LPSTR FAR*)(lParam)[0]: ini section name
  327. ** (LPSTR FAR*)(lParam)[1]: ini file name or NULL for WIN.INI
  328. ** return: not used
  329. */
  330. #define TB_CUSTOMIZE (WM_USER + 27)
  331. /* wParam: not used, 0
  332. ** lParam: not used, 0
  333. ** return: not used
  334. */
  335. #define TB_ADDSTRING (WM_USER + 28)
  336. /* wParam: UINT, 0 if no resource; HINSTANCE, module handle
  337. ** lParam: LPSTR, null-terminated strings with double-null at end
  338. ** UINT LOWORD, resource id
  339. ** return: one of:
  340. ** int LOWORD, index for first new string; HIWORD not used
  341. ** int LOWORD, -1 indicating error; HIWORD not used
  342. */
  343. #define TB_GETITEMRECT (WM_USER + 29)
  344. /* wParam: UINT, index of toolbar item whose rect to retrieve
  345. ** lParam: LPRECT, pointer to a RECT struct to fill
  346. ** return: Non-zero, if the RECT is successfully filled
  347. ** Zero, otherwise (item did not exist or was hidden)
  348. */
  349. #define TB_BUTTONSTRUCTSIZE (WM_USER + 30)
  350. /* wParam: UINT, size of the TBBUTTON structure. This is used
  351. ** as a version check.
  352. ** lParam: not used
  353. ** return: not used
  354. **
  355. ** This is required before any buttons are added to the toolbar if
  356. ** the toolbar is created using CreateWindow, but is implied when
  357. ** using CreateToolbar and is a parameter to CreateToolbarEx.
  358. */
  359. #define TB_SETBUTTONSIZE (WM_USER + 31)
  360. /* wParam: not used, 0
  361. ** lParam: UINT LOWORD, button width
  362. ** UINT HIWORD, button height
  363. ** return: not used
  364. **
  365. ** The button size can only be set before any buttons are
  366. ** added. A default size of 24x22 is assumed if the size
  367. ** is not set explicitly.
  368. */
  369. #define TB_SETBITMAPSIZE (WM_USER + 32)
  370. /* wParam: not used, 0
  371. ** lParam: UINT LOWORD, bitmap width
  372. ** UINT HIWORD, bitmap height
  373. ** return: not used
  374. **
  375. ** The bitmap size can only be set before any bitmaps are
  376. ** added. A default size of 16x15 is assumed if the size
  377. ** is not set explicitly.
  378. */
  379. #define TB_AUTOSIZE (WM_USER + 33)
  380. /* wParam: not used, 0
  381. ** lParam: not used, 0
  382. ** return: not used
  383. **
  384. ** Application should call this after causing the toolbar size
  385. ** to change by either setting the button or bitmap size or
  386. ** by adding strings for the first time.
  387. */
  388. #define TB_SETBUTTONTYPE (WM_USER + 34)
  389. /* wParam: WORD, frame control style of button (DFC_*)
  390. ** lParam: not used, 0
  391. ** return: not used
  392. */
  393. #define TB_GETTOOLTIPS (WM_USER + 35)
  394. /* all params are NULL
  395. * returns the hwnd for tooltips control or NULL
  396. */
  397. #define TB_SETTOOLTIPS (WM_USER + 36)
  398. /* wParam: HWND of ToolTips control to use
  399. * lParam unused
  400. */
  401. #define TB_ACTIVATE_TOOLTIPS (WM_USER + 37)
  402. /* wParam: TRUE = active, FALSE = unactive
  403. * lParam unused
  404. */
  405. #endif /* NOTOOLBAR */
  406. /*//////////////////////////////////////////////////////////////////////*/
  407. #ifndef NOTOOLTIPS
  408. #define WM_NOTIFY 0x004E
  409. typedef struct tagNMHDR //
  410. { //
  411. HWND hwndFrom; //
  412. UINT idFrom; //
  413. UINT code; //
  414. } NMHDR; //
  415. typedef NMHDR FAR * LPNMHDR; //
  416. LRESULT WINAPI
  417. SendNotify(
  418. HWND hwndTo,
  419. HWND hwndFrom,
  420. int code,
  421. NMHDR FAR *pnmhdr
  422. );
  423. /* LRESULT Cls_OnNotify(HWND hwnd, int idFrom, NMHDR FAR* pnmhdr); */
  424. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
  425. (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  426. #define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) \
  427. (void)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(id), (LPARAM)(NMHDR FAR*)(pnmhdr))
  428. // Generic WM_NOTIFY notification codes
  429. #define NM_OUTOFMEMORY (NM_FIRST-1)
  430. #define NM_CLICK (NM_FIRST-2)
  431. #define NM_DBLCLK (NM_FIRST-3)
  432. #define NM_RETURN (NM_FIRST-4)
  433. #define NM_RCLICK (NM_FIRST-5)
  434. #define NM_RDBLCLK (NM_FIRST-6)
  435. #define NM_SETFOCUS (NM_FIRST-7)
  436. #define NM_KILLFOCUS (NM_FIRST-8)
  437. // WM_NOTIFY ranges
  438. #define NM_FIRST (0U- 0U)
  439. #define NM_LAST (0U- 99U)
  440. #define LVN_FIRST (0U-100U)
  441. #define LVN_LAST (0U-199U)
  442. #define HDN_FIRST (0U-300U)
  443. #define HDN_LAST (0U-399U)
  444. #define TVN_FIRST (0U-400U)
  445. #define TVN_LAST (0U-499U)
  446. #define TTN_FIRST (0U-520U)
  447. #define TTN_LAST (0U-549U)
  448. #define TOOLTIPS_CLASS TEXT("MCItooltips_class")
  449. typedef struct {
  450. UINT cbSize;
  451. UINT uFlags;
  452. HWND hwnd;
  453. UINT uId;
  454. RECT rect;
  455. HINSTANCE hinst;
  456. LPTSTR lpszText;
  457. } TOOLINFO, NEAR *PTOOLINFO, FAR *LPTOOLINFO;
  458. #define LPSTR_TEXTCALLBACK ((LPTSTR)-1)
  459. #define TTS_ALWAYSTIP 0x01 // check over inactive windows as well
  460. #define TTF_WIDISHWND 0x01
  461. #define TTF_STRIPACCELS 0x08 // ;Internal (this is implicit now)
  462. #define TTM_ACTIVATE (WM_USER + 1) // wparam = BOOL (true or false = activate or deactivate)
  463. //#define TTM_DEACTIVATE (WM_USER + 2) // ;Internal
  464. #define TTM_SETDELAYTIME (WM_USER + 3)
  465. #define TTM_ADDTOOL (WM_USER + 4)
  466. #define TTM_DELTOOL (WM_USER + 5)
  467. #define TTM_NEWTOOLRECT (WM_USER + 6)
  468. #define TTM_RELAYEVENT (WM_USER + 7)
  469. // lParam has TOOLINFO with hwnd and wid. this gets filled in
  470. #define TTM_GETTOOLINFO (WM_USER + 8)
  471. // lParam has TOOLINFO
  472. #define TTM_SETTOOLINFO (WM_USER + 9)
  473. // returns true or false for found, not found.
  474. // fills in LPHITTESTINFO->ti
  475. #define TTM_HITTEST (WM_USER +10)
  476. #define TTM_GETTEXT (WM_USER +11)
  477. #define TTM_UPDATETIPTEXT (WM_USER +12)
  478. typedef struct _TT_HITTESTINFO {
  479. HWND hwnd;
  480. POINT pt;
  481. TOOLINFO ti;
  482. } TTHITTESTINFO, FAR * LPHITTESTINFO;
  483. // WM_NOTIFY message sent to parent window to get tooltip text
  484. // if TTF_QUERYFORTIP is set on any tips
  485. #define TTN_NEEDTEXT (TTN_FIRST - 0)
  486. // WM_NOTIFY structure sent if TTF_QUERYFORTIP is set
  487. typedef struct {
  488. NMHDR hdr;
  489. LPWSTR lpszText;
  490. WCHAR szText[80];
  491. HINSTANCE hinst;
  492. } TOOLTIPTEXT, FAR *LPTOOLTIPTEXT;
  493. #endif //NOTOOLTIPS
  494. /*/////////////////////////////////////////////////////////////////////////*/
  495. #ifndef NOTRACKBAR
  496. /*
  497. This control keeps its ranges in LONGs. but for
  498. convienence and symetry with scrollbars
  499. WORD parameters are are used for some messages.
  500. if you need a range in LONGs don't use any messages
  501. that pack values into loword/hiword pairs
  502. The trackbar messages:
  503. message wParam lParam return
  504. TBM_GETPOS ------ ------ Current logical position of trackbar.
  505. TBM_GETRANGEMIN ------ ------ Current logical minimum position allowed.
  506. TBM_GETRANGEMAX ------ ------ Current logical maximum position allowed.
  507. TBM_SETTIC
  508. TBM_SETPOS
  509. TBM_SETRANGEMIN
  510. TBM_SETRANGEMAX
  511. */
  512. #define TRACKBAR_CLASS TEXT("MCIWndTrackbar")
  513. BOOL WINAPI
  514. InitTrackBar(
  515. HINSTANCE hInstance
  516. );
  517. /* Trackbar styles */
  518. /* add ticks automatically on TBM_SETRANGE message */
  519. #define TBS_AUTOTICKS 0x0001L
  520. /* Trackbar messages */
  521. /* returns current position (LONG) */
  522. #define TBM_GETPOS (WM_USER)
  523. /* set the min of the range to LPARAM */
  524. #define TBM_GETRANGEMIN (WM_USER+1)
  525. /* set the max of the range to LPARAM */
  526. #define TBM_GETRANGEMAX (WM_USER+2)
  527. /* wParam is index of tick to get (ticks are in the range of min - max) */
  528. #define TBM_GETTIC (WM_USER+3)
  529. /* wParam is index of tick to set */
  530. #define TBM_SETTIC (WM_USER+4)
  531. /* set the position to the value of lParam (wParam is the redraw flag) */
  532. #define TBM_SETPOS (WM_USER+5)
  533. /* LOWORD(lParam) = min, HIWORD(lParam) = max, wParam == fRepaint */
  534. #define TBM_SETRANGE (WM_USER+6)
  535. /* lParam is range min (use this to keep LONG precision on range) */
  536. #define TBM_SETRANGEMIN (WM_USER+7)
  537. /* lParam is range max (use this to keep LONG precision on range) */
  538. #define TBM_SETRANGEMAX (WM_USER+8)
  539. /* remove the ticks */
  540. #define TBM_CLEARTICS (WM_USER+9)
  541. /* select a range LOWORD(lParam) min, HIWORD(lParam) max */
  542. #define TBM_SETSEL (WM_USER+10)
  543. /* set selection rang (LONG form) */
  544. #define TBM_SETSELSTART (WM_USER+11)
  545. #define TBM_SETSELEND (WM_USER+12)
  546. // #define TBM_SETTICTOK (WM_USER+13)
  547. /* return a pointer to the list of tics (DWORDS) */
  548. #define TBM_GETPTICS (WM_USER+14)
  549. /* get the pixel position of a given tick */
  550. #define TBM_GETTICPOS (WM_USER+15)
  551. /* get the number of tics */
  552. #define TBM_GETNUMTICS (WM_USER+16)
  553. /* get the selection range */
  554. #define TBM_GETSELSTART (WM_USER+17)
  555. #define TBM_GETSELEND (WM_USER+18)
  556. /* clear the selection */
  557. #define TBM_CLEARSEL (WM_USER+19)
  558. /*REVIEW: these match the SB_ (scroll bar messages); define them that way? */
  559. #define TB_LINEUP 0
  560. #define TB_LINEDOWN 1
  561. #define TB_PAGEUP 2
  562. #define TB_PAGEDOWN 3
  563. #define TB_THUMBPOSITION 4
  564. #define TB_THUMBTRACK 5
  565. #define TB_TOP 6
  566. #define TB_BOTTOM 7
  567. #define TB_ENDTRACK 8
  568. #endif
  569. /*/////////////////////////////////////////////////////////////////////////*/
  570. #ifndef NOSTATUSBAR
  571. /* Here exists the only known documentation for status.c and header.c
  572. */
  573. #ifndef _INC_STATUSBAR
  574. #define _INC_STATUSBAR
  575. VOID WINAPI DrawStatusTextA(HDC hDC, LPRECT lprc, LPCSTR szText, UINT uFlags);
  576. VOID WINAPI DrawStatusTextW(HDC hDC, LPRECT lprc, LPCWSTR szText, UINT uFlags);
  577. #ifdef UNICODE
  578. #define DrawStatusText DrawStatusTextW
  579. #else
  580. #define DrawStatusText DrawStatusTextA
  581. #endif // !UNICODE
  582. /* This is used if the app wants to draw status in its client rect,
  583. * instead of just creating a window. Note that this same function is
  584. * used internally in the status bar window's WM_PAINT message.
  585. * hDC is the DC to draw to. The font that is selected into hDC will
  586. * be used. The RECT lprc is the only portion of hDC that will be drawn
  587. * to: the outer edge of lprc will have the highlights (the area outside
  588. * of the highlights will not be drawn in the BUTTONFACE color: the app
  589. * must handle that). The area inside the highlights will be erased
  590. * properly when drawing the text.
  591. */
  592. HWND WINAPI CreateStatusWindowA(LONG style, LPCSTR lpszText,
  593. HWND hwndParent, WORD wID);
  594. HWND WINAPI CreateStatusWindowW(LONG style, LPCWSTR lpszText,
  595. HWND hwndParent, WORD wID);
  596. #ifdef UNICODE
  597. #define CreateStatusWindow CreateStatusWindowW
  598. #else
  599. #define CreateStatusWindow CreateStatusWindowA
  600. #endif // !UNICODE
  601. HWND WINAPI CreateHeaderWindowA(LONG style, LPCSTR lpszText,
  602. HWND hwndParent, WORD wID);
  603. HWND WINAPI CreateHeaderWindowW(LONG style, LPCWSTR lpszText,
  604. HWND hwndParent, WORD wID);
  605. #ifdef UNICODE
  606. #define CreateHeaderWindow CreateHeaderWindowW
  607. #else
  608. #define CreateHeaderWindow CreateHeaderWindowA
  609. #endif // !UNICODE
  610. /* This creates a "default" status/header window. This window will have the
  611. * default borders around the text, the default font, and only one pane.
  612. * It may also automatically resize and move itself (depending on the SBS_*
  613. * flags).
  614. * style should contain WS_CHILD, and can contain WS_BORDER and WS_VISIBLE,
  615. * plus any of the SBS_* styles described below. I don't know about other
  616. * WS_* styles.
  617. * lpszText is the initial text for the first pane.
  618. * hwndParent is the window the status bar exists in, and should not be NULL.
  619. * wID is the child window ID of the window.
  620. * hInstance is the instance handle of the application using this.
  621. * Note that the app can also just call CreateWindow with
  622. * STATUSCLASSNAME/HEADERCLASSNAME to create a window of a specific size.
  623. */
  624. #define STATUSCLASSNAMEW L"msctls_statusbar"
  625. #define STATUSCLASSNAMEA "msctls_statusbar"
  626. #ifdef UNICODE
  627. #define STATUSCLASSNAME STATUSCLASSNAMEW
  628. #else
  629. #define STATUSCLASSNAME STATUSCLASSNAMEA
  630. #endif
  631. /* This is the name of the status bar class (it will probably change later
  632. * so use the #define here).
  633. */
  634. #define HEADERCLASSNAMEW L"msctls_headerbar"
  635. #define HEADERCLASSNAMEA "msctls_headerbar"
  636. #ifdef UNICODE
  637. #define HEADERCLASSNAME HEADERCLASSNAMEW
  638. #else
  639. #define HEADERCLASSNAME HEADERCLASSNAMEA
  640. #endif
  641. /* This is the name of the header class (it will probably change later
  642. * so use the #define here).
  643. */
  644. #define SB_SETTEXTA WM_USER+1
  645. #define SB_GETTEXTA WM_USER+2
  646. #define SB_GETTEXTW WM_USER+10
  647. #define SB_SETTEXTW WM_USER+11
  648. #ifdef UNICODE
  649. #define SB_GETTEXT SB_GETTEXTW
  650. #define SB_SETTEXT SB_SETTEXTW
  651. #else
  652. #define SB_GETTEXT SB_GETTEXTA
  653. #define SB_SETTEXT SB_SETTEXTA
  654. #endif // UNICODE
  655. #define SB_GETTEXTLENGTH WM_USER+3
  656. /* Just like WM_?ETTEXT*, with wParam specifying the pane that is referenced
  657. * (at most 255).
  658. * Note that you can use the WM_* versions to reference the 0th pane (this
  659. * is useful if you want to treat a "default" status bar like a static text
  660. * control).
  661. * For SETTEXT, wParam is the pane or'ed with SBT_* style bits (defined below).
  662. * If the text is "normal" (not OWNERDRAW), then a single pane may have left,
  663. * center, and right justified text by separating the parts with a single tab,
  664. * plus if lParam is NULL, then the pane has no text. The pane will be
  665. * invalidated, but not draw until the next PAINT message.
  666. * For GETTEXT and GETTEXTLENGTH, the LOWORD of the return will be the length,
  667. * and the HIWORD will be the SBT_* style bits.
  668. */
  669. #define SB_SETPARTS WM_USER+4
  670. /* wParam is the number of panes, and lParam points to an array of points
  671. * specifying the right hand side of each pane. A right hand side of -1 means
  672. * it goes all the way to the right side of the control minus the X border
  673. */
  674. #define SB_SETBORDERS WM_USER+5
  675. /* lParam points to an array of 3 integers: X border, Y border, between pane
  676. * border. If any is less than 0, the default will be used for that one.
  677. */
  678. #define SB_GETPARTS WM_USER+6
  679. /* lParam is a pointer to an array of integers that will get filled in with
  680. * the right hand side of each pane and wParam is the size (in integers)
  681. * of the lParam array (so we do not go off the end of it).
  682. * Returns the number of panes.
  683. */
  684. #define SB_GETBORDERS WM_USER+7
  685. /* lParam is a pointer to an array of 3 integers that will get filled in with
  686. * the X border, the Y border, and the between pane border.
  687. */
  688. #define SB_SETMINHEIGHT WM_USER+8
  689. /* wParam is the minimum height of the status bar "drawing" area. This is
  690. * the area inside the highlights. This is most useful if a pane is used
  691. * for an OWNERDRAW item, and is ignored if the SBS_NORESIZE flag is set.
  692. * Note that WM_SIZE must be sent to the control for any size changes to
  693. * take effect.
  694. */
  695. #define SB_SIMPLE WM_USER+9
  696. /* wParam specifies whether to set (non-zero) or unset (zero) the "simple"
  697. * mode of the status bar. In simple mode, only one pane is displayed, and
  698. * its text is set with LOWORD(wParam)==255 in the SETTEXT message.
  699. * OWNERDRAW is not allowed, but other styles are.
  700. * The pane gets invalidated, but not painted until the next PAINT message,
  701. * so you can set new text without flicker (I hope).
  702. * This can be used with the WM_INITMENU and WM_MENUSELECT messages to
  703. * implement help text when scrolling through a menu.
  704. */
  705. #define HB_SAVERESTORE WM_USER+0x100
  706. /* This gets a header bar to read or write its state to or from an ini file.
  707. * wParam is 0 for reading, non-zero for writing. lParam is a pointer to
  708. * an array of two LPTSTR's: the section and file respectively.
  709. * Note that the correct number of partitions must be set before calling this.
  710. */
  711. #define HB_ADJUST WM_USER+0x101
  712. /* This puts the header bar into "adjust" mode, for changing column widths
  713. * with the keyboard.
  714. */
  715. #define HB_SETWIDTHS SB_SETPARTS
  716. /* Set the widths of the header columns. Note that "springy" columns only
  717. * have a minumum width, and negative width are assumed to be hidden columns.
  718. * This works just like SB_SETPARTS.
  719. */
  720. #define HB_GETWIDTHS SB_GETPARTS
  721. /* Get the widths of the header columns. Note that "springy" columns only
  722. * have a minumum width. This works just like SB_GETPARTS.
  723. */
  724. #define HB_GETPARTS WM_USER+0x102
  725. /* Get a list of the right-hand sides of the columns, for use when drawing the
  726. * actual columns for which this is a header.
  727. * lParam is a pointer to an array of integers that will get filled in with
  728. * the right hand side of each pane and wParam is the size (in integers)
  729. * of the lParam array (so we do not go off the end of it).
  730. * Returns the number of panes.
  731. */
  732. #define HB_SHOWTOGGLE WM_USER+0x103
  733. /* Toggle the hidden state of a column. wParam is the 0-based index of the
  734. * column to toggle.
  735. */
  736. #define SBT_OWNERDRAW 0x1000
  737. /* The lParam of the SB_SETTEXT message will be returned in the DRAWITEMSTRUCT
  738. * of the WM_DRAWITEM message. Note that the fields CtlType, itemAction, and
  739. * itemState of the DRAWITEMSTRUCT are undefined for a status bar.
  740. * The return value for GETTEXT will be the itemData.
  741. */
  742. #define SBT_NOBORDERS 0x0100
  743. /* No borders will be drawn for the pane.
  744. */
  745. #define SBT_POPOUT 0x0200
  746. /* The text pops out instead of in
  747. */
  748. #define HBT_SPRING 0x0400
  749. /* this means that the item is "springy", meaning that it has a minimum
  750. * width, but will grow if there is extra room in the window. Note that
  751. * multiple springs are allowed, and the extra room will be distributed
  752. * among them.
  753. */
  754. /* Here's a simple dialog function that uses a default status bar to display
  755. * the mouse position in the given window.
  756. *
  757. * extern HINSTANCE hInst;
  758. *
  759. * BOOL CALLBACK MyWndProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
  760. * {
  761. * switch (msg)
  762. * {
  763. * case WM_INITDIALOG:
  764. * CreateStatusWindow(WS_CHILD|WS_BORDER|WS_VISIBLE, "", hDlg,
  765. * IDC_STATUS, hInst);
  766. * break;
  767. *
  768. * case WM_SIZE:
  769. * SendDlgItemMessage(hDlg, IDC_STATUS, WM_SIZE, 0, 0L);
  770. * break;
  771. *
  772. * case WM_MOUSEMOVE:
  773. * wsprintf(szBuf, "%d,%d", LOWORD(lParam), HIWORD(lParam));
  774. * SendDlgItemMessage(hDlg, IDC_STATUS, SB_SETTEXT, 0,
  775. * (LPARAM)(LPTSTR)szBuf);
  776. * break;
  777. *
  778. * default:
  779. * break;
  780. * }
  781. * return(FALSE);
  782. * }
  783. */
  784. #endif /* _INC_STATUSBAR */
  785. #endif
  786. #ifndef HBN_BEGINDRAG
  787. /*/////////////////////////////////////////////////////////////////////////*/
  788. /*REVIEW: move these to their appropriate control sections. */
  789. /* Note that the set of HBN_* and TBN_* defines must be a disjoint set so
  790. * that MenuHelp can tell them apart.
  791. */
  792. /* These are in the HIWORD of lParam in WM_COMMAND messages sent from a
  793. * header bar when the user adjusts the headers with the mouse or keyboard.
  794. */
  795. #define HBN_BEGINDRAG 0x0101
  796. #define HBN_DRAGGING 0x0102
  797. #define HBN_ENDDRAG 0x0103
  798. /* These are in the HIWORD of lParam in WM_COMMAND messages sent from a
  799. * header bar when the user adjusts the headers with the keyboard.
  800. */
  801. #define HBN_BEGINADJUST 0x0111
  802. #define HBN_ENDADJUST 0x0112
  803. /* These are in the HIWORD of lParam in WM_COMMAND messages sent from a
  804. * tool bar. If the left button is pressed and then released in a single
  805. * "button" of a tool bar, then a WM_COMMAND message will be sent with wParam
  806. * being the id of the button.
  807. */
  808. #define TBN_BEGINDRAG 0x0201
  809. #define TBN_ENDDRAG 0x0203
  810. /* These are in the HIWORD of lParam in WM_COMMAND messages sent from a
  811. * tool bar. The TBN_BEGINADJUST message is sent before the "insert"
  812. * dialog appears. The app must return a handle (which will
  813. * NOT be freed by the toolbar) to an ADJUSTINFO struct for the TBN_ADJUSTINFO
  814. * message; the LOWORD of lParam is the index of the button whose info should
  815. * be retrieved. The app can clean up in the TBN_ENDADJUST message.
  816. * The app should reset the toolbar on the TBN_RESET message.
  817. */
  818. #define TBN_BEGINADJUST 0x0204
  819. #define TBN_ADJUSTINFO 0x0205
  820. #define TBN_ENDADJUST 0x0206
  821. #define TBN_RESET 0x0207
  822. /* These are in the HIWORD of lParam in WM_COMMAND messages sent from a
  823. * tool bar. The LOWORD is the index where the button is or will be.
  824. * If the app returns FALSE from either of these during a button move, then
  825. * the button will not be moved. If the app returns FALSE to the INSERT
  826. * when the toolbar tries to add buttons, then the insert dialog will not
  827. * come up. TBN_TOOLBARCHANGE is sent whenever any button is added, moved,
  828. * or deleted from the toolbar by the user, so the app can do stuff.
  829. */
  830. #define TBN_QUERYINSERT 0x0208
  831. #define TBN_QUERYDELETE 0x0209
  832. #define TBN_TOOLBARCHANGE 0x020a
  833. /* This is in the HIWORD of lParam in a WM_COMMAND message. It notifies the
  834. * parent of a toolbar that the HELP button was pressed in the toolbar
  835. * customize dialog. The dialog window handle is in the LOWORD of lParam.
  836. */
  837. #define TBN_CUSTHELP 0x020b
  838. /* Note that the following flags are checked every time the window gets a
  839. * WM_SIZE message, so the style of the window can be changed "on-the-fly".
  840. * If NORESIZE is set, then the app is responsible for all control placement
  841. * and sizing. If NOPARENTALIGN is set, then the app is responsible for
  842. * placement. If neither is set, the app just needs to send a WM_SIZE
  843. * message for the window to be positioned and sized correctly whenever the
  844. * parent window size changes.
  845. * Note that for STATUS bars, CCS_BOTTOM is the default, for HEADER bars,
  846. * CCS_NOMOVEY is the default, and for TOOL bars, CCS_TOP is the default.
  847. */
  848. #define CCS_TOP 0x00000001L
  849. /* This flag means the status bar should be "top" aligned. If the
  850. * NOPARENTALIGN flag is set, then the control keeps the same top, left, and
  851. * width measurements, but the height is adjusted to the default, otherwise
  852. * the status bar is positioned at the top of the parent window such that
  853. * its client area is as wide as the parent window and its client origin is
  854. * the same as its parent.
  855. * Similarly, if this flag is not set, the control is bottom-aligned, either
  856. * with its original rect or its parent rect, depending on the NOPARENTALIGN
  857. * flag.
  858. */
  859. #define CCS_NOMOVEY 0x00000002L
  860. /* This flag means the control may be resized and moved horizontally (if the
  861. * CCS_NORESIZE flag is not set), but it will not move vertically when a
  862. * WM_SIZE message comes through.
  863. */
  864. #define CCS_BOTTOM 0x00000003L
  865. /* Same as CCS_TOP, only on the bottom.
  866. */
  867. #define CCS_NORESIZE 0x00000004L
  868. /* This flag means that the size given when creating or resizing is exact,
  869. * and the control should not resize itself to the default height or width
  870. */
  871. #define CCS_NOPARENTALIGN 0x00000008L
  872. /* This flag means that the control should not "snap" to the top or bottom
  873. * or the parent window, but should keep the same placement it was given
  874. */
  875. #define CCS_NOHILITE 0x00000010L
  876. /* Don't draw the one pixel highlight at the top of the control
  877. */
  878. #define CCS_ADJUSTABLE 0x00000020L
  879. /* This allows a toolbar (header bar?) to be configured by the user.
  880. */
  881. #define CCS_NODIVIDER 0x00000040L
  882. /* Don't draw the 2 pixel highlight at top of control (toolbar)
  883. */
  884. #endif
  885. /*/////////////////////////////////////////////////////////////////////////*/
  886. #ifdef __cplusplus
  887. } /* end of 'extern "C" {' */
  888. #endif
  889. #endif /* _INC_MMCNTRLS */