workbench.pas 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951
  1. {
  2. This file is part of the Free Pascal run time library.
  3. A file in Amiga system run time library.
  4. Copyright (c) 1998-2003 by Nils Sjoholm
  5. member of the Amiga RTL development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {
  13. History:
  14. Added overlay functions for Pchar->Strings, functions
  15. and procedures.
  16. 14 Jul 2000.
  17. Changed tWBArg.wa_Lock from a pointer to a longint.
  18. 15 Aug 2000.
  19. Fixed tDiskObject.
  20. Member tDiskObject.do_CurrentX was defined as a pointer,
  21. should be longint.
  22. 17 Aug 2000.
  23. Added functions and procedures with array of const.
  24. For use with fpc 1.0.7. Thay are in systemvartags.
  25. 05 Nov 2002.
  26. Removed amigaoverlays, use smartlink instead.
  27. 05 Nov 2002.
  28. Added the defines use_amiga_smartlink and
  29. use_auto_openlib. Implemented autoopening of
  30. the library.
  31. 14 Jan 2003.
  32. Update for AmigaOS 3.9.
  33. A lot of new const and new records.
  34. New functions
  35. FUNCTION AddAppWindowDropZoneA
  36. FUNCTION ChangeWorkbenchSelectionA
  37. FUNCTION CloseWorkbenchObjectA
  38. FUNCTION MakeWorkbenchObjectVisibleA
  39. FUNCTION OpenWorkbenchObjectA
  40. FUNCTION RemoveAppWindowDropZone
  41. FUNCTION WorkbenchControlA
  42. Varargs functions are in systemvartags.
  43. 02 Feb 2003.
  44. Changed integer > smallint,
  45. cardinal > longword.
  46. 09 Feb 2003.
  47. [email protected]
  48. }
  49. {$PACKRECORDS 2}
  50. unit workbench;
  51. INTERFACE
  52. uses exec,amigados,utility,intuition,agraphics;
  53. Type
  54. pWBArg = ^tWBArg;
  55. tWBArg = record
  56. wa_Lock : BPTR; { a lock descriptor }
  57. wa_Name : STRPTR; { a string relative to that lock }
  58. end;
  59. WBArgList = Array [1..100] of tWBArg; { Only 1..smNumArgs are valid }
  60. pWBArgList = ^WBArgList;
  61. pWBStartup = ^tWBStartup;
  62. tWBStartup = record
  63. sm_Message : tMessage; { a standard message structure }
  64. sm_Process : pMsgPort; { the process descriptor for you }
  65. sm_Segment : BPTR; { a descriptor for your code }
  66. sm_NumArgs : Longint; { the number of elements in ArgList }
  67. sm_ToolWindow : STRPTR; { description of window }
  68. sm_ArgList : pWBArgList; { the arguments themselves }
  69. end;
  70. Const
  71. WBDISK = 1;
  72. WBDRAWER = 2;
  73. WBTOOL = 3;
  74. WBPROJECT = 4;
  75. WBGARBAGE = 5;
  76. WBDEVICE = 6;
  77. WBKICK = 7;
  78. WBAPPICON = 8;
  79. Type
  80. pOldDrawerData = ^tOldDrawerData;
  81. tOldDrawerData = record
  82. dd_NewWindow : tNewWindow; { args to open window }
  83. dd_CurrentX : Longint; { current x coordinate of origin }
  84. dd_CurrentY : Longint; { current y coordinate of origin }
  85. end;
  86. Const
  87. { the amount of DrawerData actually written to disk }
  88. OLDDRAWERDATAFILESIZE = 56; { sizeof(OldDrawerData) }
  89. Type
  90. pDrawerData = ^tDrawerData;
  91. tDrawerData = record
  92. dd_NewWindow : tNewWindow; { args to open window }
  93. dd_CurrentX : Longint; { current x coordinate of origin }
  94. dd_CurrentY : Longint; { current y coordinate of origin }
  95. dd_Flags : Longint; { flags for drawer }
  96. dd_ViewModes : Word; { view mode for drawer }
  97. end;
  98. Const
  99. { the amount of DrawerData actually written to disk }
  100. DRAWERDATAFILESIZE = 62; { sizeof(DrawerData) }
  101. DDVM_BYDEFAULT = 0;
  102. { view as icons }
  103. DDVM_BYICON = 1;
  104. { view as text, sorted by name }
  105. DDVM_BYNAME = 2;
  106. { view as text, sorted by date }
  107. DDVM_BYDATE = 3;
  108. { view as text, sorted by size }
  109. DDVM_BYSIZE = 4;
  110. { view as text, sorted by type }
  111. DDVM_BYTYPE = 5;
  112. { definitions for dd_Flags }
  113. { default (show only icons) }
  114. DDFLAGS_SHOWDEFAULT = 0;
  115. { show only icons }
  116. DDFLAGS_SHOWICONS = 1;
  117. { show all files }
  118. DDFLAGS_SHOWALL = 2;
  119. Type
  120. pDiskObject = ^tDiskObject;
  121. tDiskObject = record
  122. do_Magic : Word; { a magic number at the start of the file }
  123. do_Version : Word; { a version number, so we can change it }
  124. do_Gadget : tGadget; { a copy of in core gadget }
  125. do_Type : Byte;
  126. do_DefaultTool : STRPTR;
  127. do_ToolTypes : Pointer;
  128. do_CurrentX : Longint;
  129. do_CurrentY : Longint;
  130. do_DrawerData : pDrawerData;
  131. do_ToolWindow : STRPTR; { only applies to tools }
  132. do_StackSize : Longint; { only applies to tools }
  133. end;
  134. Const
  135. WB_DISKMAGIC = $e310; { a magic number, not easily impersonated }
  136. WB_DISKVERSION = 1; { our current version number }
  137. WB_DISKREVISION = 1; { our current revision number }
  138. {I only use the lower 8 bits of Gadget.UserData for the revision # }
  139. WB_DISKREVISIONMASK = 255;
  140. Type
  141. pFreeList = ^tFreeList;
  142. tFreeList = record
  143. fl_NumFree : smallint;
  144. fl_MemList : tList;
  145. end;
  146. Const
  147. { each message that comes into the WorkBenchPort must have a type field
  148. * in the preceeding short. These are the defines for this type
  149. }
  150. MTYPE_PSTD = 1; { a "standard Potion" message }
  151. MTYPE_TOOLEXIT = 2; { exit message from our tools }
  152. MTYPE_DISKCHANGE = 3; { dos telling us of a disk change }
  153. MTYPE_TIMER = 4; { we got a timer tick }
  154. MTYPE_CLOSEDOWN = 5; { <unimplemented> }
  155. MTYPE_IOPROC = 6; { <unimplemented> }
  156. MTYPE_APPWINDOW = 7; { msg from an app window }
  157. MTYPE_APPICON = 8; { msg from an app icon }
  158. MTYPE_APPMENUITEM = 9; { msg from an app menuitem }
  159. MTYPE_COPYEXIT = 10; { exit msg from copy process }
  160. MTYPE_ICONPUT = 11; { msg from PutDiskObject in icon.library }
  161. { workbench does different complement modes for its gadgets.
  162. * It supports separate images, complement mode, and backfill mode.
  163. * The first two are identical to intuitions GADGIMAGE and GADGHCOMP.
  164. * backfill is similar to GADGHCOMP, but the region outside of the
  165. * image (which normally would be color three when complemented)
  166. * is flood-filled to color zero.
  167. }
  168. GFLG_GADGBACKFILL = $0001;
  169. GADGBACKFILL = $0001; { an old synonym }
  170. { if an icon does not really live anywhere, set its current position
  171. * to here
  172. }
  173. NO_ICON_POSITION = $80000000;
  174. { If you find am_Version >= AM_VERSION, you know this structure has
  175. * at least the fields defined in this version of the include file
  176. }
  177. AM_VERSION = 1;
  178. Type
  179. pAppMessage = ^tAppMessage;
  180. tAppMessage = record
  181. am_Message : tMessage; { standard message structure }
  182. am_Type : Word; { message type }
  183. am_UserData : ULONG; { application specific }
  184. am_ID : ULONG; { application definable ID }
  185. am_NumArgs : ULONG; { # of elements in arglist }
  186. am_ArgList : pWBArgList; { the arguements themselves }
  187. am_Version : Word; { will be AM_VERSION }
  188. am_Class : Word; { message class }
  189. am_MouseX : smallint; { mouse x position of event }
  190. am_MouseY : smallint; { mouse y position of event }
  191. am_Seconds : ULONG; { current system clock time }
  192. am_Micros : ULONG; { current system clock time }
  193. am_Reserved : Array[0..7] of ULONG; { avoid recompilation }
  194. END;
  195. {* types of app messages *}
  196. const
  197. AMTYPE_APPWINDOW = 7; {* app window message *}
  198. AMTYPE_APPICON = 8; {* app icon message *}
  199. AMTYPE_APPMENUITEM = 9; {* app menu item message *}
  200. { Classes of AppIcon messages (V44) }
  201. { The "Open" menu item was invoked,
  202. the icon got double-clicked or an
  203. icon got dropped on it.
  204. }
  205. AMCLASSICON_Open = 0;
  206. { The "Copy" menu item was invoked }
  207. AMCLASSICON_Copy = 1;
  208. { The "Rename" menu item was invoked }
  209. AMCLASSICON_Rename = 2;
  210. { The "Information" menu item was invoked }
  211. AMCLASSICON_Information = 3;
  212. { The "Snapshot" menu item was invoked }
  213. AMCLASSICON_Snapshot = 4;
  214. { The "UnSnapshot" menu item was invoked }
  215. AMCLASSICON_UnSnapshot = 5;
  216. { The "Leave Out" menu item was invoked }
  217. AMCLASSICON_LeaveOut = 6;
  218. { The "Put Away" menu item was invoked }
  219. AMCLASSICON_PutAway = 7;
  220. { The "Delete" menu item was invoked }
  221. AMCLASSICON_Delete = 8;
  222. { The "Format Disk" menu item was invoked }
  223. AMCLASSICON_FormatDisk = 9;
  224. { The "Empty Trash" menu item was invoked }
  225. AMCLASSICON_EmptyTrash = 10;
  226. { The icon is now selected }
  227. AMCLASSICON_Selected = 11;
  228. { The icon is now unselected }
  229. AMCLASSICON_Unselected = 12;
  230. {
  231. * The following structures are private. These are just stub
  232. * structures for code compatibility...
  233. }
  234. type
  235. tAppWindow = record
  236. aw_PRIVATE : Pointer;
  237. END;
  238. pAppWindow = ^tAppWindow;
  239. tAppIcon = record
  240. ai_PRIVATE : Pointer;
  241. END;
  242. pAppIcon = ^tAppIcon;
  243. tAppMenuItem = record
  244. ami_PRIVATE : Pointer;
  245. END;
  246. pAppMenuItem = ^tAppMenuItem;
  247. PAppWindowDropZone = ^tAppWindowDropZone;
  248. tAppWindowDropZone = record
  249. awdz_PRIVATE : pointer;
  250. end;
  251. PAppMenu = ^tAppMenu;
  252. tAppMenu = record
  253. am_PRIVATE : pointer;
  254. end;
  255. const
  256. WBA_Dummy = TAG_USER + $A000;
  257. { }
  258. { Tags for use with AddAppIconA() }
  259. { AppIcon responds to the "Open" menu item (BOOL). }
  260. WBAPPICONA_SupportsOpen = WBA_Dummy + 1;
  261. { AppIcon responds to the "Copy" menu item (BOOL). }
  262. WBAPPICONA_SupportsCopy = WBA_Dummy + 2;
  263. { AppIcon responds to the "Rename" menu item (BOOL). }
  264. WBAPPICONA_SupportsRename = WBA_Dummy + 3;
  265. { AppIcon responds to the "Information" menu item (BOOL). }
  266. WBAPPICONA_SupportsInformation = WBA_Dummy + 4;
  267. { AppIcon responds to the "Snapshot" menu item (BOOL). }
  268. WBAPPICONA_SupportsSnapshot = WBA_Dummy + 5;
  269. { AppIcon responds to the "UnSnapshot" menu item (BOOL). }
  270. WBAPPICONA_SupportsUnSnapshot = WBA_Dummy + 6;
  271. { AppIcon responds to the "LeaveOut" menu item (BOOL). }
  272. WBAPPICONA_SupportsLeaveOut = WBA_Dummy + 7;
  273. { AppIcon responds to the "PutAway" menu item (BOOL). }
  274. WBAPPICONA_SupportsPutAway = WBA_Dummy + 8;
  275. { AppIcon responds to the "Delete" menu item (BOOL). }
  276. WBAPPICONA_SupportsDelete = WBA_Dummy + 9;
  277. { AppIcon responds to the "FormatDisk" menu item (BOOL). }
  278. WBAPPICONA_SupportsFormatDisk = WBA_Dummy + 10;
  279. { AppIcon responds to the "EmptyTrash" menu item (BOOL). }
  280. WBAPPICONA_SupportsEmptyTrash = WBA_Dummy + 11;
  281. { AppIcon position should be propagated back to original DiskObject (BOOL). }
  282. WBAPPICONA_PropagatePosition = WBA_Dummy + 12;
  283. { Callback hook to be invoked when rendering this icon (struct Hook ). }
  284. WBAPPICONA_RenderHook = WBA_Dummy + 13;
  285. { AppIcon wants to be notified when its select state changes (BOOL). }
  286. WBAPPICONA_NotifySelectState = WBA_Dummy + 14;
  287. {**************************************************************************}
  288. { Tags for use with AddAppMenuA() }
  289. { Command key string for this AppMenu (STRPTR). }
  290. WBAPPMENUA_CommandKeyString = WBA_Dummy + 15;
  291. { Item to be added should get sub menu items attached to; make room for it,
  292. then return the key to use later for attaching the items (ULONG ).
  293. }
  294. WBAPPMENUA_GetKey = WBA_Dummy + 65;
  295. { This item should be attached to a sub menu; the key provided refers to
  296. the sub menu it should be attached to (ULONG).
  297. }
  298. WBAPPMENUA_UseKey = WBA_Dummy + 66;
  299. { Item to be added is in fact a new menu title; make room for it, then
  300. return the key to use later for attaching the items (ULONG ).
  301. }
  302. WBAPPMENUA_GetTitleKey = WBA_Dummy + 77;
  303. {**************************************************************************}
  304. { Tags for use with OpenWorkbenchObjectA() }
  305. { Corresponds to the wa_Lock member of a struct WBArg }
  306. WBOPENA_ArgLock = WBA_Dummy + 16;
  307. { Corresponds to the wa_Name member of a struct WBArg }
  308. WBOPENA_ArgName = WBA_Dummy + 17;
  309. { When opening a drawer, show all files or only icons?
  310. This must be one out of DDFLAGS_SHOWICONS,
  311. or DDFLAGS_SHOWALL; (UBYTE); (V45)
  312. }
  313. WBOPENA_Show = WBA_Dummy + 75;
  314. { When opening a drawer, view the contents by icon, name,
  315. date, size or type? This must be one out of DDVM_BYICON,
  316. DDVM_BYNAME, DDVM_BYDATE, DDVM_BYSIZE or DDVM_BYTYPE;
  317. (UBYTE); (V45)
  318. }
  319. WBOPENA_ViewBy = WBA_Dummy + 76;
  320. {**************************************************************************}
  321. { Tags for use with WorkbenchControlA() }
  322. { Check if the named drawer is currently open (LONG ). }
  323. WBCTRLA_IsOpen = WBA_Dummy + 18;
  324. { Create a duplicate of the Workbench private search path list (BPTR ). }
  325. WBCTRLA_DuplicateSearchPath = WBA_Dummy + 19;
  326. { Free the duplicated search path list (BPTR). }
  327. WBCTRLA_FreeSearchPath = WBA_Dummy + 20;
  328. { Get the default stack size for launching programs with (ULONG ). }
  329. WBCTRLA_GetDefaultStackSize = WBA_Dummy + 21;
  330. { Set the default stack size for launching programs with (ULONG). }
  331. WBCTRLA_SetDefaultStackSize = WBA_Dummy + 22;
  332. { Cause an AppIcon to be redrawn (struct AppIcon ). }
  333. WBCTRLA_RedrawAppIcon = WBA_Dummy + 23;
  334. { Get a list of currently running Workbench programs (struct List ). }
  335. WBCTRLA_GetProgramList = WBA_Dummy + 24;
  336. { Release the list of currently running Workbench programs (struct List ). }
  337. WBCTRLA_FreeProgramList = WBA_Dummy + 25;
  338. { Get a list of currently selected icons (struct List ). }
  339. WBCTRLA_GetSelectedIconList = WBA_Dummy + 36;
  340. { Release the list of currently selected icons (struct List ). }
  341. WBCTRLA_FreeSelectedIconList = WBA_Dummy + 37;
  342. { Get a list of currently open drawers (struct List ). }
  343. WBCTRLA_GetOpenDrawerList = WBA_Dummy + 38;
  344. { Release the list of currently open icons (struct List ). }
  345. WBCTRLA_FreeOpenDrawerList = WBA_Dummy + 39;
  346. { Get the list of hidden devices (struct List ). }
  347. WBCTRLA_GetHiddenDeviceList = WBA_Dummy + 42;
  348. { Release the list of hidden devices (struct List ). }
  349. WBCTRLA_FreeHiddenDeviceList = WBA_Dummy + 43;
  350. { Add the name of a device which Workbench should never try to
  351. read a disk icon from (STRPTR).
  352. }
  353. WBCTRLA_AddHiddenDeviceName = WBA_Dummy + 44;
  354. { Remove a name from list of hidden devices (STRPTR). }
  355. WBCTRLA_RemoveHiddenDeviceName = WBA_Dummy + 45;
  356. { Get the number of seconds that have to pass before typing
  357. the next character in a drawer window will restart
  358. with a new file name (ULONG ).
  359. }
  360. WBCTRLA_GetTypeRestartTime = WBA_Dummy + 47;
  361. { Set the number of seconds that have to pass before typing
  362. the next character in a drawer window will restart
  363. with a new file name (ULONG).
  364. }
  365. WBCTRLA_SetTypeRestartTime = WBA_Dummy + 48;
  366. { Obtain the hook that will be invoked when Workbench starts
  367. to copy files and data (struct Hook ); (V45)
  368. }
  369. WBCTRLA_GetCopyHook = WBA_Dummy + 69;
  370. { Install the hook that will be invoked when Workbench starts
  371. to copy files and data (struct Hook ); (V45)
  372. }
  373. WBCTRLA_SetCopyHook = WBA_Dummy + 70;
  374. { Obtain the hook that will be invoked when Workbench discards
  375. files and drawers or empties the trashcan (struct Hook );
  376. (V45).
  377. }
  378. WBCTRLA_GetDeleteHook = WBA_Dummy + 71;
  379. { Install the hook that will be invoked when Workbench discards
  380. files and drawers or empties the trashcan (struct Hook );
  381. (V45).
  382. }
  383. WBCTRLA_SetDeleteHook = WBA_Dummy + 72;
  384. { Obtain the hook that will be invoked when Workbench requests
  385. that the user enters text, such as when a file is to be renamed
  386. or a new drawer is to be created (struct Hook ); (V45)
  387. }
  388. WBCTRLA_GetTextInputHook = WBA_Dummy + 73;
  389. { Install the hook that will be invoked when Workbench requests
  390. that the user enters text, such as when a file is to be renamed
  391. or a new drawer is to be created (struct Hook ); (V45)
  392. }
  393. WBCTRLA_SetTextInputHook = WBA_Dummy + 74;
  394. { Add a hook that will be invoked when Workbench is about
  395. to shut down (cleanup), and when Workbench has returned
  396. to operational state (setup) (struct Hook ); (V45)
  397. }
  398. WBCTRLA_AddSetupCleanupHook = WBA_Dummy + 78;
  399. { Remove a hook that has been installed with the
  400. WBCTRLA_AddSetupCleanupHook tag (struct Hook ); (V45)
  401. }
  402. WBCTRLA_RemSetupCleanupHook = WBA_Dummy + 79;
  403. {**************************************************************************}
  404. { The message your setup/cleanup hook gets invoked with. }
  405. type
  406. PSetupCleanupHookMsg = ^tSetupCleanupHookMsg;
  407. tSetupCleanupHookMsg = record
  408. schm_Length : ULONG;
  409. schm_State : LONG;
  410. end;
  411. const
  412. { Workbench will attempt to shut down now. }
  413. SCHMSTATE_TryCleanup = 0;
  414. { Workbench will really shut down now. }
  415. SCHMSTATE_Cleanup = 1;
  416. { Workbench is operational again or
  417. could not be shut down.
  418. }
  419. SCHMSTATE_Setup = 2;
  420. {**************************************************************************}
  421. { Tags for use with AddAppWindowDropZoneA() }
  422. { Zone left edge (WORD) }
  423. WBDZA_Left = WBA_Dummy + 26;
  424. { Zone left edge, if relative to the right edge of the window (WORD) }
  425. WBDZA_RelRight = WBA_Dummy + 27;
  426. { Zone top edge (WORD) }
  427. WBDZA_Top = WBA_Dummy + 28;
  428. { Zone top edge, if relative to the bottom edge of the window (WORD) }
  429. WBDZA_RelBottom = WBA_Dummy + 29;
  430. { Zone width (WORD) }
  431. WBDZA_Width = WBA_Dummy + 30;
  432. { Zone width, if relative to the window width (WORD) }
  433. WBDZA_RelWidth = WBA_Dummy + 31;
  434. { Zone height (WORD) }
  435. WBDZA_Height = WBA_Dummy + 32;
  436. { Zone height, if relative to the window height (WORD) }
  437. WBDZA_RelHeight = WBA_Dummy + 33;
  438. { Zone position and size (struct IBox ). }
  439. WBDZA_Box = WBA_Dummy + 34;
  440. { Hook to invoke when the mouse enters or leave a drop zone (struct Hook ). }
  441. WBDZA_Hook = WBA_Dummy + 35;
  442. {**************************************************************************}
  443. { Reserved tags; don't use! }
  444. WBA_Reserved1 = WBA_Dummy + 40;
  445. WBA_Reserved2 = WBA_Dummy + 41;
  446. WBA_Reserved3 = WBA_Dummy + 46;
  447. WBA_Reserved4 = WBA_Dummy + 49;
  448. WBA_Reserved5 = WBA_Dummy + 50;
  449. WBA_Reserved6 = WBA_Dummy + 51;
  450. WBA_Reserved7 = WBA_Dummy + 52;
  451. WBA_Reserved8 = WBA_Dummy + 53;
  452. WBA_Reserved9 = WBA_Dummy + 54;
  453. WBA_Reserved10 = WBA_Dummy + 55;
  454. WBA_Reserved11 = WBA_Dummy + 56;
  455. WBA_Reserved12 = WBA_Dummy + 57;
  456. WBA_Reserved13 = WBA_Dummy + 58;
  457. WBA_Reserved14 = WBA_Dummy + 59;
  458. WBA_Reserved15 = WBA_Dummy + 60;
  459. WBA_Reserved16 = WBA_Dummy + 61;
  460. WBA_Reserved17 = WBA_Dummy + 62;
  461. WBA_Reserved18 = WBA_Dummy + 63;
  462. WBA_Reserved19 = WBA_Dummy + 64;
  463. WBA_Reserved20 = WBA_Dummy + 67;
  464. WBA_Reserved21 = WBA_Dummy + 68;
  465. {**************************************************************************}
  466. WBA_LAST_TAG = WBA_Dummy + 79;
  467. {**************************************************************************}
  468. { The message your AppIcon rendering hook gets invoked with. }
  469. type
  470. PAppIconRenderMsg = ^tAppIconRenderMsg;
  471. tAppIconRenderMsg = record
  472. arm_RastPort : PRastPort; { RastPort to render into }
  473. arm_Icon : PDiskObject; { The icon to be rendered }
  474. arm_Label : STRPTR; { The icon label txt }
  475. arm_Tags : PTagItem; { Further tags to be passed on
  476. * to DrawIconStateA().
  477. }
  478. arm_Left : WORD; { \ Rendering origin, not taking the }
  479. arm_Top : WORD; { / button border into account. }
  480. arm_Width : WORD; { \ Limit your rendering to }
  481. arm_Height : WORD; { / this area. }
  482. arm_State : ULONG; { IDS_SELECTED, IDS_NORMAL, etc. }
  483. end;
  484. { The message your drop zone hook gets invoked with. }
  485. PAppWindowDropZoneMsg = ^tAppWindowDropZoneMsg;
  486. tAppWindowDropZoneMsg = record
  487. adzm_RastPort : PRastPort; { RastPort to render into. }
  488. adzm_DropZoneBox : tIBox; { Limit your rendering to this area. }
  489. adzm_ID : ULONG; { \ These come from straight }
  490. adzm_UserData : ULONG; { / from AddAppWindowDropZoneA(). }
  491. adzm_Action : LONG; { See below for a list of actions. }
  492. end;
  493. const
  494. ADZMACTION_Enter = 0;
  495. ADZMACTION_Leave = 1;
  496. {**************************************************************************}
  497. { The message your icon selection change hook is invoked with. }
  498. type
  499. PIconSelectMsg = ^tIconSelectMsg;
  500. tIconSelectMsg = record
  501. { Size of this data structure (in bytes). }
  502. ism_Length : ULONG;
  503. { Lock on the drawer this object resides in,
  504. * NULL for Workbench backdrop (devices).
  505. }
  506. ism_Drawer : BPTR;
  507. { Name of the object in question. }
  508. ism_Name : STRPTR;
  509. { One of WBDISK, WBDRAWER, WBTOOL, WBPROJECT,
  510. * WBGARBAGE, WBDEVICE, WBKICK or WBAPPICON.
  511. }
  512. ism_Type : UWORD;
  513. { TRUE if currently selected, FALSE otherwise. }
  514. ism_Selected : BOOL;
  515. { Pointer to the list of tag items passed to
  516. * ChangeWorkbenchSelectionA().
  517. }
  518. ism_Tags : PTagItem;
  519. { Pointer to the window attached to this icon,
  520. * if the icon is a drawer-like object.
  521. }
  522. ism_DrawerWindow : PWindow;
  523. { Pointer to the window the icon resides in. }
  524. ism_ParentWindow : PWindow;
  525. { Position and size of the icon; note that the
  526. * icon may not entirely reside within the visible
  527. * bounds of the parent window.
  528. }
  529. ism_Left : WORD;
  530. ism_Top : WORD;
  531. ism_Width : WORD;
  532. ism_Height : WORD;
  533. end;
  534. { These are the values your hook code can return. }
  535. const
  536. { Unselect the icon }
  537. ISMACTION_Unselect = 0;
  538. { Select the icon }
  539. ISMACTION_Select = 1;
  540. { Do not change the selection state. }
  541. ISMACTION_Ignore = 2;
  542. { Do not invoke the hook code again,
  543. leave the icon as it is.
  544. }
  545. ISMACTION_Stop = 3;
  546. {**************************************************************************}
  547. { The messages your copy hook is invoked with. }
  548. type
  549. PCopyBeginMsg = ^tCopyBeginMsg;
  550. tCopyBeginMsg = record
  551. cbm_Length : ULONG; { Size of this data structure in bytes. }
  552. cbm_Action : LONG; { Will be set to CPACTION_Begin (see below). }
  553. cbm_SourceDrawer : BPTR; { A lock on the source drawer. }
  554. cbm_DestinationDrawer : BPTR; { A lock on the destination drawer. }
  555. end;
  556. PCopyDataMsg = ^tCopyDataMsg;
  557. tCopyDataMsg = record
  558. cdm_Length : ULONG; { Size of this data structure in bytes. }
  559. cdm_Action : LONG; { Will be set to CPACTION_Copy (see below). }
  560. cdm_SourceLock : BPTR; { A lock on the parent directory of the
  561. * source file/drawer.
  562. }
  563. cdm_SourceName : STRPTR; { The name of the source file or drawer. }
  564. cdm_DestinationLock : BPTR; { A lock on the parent directory of the
  565. * destination file/drawer.
  566. }
  567. cdm_DestinationName : STRPTR; { The name of the destination file/drawer.
  568. * This may or may not match the name of
  569. * the source file/drawer in case the
  570. * data is to be copied under a different
  571. * name. For example, this is the case
  572. * with the Workbench "Copy" command which
  573. * creates duplicates of file/drawers by
  574. * prefixing the duplicate's name with
  575. * "Copy_XXX_of".
  576. }
  577. cdm_DestinationX : LONG; { When the icon corresponding to the
  578. * destination is written to disk, this
  579. * is the position (put into its
  580. * DiskObject->do_CurrentX/DiskObject->do_CurrentY
  581. * fields) it should be placed at.
  582. }
  583. cdm_DestinationY : LONG;
  584. end;
  585. PCopyEndMsg = ^tCopyEndMsg;
  586. tCopyEndMsg = record
  587. cem_Length : ULONG; { Size of this data structure in bytes. }
  588. cem_Action : LONG; { Will be set to CPACTION_End (see below). }
  589. end;
  590. const
  591. CPACTION_Begin = 0;
  592. { This message arrives for each file or
  593. drawer to be copied.
  594. }
  595. CPACTION_Copy = 1;
  596. { This message arrives when all files/drawers
  597. have been copied.
  598. }
  599. CPACTION_End = 2;
  600. {**************************************************************************}
  601. { The messages your delete hook is invoked with. }
  602. type
  603. PDeleteBeginMsg = ^tDeleteBeginMsg;
  604. tDeleteBeginMsg = record
  605. dbm_Length : ULONG; { Size of this data structure in bytes. }
  606. dbm_Action : LONG; { Will be set to either DLACTION_BeginDiscard
  607. * or DLACTION_BeginEmptyTrash (see below).
  608. }
  609. end;
  610. PDeleteDataMsg = ^tDeleteDataMsg;
  611. tDeleteDataMsg = record
  612. ddm_Length : ULONG; { Size of this data structure in bytes. }
  613. ddm_Action : LONG; { Will be set to either DLACTION_DeleteContents
  614. * or DLACTION_DeleteObject (see below).
  615. }
  616. ddm_Lock : BPTR; { A Lock on the parent directory of the object
  617. * whose contents or which itself should be
  618. * deleted.
  619. }
  620. ddm_Name : STRPTR; { The name of the object whose contents or
  621. * which itself should be deleted.
  622. }
  623. end;
  624. PDeleteEndMsg = ^tDeleteEndMsg;
  625. tDeleteEndMsg = record
  626. dem_Length : ULONG; { Size of this data structure in bytes. }
  627. dem_Action : LONG; { Will be set to DLACTION_End (see below). }
  628. end;
  629. const
  630. DLACTION_BeginDiscard = 0;
  631. { This indicates that the following
  632. delete operations are intended to
  633. empty the trashcan.
  634. }
  635. DLACTION_BeginEmptyTrash = 1;
  636. { This indicates that the object
  637. described by lock and name refers
  638. to a drawer; you should empty its
  639. contents but DO NOT delete the
  640. drawer itself!
  641. }
  642. DLACTION_DeleteContents = 3;
  643. { This indicates that the object
  644. described by lock and name should
  645. be deleted; this could be a file
  646. or an empty drawer.
  647. }
  648. DLACTION_DeleteObject = 4;
  649. { This indicates that the
  650. deletion process is finished.
  651. }
  652. DLACTION_End = 5;
  653. {**************************************************************************}
  654. { The messages your text input hook is invoked with. }
  655. type
  656. PTextInputMsg = ^tTextInputMsg;
  657. tTextInputMsg = record
  658. tim_Length : ULONG; { Size of this data structure
  659. * in bytes.
  660. }
  661. tim_Action : LONG; { One of the TIACTION_...
  662. * values listed below.
  663. }
  664. tim_Prompt : STRPTR; { The Workbench suggested
  665. * result, depending on what
  666. * kind of input is requested
  667. * (as indicated by the
  668. * tim_Action member).
  669. }
  670. end;
  671. const
  672. { A file or drawer is to be
  673. * renamed.
  674. }
  675. TIACTION_Rename = 0;
  676. { A volume is to be relabeled. }
  677. TIACTION_RelabelVolume = 1;
  678. { A new drawer is to be created. }
  679. TIACTION_NewDrawer = 2;
  680. { A program or script is to be
  681. executed.
  682. }
  683. TIACTION_Execute = 3;
  684. {**************************************************************************}
  685. { Parameters for the UpdateWorkbench() function. }
  686. { Object has been deleted. }
  687. UPDATEWB_ObjectRemoved = 0;
  688. { Object is new or has changed. }
  689. UPDATEWB_ObjectAdded = 1;
  690. WORKBENCHNAME : PChar = 'workbench.library';
  691. VAR
  692. WorkbenchBase : pLibrary = nil;
  693. FUNCTION AddAppIconA(id : ULONG location 'd0'; userdata : ULONG location 'd1'; text_ : pCHAR location 'a0'; msgport : pMsgPort location 'a1'; lock : BPTR location 'a2'; diskobj : pDiskObject location 'a3'; const taglist : pTagItem location 'a4') : pAppIcon; syscall WorkbenchBase 060;
  694. FUNCTION AddAppMenuItemA(id : ULONG location 'd0'; userdata : ULONG location 'd1'; text_ : pCHAR location 'a0'; msgport : pMsgPort location 'a1'; const taglist : pTagItem location 'a2') : pAppMenuItem; syscall WorkbenchBase 072;
  695. FUNCTION AddAppWindowA(id : ULONG location 'd0'; userdata : ULONG location 'd1'; window : pWindow location 'a0'; msgport : pMsgPort location 'a1'; const taglist : pTagItem location 'a2') : pAppWindow; syscall WorkbenchBase 042;
  696. FUNCTION RemoveAppIcon(appIcon : pAppIcon location 'a0') : longbool; syscall WorkbenchBase 066;
  697. FUNCTION RemoveAppMenuItem(appMenuItem : pAppMenuItem location 'a0') : longbool; syscall WorkbenchBase 078;
  698. FUNCTION RemoveAppWindow(appWindow : pAppWindow location 'a0') : longbool; syscall WorkbenchBase 054;
  699. PROCEDURE WBInfo(lock : BPTR location 'a0'; name : pCHAR location 'a1'; screen : pScreen location 'a2'); syscall WorkbenchBase 090;
  700. FUNCTION AddAppWindowDropZoneA(aw : pAppWindow location 'a0'; id : longword location 'd0'; userdata : longword location 'd1'; const tags : pTagItem location 'a1') : pAppWindowDropZone; syscall WorkbenchBase 114;
  701. FUNCTION ChangeWorkbenchSelectionA(name : pCHAR location 'a0'; hook : pHook location 'a1'; const tags : pTagItem location 'a2') : longbool; syscall WorkbenchBase 126;
  702. FUNCTION CloseWorkbenchObjectA(name : pCHAR location 'a0'; const tags : pTagItem location 'a1') : longbool; syscall WorkbenchBase 102;
  703. FUNCTION MakeWorkbenchObjectVisibleA(name : pCHAR location 'a0'; const tags : pTagItem location 'a1') : longbool; syscall WorkbenchBase 132;
  704. FUNCTION OpenWorkbenchObjectA(name : pCHAR location 'a0'; const tags : pTagItem location 'a1') : longbool; syscall WorkbenchBase 096;
  705. FUNCTION RemoveAppWindowDropZone(aw : pAppWindow location 'a0'; dropZone : pAppWindowDropZone location 'a1') : longbool; syscall WorkbenchBase 120;
  706. FUNCTION WorkbenchControlA(name : pCHAR location 'a0'; const tags : pTagItem location 'a1') : longbool; syscall WorkbenchBase 108;
  707. FUNCTION AddAppIcon(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort; lock: BPTR; diskobj : pDiskObject; const taglist : array of PtrUInt) : pAppIcon;
  708. function AddAppMenuItem(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort; Const argv : array of PtrUInt) : pAppMenuItem;
  709. function AddAppWindow(id : ULONG; userdata : ULONG; window : pWindow; msgport : pMsgPort; Const argv : array of PtrUInt) : pAppWindow;
  710. { overlays }
  711. FUNCTION AddAppIconA(id : ULONG; userdata : ULONG; const text_ : RawByteString; msgport : pMsgPort; lock : BPTR; diskobj : pDiskObject;const taglist : pTagItem) : pAppIcon;
  712. FUNCTION AddAppMenuItemA(id : ULONG; userdata : ULONG; const text_ : RawByteString; msgport : pMsgPort;const taglist : pTagItem) : pAppMenuItem;
  713. PROCEDURE WBInfo(lock : BPTR; const name : RawByteString; screen : pScreen);
  714. FUNCTION ChangeWorkbenchSelectionA(const name : RawByteString; hook : pHook; const tags : pTagItem) : BOOLEAN;
  715. FUNCTION CloseWorkbenchObjectA(const name : RawByteString; const tags : pTagItem) : BOOLEAN;
  716. FUNCTION MakeWorkbenchObjectVisibleA(const name : RawByteString;const tags : pTagItem) : BOOLEAN;
  717. FUNCTION OpenWorkbenchObjectA(const name : RawByteString;const tags : pTagItem) : BOOLEAN;
  718. FUNCTION WorkbenchControlA(const name : RawByteString;const tags : pTagItem) : BOOLEAN;
  719. IMPLEMENTATION
  720. FUNCTION AddAppIcon(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort; lock: BPTR; diskobj : pDiskObject; const taglist : array of PtrUInt) : pAppIcon;
  721. begin
  722. AddAppIcon := AddAppIconA(id, userdata, text_, msgport, lock, diskobj, @taglist);
  723. end;
  724. function AddAppMenuItem(id : ULONG; userdata : ULONG; text_ : pCHAR; msgport : pMsgPort; Const argv : array of PtrUInt) : pAppMenuItem;
  725. begin
  726. AddAppMenuItem := AddAppMenuItemA(id,userdata,text_,msgport,@argv);
  727. end;
  728. function AddAppWindow(id : ULONG; userdata : ULONG; window : pWindow; msgport : pMsgPort; Const argv : array of PtrUInt) : pAppWindow;
  729. begin
  730. AddAppWindow := AddAppWindowA(id,userdata,window,msgport,@argv);
  731. end;
  732. FUNCTION AddAppIconA(id : ULONG; userdata : ULONG; const text_ : RawByteString; msgport : pMsgPort; lock : BPTR; diskobj : pDiskObject;const taglist : pTagItem) : pAppIcon;
  733. begin
  734. AddAppIconA := AddAppIconA(id,userdata,PChar(text_),msgport,lock,diskobj,taglist);
  735. end;
  736. FUNCTION AddAppMenuItemA(id : ULONG; userdata : ULONG; const text_ : RawByteString; msgport : pMsgPort;const taglist : pTagItem) : pAppMenuItem;
  737. begin
  738. AddAppMenuItemA := AddAppMenuItemA(id,userdata,PChar(text_),msgport,taglist);
  739. end;
  740. PROCEDURE WBInfo(lock : BPTR; const name : RawByteString; screen : pScreen);
  741. begin
  742. WBInfo(lock,PChar(name),screen);
  743. end;
  744. FUNCTION ChangeWorkbenchSelectionA(const name : RawByteString; hook : pHook;const tags : pTagItem) : BOOLEAN;
  745. begin
  746. ChangeWorkbenchSelectionA := ChangeWorkbenchSelectionA(PChar(name),hook,tags);
  747. end;
  748. FUNCTION CloseWorkbenchObjectA(const name : RawByteString;const tags : pTagItem) : BOOLEAN;
  749. begin
  750. CloseWorkbenchObjectA := CloseWorkbenchObjectA(PChar(name),tags);
  751. end;
  752. FUNCTION MakeWorkbenchObjectVisibleA(const name : RawByteString;const tags : pTagItem) : BOOLEAN;
  753. begin
  754. MakeWorkbenchObjectVisibleA := MakeWorkbenchObjectVisibleA(PChar(name),tags);
  755. end;
  756. FUNCTION OpenWorkbenchObjectA(const name : RawByteString;const tags : pTagItem) : BOOLEAN;
  757. begin
  758. OpenWorkbenchObjectA := OpenWorkbenchObjectA(PChar(name),tags);
  759. end;
  760. FUNCTION WorkbenchControlA(const name : RawByteString;const tags : pTagItem) : BOOLEAN;
  761. begin
  762. WorkbenchControlA := WorkbenchControlA(PChar(name),tags);
  763. end;
  764. const
  765. { Change VERSION and LIBVERSION to proper values }
  766. VERSION : string[2] = '0';
  767. LIBVERSION : longword = 0;
  768. initialization
  769. WorkbenchBase := OpenLibrary(WORKBENCHNAME,LIBVERSION);
  770. finalization
  771. if Assigned(WorkbenchBase) then
  772. CloseLibrary(WorkbenchBase);
  773. END. (* UNIT WB *)