sw.pas 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. {
  2. $Id$
  3. Copyright (c) 1990-1991 International Business Machines Corporation
  4. Copyright (c) 2003 by Yuri Prokushev ([email protected])
  5. This is the multimedia unit file that has the typedefs, defines and
  6. function prototypes for Multimedia Applets.
  7. This program is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU Library General Public License (LGPL) as
  9. published by the Free Software Foundation; either version 2 of the
  10. License, or (at your option) any later version. This program is
  11. distributed in the hope that it will be useful, but WITHOUT ANY
  12. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. FITNESS FOR A PARTICULAR PURPOSE.
  14. See the GNU Library General Public License for more details. You should
  15. have received a copy of the GNU Library General Public License along
  16. with this program; if not, write to the Free Software Foundation, Inc.,
  17. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. **********************************************************************}
  19. {
  20. @abstract(OS/2 Multimedia Applets)
  21. @author(Yuri Prokushev ([email protected]))
  22. @created(19 Jan 2003)
  23. @lastmod(23 Jan 2003)
  24. This is the multimedia unit file that has the typedefs, defines and
  25. function prototypes for Multimedia Applets.
  26. Warning: This code is alfa. Future versions of this unit will propably
  27. not be compatible.
  28. }
  29. Unit SW;
  30. Interface
  31. Uses
  32. Os2Def,
  33. PmWin;
  34. Const
  35. MAX_SMBDTEXT=35;
  36. MB_ICONCUSTOM=$0001;
  37. SC_DEFAULTSIZE=$c000; // WM_COMMAND from SysMenu
  38. WM_INITSECONDARYWINDOW=$0519; // MP1: NULL, MP2: CreateParams
  39. QS_FRAME=$1; // Flag set to query frame
  40. QS_DIALOG=$2; // Flag set to query dialog
  41. // #pragma pack(4)
  42. Type
  43. TSMBD=record
  44. achText: Array[0..MAX_SMBDTEXT + 1] of Char; // Text of the button. eg. "~Cancel"
  45. idButton: Cardinal; // Button ID returned when user chooses
  46. flStyle: Longint; // Button style or'ed with internal
  47. end;
  48. PSMBD=^TSMBD;
  49. TSMBINFO=record
  50. hIcon: Cardinal; // Icon handle
  51. cButtons: Cardinal; // Number of buttons
  52. flStyle: Cardinal; // Icon style flags (MB_ICONQUESTION, etc...)
  53. hwndNotify: HWND; // Reserved
  54. smbd: PSMBD; // Array of button definitions
  55. end;
  56. PSMBINFO=^TSMBINFO;
  57. // #pragma pack()
  58. // Analogous to WinDlgBox
  59. function WinSecondaryWindow(hwndParent: hwnd; hwndOwner: hwnd;
  60. pfnDlgProc: proc; hmod: Cardinal; idDlg: Cardinal; pCreateParams: Pointer): Cardinal; cdecl;
  61. // Analogous to WinLoadDlg
  62. function WinLoadSecondaryWindow(hwndParent: hwnd; hwndOwner: hwnd;
  63. pfnDlgProc: proc; hmod: Cardinal; idDlg: Cardinal; pCreateParams: Cardinal): hwnd; cdecl;
  64. // Analogous to WinProcessDlg
  65. function WinProcessSecondaryWindow(hwndSW: hwnd): Cardinal; cdecl;
  66. // Analogous to WinCreateDlg
  67. function WinCreateSecondaryWindow(hwndParent: hwnd; hwndOwner: hwnd;
  68. pfnDlgProc: proc; idDlg: Cardinal; pCreateParams: Pointer): hwnd; cdecl;
  69. function WinDefaultSize(Wnd: hwnd): Longbool; cdecl;
  70. function WinInsertDefaultSize(Wnd: hwnd; pszDefaultSize: pChar): Longbool; cdecl;
  71. function WinQuerySecondaryhwnd(Wnd: hwnd; ulFlag: Cardinal): hwnd; cdecl;
  72. //************************************************************************/
  73. //* WinSecondaryMessageBox */
  74. //* */
  75. //* Parameters: HWND hwndParent - handle of the parent window. */
  76. //* HWND hwndOwner - handle of the owner window. */
  77. //* PSZ pszText - message text. */
  78. //* PSZ pszCaption - title of the message box. */
  79. //* ULONG idWindow - Message box id */
  80. //* PSMBINFO psmbinfo - pointer to button/icon info */
  81. //************************************************************************/
  82. function WinSecondaryMessageBox(hwndParent: hwnd; hwndOwner: hwnd;
  83. pszText: pChar; pszCaption: pChar; idWindow: Cardinal; smb: psmbinfo): Cardinal; cdecl;
  84. //************************************************************************/
  85. //* WinDismissSecondaryWindow */
  86. //* */
  87. //* This function should be called from within the dlg proc. The hwnd */
  88. //* passed in MUST be the handle to the actual dialog. */
  89. //************************************************************************/
  90. function WinDismissSecondaryWindow(hwndDlg: hwnd; ulResult: Cardinal): Longbool; cdecl;
  91. //************************************************************************/
  92. //* The parameter hwnd can be either the secondary window or the actual */
  93. //* dialog. */
  94. //************************************************************************/
  95. function WinDestroySecondaryWindow(Wnd: hwnd): Longbool; cdecl;
  96. function WinDefSecondaryWindowProc(Wnd: hwnd; msg: Cardinal;
  97. mp1: mParam; mp2: mParam): mResult; cdecl;
  98. //************************************************************************/
  99. //* Graphic Buttons */
  100. //************************************************************************/
  101. //************************************************************************/
  102. //* Notes on Using GraphicButtons */
  103. //* */
  104. //* GraphicButton CONTROL DATA */
  105. //* */
  106. //* The format of the control data for GraphicButtons is */
  107. //* "button Text, number of bitmaps, bitmap resource id's ..." */
  108. //* */
  109. //* */
  110. //* Following are two example window templates of GraphicButtons: */
  111. //* */
  112. //* 1) CONTROL "", IDD_MP_REV, 120, 10, TS_PB_WIDTH, TS_PB_HEIGHT,*/
  113. //* WC_GRAPHICBUTTON, */
  114. //* GBS_TWOSTATE | GBS_HILITEBITMAP | */
  115. //* WS_VISIBLE | WS_TABSTOP */
  116. //* CTLDATA GB_RESOURCE,"~REV", 2, ID_MP_REV1, ID_MP_REV0*/
  117. //* */
  118. //* The above graphicbutton has id IDD_MP_REV and is of type */
  119. //* GBS_TWOSTATE and GBS_HILITEBITMAP. The GBS_HILITEBITMAP allows */
  120. //* a different bitmap to be displayed when the button is in the */
  121. //* hilite state. The graphicbutton will be displayed with text */
  122. //* "REV" and has "R" as the mnemonic. It has 2 bitmaps associated */
  123. //* with it. Their resource id are ID_MP_REV1 and ID_MP_REV0. */
  124. //* */
  125. //* */
  126. //* 2) CONTROL "", IDD_MP_PLAY, 175, 10, TS_PB_WIDTH, */
  127. //* TS_PB_HEIGHT, WC_GRAPHICBUTTON, */
  128. //* GBS_AUTOTWOSTATE | GBS_AUTOANIMATION | */
  129. //* WS_VISIBLE | WS_TABSTOP */
  130. //* CTLDATA GB_RESOURCE, "~PLAY", 9, */
  131. //* ID_MP_STOP0, ID_MP_PLAY1, ID_MP_PLAY2,*/
  132. //* ID_MP_PLAY3, ID_MP_PLAY4, ID_MP_PLAY5,*/
  133. //* ID_MP_PLAY6, ID_MP_PLAY7, ID_MP_REV1 */
  134. //* */
  135. //* The above graphicbutton has id IDD_MP_PLAY and is of type */
  136. //* GBS_AUTOTWOSTATE and GBS_AUTOANIMATE. When clicked upon, */
  137. //* the button will automatically toggle the state and animation. */
  138. //* The graphicbutton will be displayed with text "PLAY" */
  139. //* and mnemonic "P". It has 9 bitmaps associated with it. */
  140. //* */
  141. //* */
  142. //* */
  143. //* GraphicButton Painting */
  144. //* */
  145. //* Due to the PM design, whenever a graphicbutton is clicked, */
  146. //* it is sent a BN_PAINT (to paint a non-hilite state) and then */
  147. //* BN_CLICKED. Thus, for GBS_AUTO* style graphicbuttons, a paint */
  148. //* request is generated before the button has a chance to change */
  149. //* its state (BN_CLICKED). To avoid this premature painting, */
  150. //* code was inserted to delay the painting of graphicbuttons */
  151. //* GB_PAINT_RESOLUTION milliseconds whenever the button is switching */
  152. //* FROM the hilite paint state. */
  153. //* */
  154. //************************************************************************/
  155. Function WinRegisterGraphicButton: Longbool; cdecl;
  156. Const
  157. WC_GRAPHICBUTTON=PChar($ffff0040);
  158. //************************************************************************/
  159. //* GraphicButton Animation/TwoState constants */
  160. //************************************************************************/
  161. //************************************************************************/
  162. //* Graphic Button Style bits */
  163. //************************************************************************/
  164. GBS_TWOSTATE = $1000; // indicates TwoState button
  165. GBS_AUTOTWOSTATE = $2000; // will auto toggle state up/down
  166. GBS_ANIMATION = $4000; // indicates Animatable button
  167. GBS_AUTOANIMATION = $8000; // will auto toggle anim. on/off
  168. GBS_DISABLEBITMAP = $0010; // allows a diff. bitmap when disabled
  169. GBS_HILITEBITMAP = $0020; // allows a diff. bitmap when hilited
  170. GBS_3D_TEXTRECESSED = $0040; // display text in 3-D recessed
  171. GBS_3D_TEXTRAISED = $0080; // display text in 3-D raised
  172. GBS_MINIBUTTON = $0001; // mini button style
  173. //************************************************************************/
  174. //* Graphic Button User Constants */
  175. //************************************************************************/
  176. //************************************************************************/
  177. //* Codes to reference allowed GraphicButton states (or paint states) */
  178. //************************************************************************/
  179. GB_ERROR = -1; // GraphicButton Error
  180. GB_UP = 1; // GraphicButton up (and paint) state
  181. GB_DOWN = 2; // GraphicButton down (and paint) state
  182. GB_DISABLE = 3; // GraphicButton disabled state
  183. GB_HILITE = 4; // GraphicButton paint state only
  184. GB_OUTOFHILITE = 5; // Changing out of hilite paint state
  185. //************************************************************************/
  186. //* Codes for various GraphicButton message function parameters */
  187. //************************************************************************/
  188. GB_TOGGLE = 10; // GraphicButton toggle
  189. GB_CURRENTSTATE = 11; // GraphicButton's current state
  190. GB_ANIMATIONBEGIN = 12; // when refering to index of anim start
  191. GB_ANIMATIONEND = 13; // when refering to index of anim end
  192. GB_MAXINDEX = 14; // GraphicButton max. index
  193. //************************************************************************/
  194. //* Codes to set/query text position relative to the bitmap */
  195. //************************************************************************/
  196. GB_TEXTBELOW = 1; // place text below bitmap
  197. GB_TEXTABOVE = 2; // place text above bitmap
  198. //************************************************************************/
  199. //* Codes used to set the animation frame with message GBM_SETBITMAPINDEX*/
  200. //************************************************************************/
  201. GB_INDEX_FORWARD = -1; // advance one frame foward
  202. GB_INDEX_BACKWARD = -2; // advance one frame backwards
  203. GB_INDEX_FIRST = -3; // set to first frame of sequence
  204. GB_INDEX_LAST = -4; // set to last frame of sequence
  205. // #pragma pack(1)
  206. type
  207. TgbtnCdata = packed record
  208. usReserved: Word;
  209. pszText: PChar;
  210. hmod: Cardinal;
  211. cBitmaps: Word;
  212. aidBitmap: Array[0..1] of Word;
  213. end;
  214. pgbtnCdata = ^TgbtnCdata;
  215. //#pragma pack()
  216. const
  217. GB_RESOURCE = 1;
  218. GB_STRUCTURE = 0;
  219. //************************************************************************/
  220. //* Notification Messages received by GraphicButton Parent */
  221. //***********************************************************************/
  222. //************************************************************************/
  223. //* GBN_BUTTONDOWN, GBN_BUTTONUP, and GBN_BUTTONHILITE */
  224. //* */
  225. //* The notification messages are passed as part of the WM_CONTROL */
  226. //* message. */
  227. //* */
  228. //* msg = WM_CONTROL */
  229. //* mp1 = MPFROM2SHORT(gpb_id, button_state) */
  230. //* gpd_id = identity of the displayed graphic pushbutton */
  231. //* button_state = GBN_BUTTONUP, GBN_BUTTONDOWN, or */
  232. //* GBN_BUTTONHILITE */
  233. //* */
  234. //************************************************************************/
  235. GBN_BUTTONUP = $0524;
  236. GBN_BUTTONDOWN = $0525;
  237. GBN_BUTTONHILITE = $0526;
  238. GBN_SETFOCUS = $0527; // mp2 TRUE for gaining focus
  239. //************************************************************************/
  240. //* Messages to GraphicButton Windows */
  241. //************************************************************************/
  242. //************************************************************************/
  243. //* GBM_SETGRAPHICDATA */
  244. //************************************************************************/
  245. //* mp1 = MPFROMP((PGBTNCDATA)&gbtncdata); Graphic button control data*/
  246. //* mp2 = NULL; not used */
  247. //* */
  248. //* WARNING: This message resets all button parameters. */
  249. //* */
  250. //************************************************************************/
  251. GBM_SETGRAPHICDATA = $052A;
  252. //************************************************************************/
  253. //* GBM_ANIMATE */
  254. //************************************************************************/
  255. //* mp1 = MPFROMSHORT(fStart) TRUE to start animation, FALSE to stop*/
  256. //* mp2 = MPFROMSHORT(fContinue) TRUE continue anim. at currently */
  257. //* displayed bitmap, FALSE restart at */
  258. //* the beginning. */
  259. //* */
  260. //* Returns TRUE on Success */
  261. //* FALSE on Failure */
  262. //* */
  263. //************************************************************************/
  264. GBM_ANIMATE = $052B;
  265. //************************************************************************/
  266. //* GBM_SETANIMATIONRATE */
  267. //************************************************************************/
  268. //* mp1 = MPFROMSHORT(ULmIL); Animation rate in milliseconds */
  269. //* mp2 = NULL not used */
  270. //* */
  271. //* */
  272. //* Returns TRUE on Success */
  273. //* FALSE on Failure */
  274. //* */
  275. //************************************************************************/
  276. GBM_SETANIMATIONRATE = $052C;
  277. //************************************************************************/
  278. //* GBM_QUERYANIMATIONACTIVE */
  279. //************************************************************************/
  280. //* mp1 = NULL; not used */
  281. //* mp2 = NULL; not used */
  282. //* */
  283. //* */
  284. //* Returns TRUE if animation is active, else GB_ERROR */
  285. //* */
  286. //* */
  287. //************************************************************************/
  288. GBM_QUERYANIMATIONACTIVE = $052D;
  289. //************************************************************************/
  290. //* GBM_QUERYANIMATIONRATE */
  291. //************************************************************************/
  292. //* mp1 = NULL; not used */
  293. //* mp2 = NULL; not used */
  294. //* */
  295. //* */
  296. //* Returns ULONG sepcifying animation rate in milliseconds */
  297. //* */
  298. //* */
  299. //************************************************************************/
  300. GBM_QUERYANIMATIONRATE = $052E;
  301. //************************************************************************/
  302. //* GBM_SETBITMAPINDEX */
  303. //************************************************************************/
  304. //* mp1 = MPFROMSHORT(usGB_State) Bitmap index to change */
  305. //* GB_UP, */
  306. //* GB_DOWN, */
  307. //* GB_DISABLE, */
  308. //* GB_HILITE, */
  309. //* GB_ANIMATIONBEGIN, */
  310. //* GB_ANIMATIONEND, */
  311. //* or GB_CURRENTSTATE chng current state (up or down) bitmap*/
  312. //* mp2 = MPFROMSHORT(sFrameCode) Set according to code or frame desire */
  313. //* GB_INDEX_FORWARD, chng to next bitmap in circular array */
  314. //* GB_INDEX_BACKWARD, " " prev " " " " */
  315. //* GB_INDEX_FIRST, " " first " " " " */
  316. //* GB_INDEX_LAST, " " last " " " " */
  317. //* or desired_bitmap otherwise desired bmp index specified */
  318. //* */
  319. //* Returns TRUE on Success, otherwise FALSE */
  320. //* */
  321. //************************************************************************/
  322. GBM_SETBITMAPINDEX = $052F;
  323. //************************************************************************/
  324. //* GBM_QUERYBITMAPINDEX */
  325. //************************************************************************/
  326. //* mp1 = MPFROMSHORT(usGB_State) Query bitmap index */
  327. //* GB_UP, */
  328. //* GB_DOWN, */
  329. //* GB_DISABLE, */
  330. //* GB_HILITE, */
  331. //* GB_ANIMATIONBEGIN, */
  332. //* GB_ANIMATIONEND, */
  333. //* or GB_CURRENTSTATE query current state (up or down) bitmap */
  334. //* mp2 = NULL; not used */
  335. //* */
  336. //* Returns USHORT specifying the index */
  337. //* */
  338. //* */
  339. //************************************************************************/
  340. GBM_QUERYBITMAPINDEX = $0530;
  341. //************************************************************************/
  342. //* GBM_SETSTATE */
  343. //************************************************************************/
  344. //* mp1 = MPFROMSHORT(usStateCode) Set twostate button to specified */
  345. //* state */
  346. //* GB_UP, */
  347. //* GB_DOWN, */
  348. //* or GB_TOGGLE toggle (up/down) to (down/up) */
  349. //* mp2 = MPFROMBOOL(fRepaint) TRUE - state changed and displayed */
  350. //* FALSE - state changed, not displayed */
  351. //* */
  352. //* Returns TRUE on Success */
  353. //* FALSE on Failure */
  354. //* */
  355. //* */
  356. //************************************************************************/
  357. GBM_SETSTATE = $0531;
  358. //************************************************************************/
  359. //* GBM_QUERYSTATE */
  360. //************************************************************************/
  361. //* */
  362. //* mp1 = NULL not used */
  363. //* mp2 = NULL not used */
  364. //* */
  365. //* Returns the state (GB_UP or GB_DOWN) else GB_ERROR. */
  366. //* */
  367. //* */
  368. //************************************************************************/
  369. GBM_QUERYSTATE = $0532;
  370. //************************************************************************/
  371. //* GBM_SETTEXTPOSITION */
  372. //************************************************************************/
  373. //* mp1 = MPFROMSHORT(usTextPos) How to position text relative to */
  374. //* bitmap */
  375. //* GB_TEXTBELOW, */
  376. //* or GB_TEXTABOVE */
  377. //* mp2 = NULL not used */
  378. //* */
  379. //* Returns TRUE on Success, otherwise FALSE */
  380. //* */
  381. //************************************************************************/
  382. GBM_SETTEXTPOSITION = $0533;
  383. //************************************************************************/
  384. //* GBM_QUERYTEXTPOSITION */
  385. //************************************************************************/
  386. //* */
  387. //* mp1 = NULL not used */
  388. //* mp2 = NULL not used */
  389. //* */
  390. //* Returns GB_TEXTBELOW, GB_TEXTABOVE, GB_TEXTRIGHT, GB_TEXTLEFT */
  391. //* on success, otherwise FALSE */
  392. //* */
  393. //************************************************************************/
  394. GBM_QUERYTEXTPOSITION = $0534;
  395. //************************************************************************/
  396. //* GraphicButton END */
  397. //************************************************************************/
  398. MM_TABHELP = $054C;
  399. Implementation
  400. function WinSecondaryWindow(hwndParent: hwnd; hwndOwner: hwnd;
  401. pfnDlgProc: proc; hmod: Cardinal; idDlg: Cardinal; pCreateParams: Pointer): Cardinal; cdecl;
  402. external 'SW' index 1;
  403. function WinLoadSecondaryWindow(hwndParent: hwnd; hwndOwner: hwnd;
  404. pfnDlgProc: proc; hmod: Cardinal; idDlg: Cardinal; pCreateParams: Cardinal): hwnd; cdecl;
  405. external 'SW' index 2;
  406. function WinProcessSecondaryWindow(hwndSW: hwnd): Cardinal; cdecl;
  407. external 'SW' index 3;
  408. function WinCreateSecondaryWindow(hwndParent: hwnd; hwndOwner: hwnd;
  409. pfnDlgProc: proc; idDlg: Cardinal; pCreateParams: Pointer): hwnd; cdecl;
  410. external 'SW' index 4;
  411. function WinDefaultSize(Wnd: hwnd): Longbool; cdecl;
  412. external 'SW' index 11;
  413. function WinInsertDefaultSize(Wnd: hwnd; pszDefaultSize: pChar): Longbool; cdecl;
  414. external 'SW' index 12;
  415. function WinQuerySecondaryhwnd(Wnd: hwnd; ulFlag: Cardinal): hwnd; cdecl;
  416. external 'SW' index 52;
  417. function WinSecondaryMessageBox(hwndParent: hwnd; hwndOwner: hwnd;
  418. pszText: pChar; pszCaption: pChar; idWindow: Cardinal; smb: psmbinfo): Cardinal; cdecl;
  419. external 'SW' index 5;
  420. function WinDismissSecondaryWindow(hwndDlg: hwnd; ulResult: Cardinal): Longbool; cdecl;
  421. external 'SW' index 6;
  422. function WinDestroySecondaryWindow(Wnd: hwnd): Longbool; cdecl;
  423. external 'SW' index 7;
  424. function WinDefSecondaryWindowProc(Wnd: hwnd; msg: Cardinal;
  425. mp1: mParam; mp2: mParam): mResult; cdecl;
  426. external 'SW' index 8;
  427. Function WinRegisterGraphicButton: Longbool; cdecl;
  428. external 'SW' index 14;
  429. End.
  430. {
  431. $Log$
  432. Revision 1.3 2003-02-15 18:44:55 hajny
  433. * mmtk directory corrected to lowercase
  434. Revision 1.1 2003/02/15 16:59:09 hajny
  435. * mmtk directory corrected to lowercase
  436. Revision 1.1 2003/02/09 13:49:06 hajny
  437. + mmtk added
  438. }
  439. { No information about following functions
  440. Index Name
  441. ³ 00009 ³ WinQuerySecondaryFrame
  442. ³ 00010 ³ WinQuerySecondaryDialog
  443. ³ 00013 ³ WinRegisterCircularSlider
  444. ³ 00053 ³ WinQueryDefaultSize
  445. ³ 00057 ³ WinSWAssocResModule
  446. ³ 00060 ³ WinReportMessage
  447. ³ 00061 ³ WinRegisterSelectionSlider
  448. ³ 00067 ³ WinRegisterCircularSlider2
  449. }