home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / help / dlhelp_1 / !DLHelp / DeskLib / HelpData next >
Text File  |  1994-04-25  |  164KB  |  4,949 lines

  1. Help on DeskLib
  2. #Sprite 40,0 !desklib
  3. #Indent 9
  4. DeskLib
  5. v 2.04
  6. #Indent 0
  7.  
  8. DeskLib consists of the following header files:
  9. -----------------------------------------------
  10. #Indent 1
  11. #Table 10 14
  12. <ColourTran>
  13. <Coord>
  14. <Core>
  15. <Dialog>
  16. <Dispatch>
  17. <DragASpr>
  18. <Error>
  19. <Event>
  20. <EventMsg>
  21. <File>
  22. <Filter>
  23. <Font>
  24. <GFX>
  25. <Handler>
  26. <Hourglass>
  27. <Icon>
  28. <Kbd>
  29. <KeyCodes>
  30. <LinkList>
  31. <Mem>
  32. <Menu>
  33. <Msgs>
  34. <PDriver>
  35. <PopUp>
  36. <Resource>
  37. <Screen>
  38. <Sound>
  39. <Sprite>
  40. <StringCR>
  41. <SWI>
  42. <Template>
  43. <TextFile>
  44. <Time>
  45. <Validation>
  46. <Wimp>
  47. <WimpSWIs>
  48. <Window>
  49. #EndTable
  50. #Indent 0
  51. -----------------------------------------------
  52. To link with the DeskLib library, use something
  53. like:
  54.   link $(linkflags) C:o.Stubs C:o.DeskLib
  55.  
  56. For examples of this, see !TestApp.MakeFile
  57.                       and !TestApp.c.TestApp
  58.  
  59. Jason Williams May 1993DeskLib:ColourTran.h
  60. These four functions form the C calling
  61. interface to the ColourTrans module:
  62. <ColourTrans_SetGCOL>
  63. <ColourTrans_InvalidateCache>
  64. <ColourTrans_SelectTable>
  65. <ColourTrans_ReturnFontColours>DeskLib:Coord.h
  66. Screen \<---\> Work Area conversion routines.
  67. #Table 5 25
  68. <Coord_PointInRect>
  69. <Coord_RectContained>
  70. <Coord_RectsOverlap>
  71. <Coord_RectsIntersect>
  72. <Coord_WindowOrigin>
  73. <Coord_XToScreen>
  74. <Coord_YToScreen>
  75. <Coord_PointToScreen>
  76. <Coord_RectToScreen>
  77. <Coord_XToWorkArea>
  78. <Coord_YToWorkArea>
  79. <Coord_PointToWorkArea>
  80. <Coord_RectToWorkArea>
  81. #EndTable
  82.  
  83. NOTE:
  84.   "Screen Coordinates" refers to OS coordinates, with the bottom
  85.     left corner of the screen being placed at the screen origin, (0,0)
  86.   "Work Area Coordinates" refers to Coordinates within the Window's
  87.     work area, where the (0,0) origin is at the TOP left of the work area
  88.  
  89. Some of these routines have been defined as macros because they are
  90. very elementary, and are common, so efficiency will be improved by
  91. removing the function call overhead.
  92.  
  93. To keep compatibility with the syntax of Acorn's coords_ calls, these
  94. macros still accept a pointer to a convert_block, which results in
  95. code of the form (&convert)->xxx which would be better as convert.xxx
  96. -I am banking on the compiler being smart enough to notice and generate
  97. good code for this. If not, you can easily modify the macro to accept
  98. the actual variable instead - just remember there's no type checking!DeskLib:Core.h
  99. Core defines the following types and constants
  100. used in other parts of DeskLib:
  101.  
  102. /* --- Boolean values */
  103. #define BOOL  int
  104.  
  105. #define FALSE 0
  106. #define TRUE  1
  107.  
  108. #define ERROR   1
  109. #define NOERROR 0
  110.  
  111. Operating system errors (== _kernel_oserror)
  112. are reported as type <os_error>DeskLib:Dialog.h
  113. A dialogue is a window that is popped open to get user choices and
  114. then goes away - They can act like menus (go away when you click outside
  115. them) if opened with <Dialog_Show>(), or can be permanent windows if
  116. you open them using <Dialog_ShowStatic>().
  117. This code simplifies popping up such dialogues, as it handles opening,
  118. closing and simple processing of the window for you.
  119.  
  120. See <Example=>Dialog_Example> for how to use Dialog
  121.  
  122. #Table 3 23
  123. <Dialog_Create>
  124. <Dialog_Destroy>
  125. <Dialog_Show>
  126. <Dialog_ShowStatic>
  127. <Dialog_WaitForClick>
  128. <Dialog_WindowHandle>
  129. <Dialog_Persist>
  130. <Dialog_LastClicked>
  131. <Dialog_StillOpen>
  132. #EndTableDeskLib:Dispatch
  133. extern int Dispatch(int value, int size, int table[],
  134.                     <dispatch_proc> functions[],
  135.                     int arg0, int arg1, int arg2, int arg3);
  136.  
  137. Performs a table look up of value in table[size], and
  138. calls the corrseponding procedure in functions[size], with
  139. up to 4 arguments (any excess arguments will be safely ignored, as
  140. these are the arguments that C passes in registers R0-R3)
  141.  
  142. If the table[] entry contains a -1 then the coresponding procedure in
  143. functions[] is ALWAYS taken - Use this for a default action
  144.  
  145. defined in Dispatch.hDeskLib:DragASpr.h
  146. These functions are the C calling
  147. interface for the DragASprite module: 
  148. <DragASprite_Start>
  149. <DragASprite_Stop>
  150. <DragASprite_DragIcon>DeskLib:Error.h
  151. #Table 4 30
  152. <Error_ReportInternal>
  153. <Error_ReportFatalInternal>
  154. <Error_Report>
  155. <Error_ReportFatal>
  156. <Error_Check>
  157. <Error_CheckFatal>
  158. <Error_OutOfMemory>
  159. #EndTableDeskLib:Event.h
  160. <Notes on the use of Event_ functions=>Event_Note>
  161.  
  162. These global variables are defined:
  163. #Table 2 23
  164. <event_mask>
  165. <event_taskhandle>
  166. <event_wimpversion>
  167. <event_taskname>
  168. <event_lastevent>
  169. #EndTable
  170.  
  171. And these functions:
  172. #Table 3 23
  173. <Event_Claim>
  174. <Event_Release>
  175. <Event_ReleaseWindow>
  176. <Event_Process>
  177. <Event_Poll>
  178. <Event_Initialise>
  179. <Event_Initialise3>
  180. <Event_CloseDown>
  181. #EndTableDeskLib:EventMsg.h
  182. EventMsg.h defines these functions:
  183. <EventMsg_Initialise>
  184. <EventMsg_Claim>
  185. <EventMsg_Release>
  186. <EventMsg_ReleaseWindow>
  187. <EventMsg_ReleaseMessage>DeskLib:File.h
  188. <file_lasterror> reports the error status of File_* operations.
  189.  
  190. #Table 6 20
  191. <File_Delete>
  192. <File_Size>
  193. <File_Exists>
  194. <File_Open>
  195. <File_Close>
  196. <File_EOF>
  197. <File_Seek>
  198. <File_ReturnPos>
  199. <File_WriteBytes>
  200. <File_ReadBytes>
  201. <File_Write8>
  202. <File_Read8>
  203. <File_Write32>
  204. <File_Read32>
  205. <File_Read32R>
  206. <File_Write32R>
  207. #EndTableDeskLib:Filter.h
  208. These functions form a C interface to the
  209. Filter Manager SWIs:
  210. <Filter_RegisterPreFilter>          
  211. <Filter_RegisterPostFilter>
  212. <Filter_DeRegisterPreFilter>
  213. <Filter_DeRegisterPostFilter>DeskLib:Font.h
  214. #Table 8 25
  215. <Font_CacheAddr>
  216. <Font_ListFonts>
  217. <Font_ReadDefn>
  218. <Font_ReadInfo>
  219. <Font_ConvertToOS>
  220. <Font_ConvertToPoints>
  221. <Font_FindFont>
  222. <Font_LoseFont>
  223. <Font_LoseAllFonts>
  224. <Font_SetFont>
  225. <Font_CurrentFont>
  226. <Font_FutureFont>
  227. <Font_Paint>
  228. <Font_Caret>
  229. <Font_FindCaret>
  230. <Font_FindCaretJ>
  231. <Font_StringWidth>
  232. <Font_CharBBox>
  233. <Font_StringBBox>
  234. <Font_ReadScaleFactor>
  235. <Font_SetFontColours>
  236. <Font_SetPalette>
  237. <Font_ReadThresholds>
  238. <Font_SetThresholds>
  239. #EndTableDeskLib:GFX.h
  240. GFX.h defines the following Graphics functions:
  241. #Table 6 38
  242. <GFX_Plot>
  243. <GFX_ miscellaneous drawing macros=>GFX_MiscMacro>
  244. <GFX_Rectangle>
  245. <GFX_RectangleFill>
  246. <GFX_Circle>
  247. <GFX_CircleFill>
  248. <GFX_CLG>
  249. <GFX_VDU>
  250. <GFX_Write0>
  251. <GFX_WriteN>
  252. <GFX_Wait>
  253. #EndTableDeskLib:Handler.h
  254. NOTE that these are basically EXAMPLE handlers, and so are
  255. not all designed with peak efficiency in mind.
  256. PLEASE read the information about these handlers *carefully*
  257. before use.
  258. Note that some handlers are for <Event>, some are for <EventMsg>
  259.  
  260. #Table 2 23
  261. <Handler_CloseWindow>
  262. <Handler_DeleteWindow>
  263. <Handler_OpenWindow>
  264. <Handler_NullRedraw>
  265. <Handler_ClickOK>
  266. <Handler_ModeChange>
  267. #EndTableDeskLib:Hourglass.h
  268. These Functions form the C calling
  269. interface to the Hourglass module:
  270.  
  271. void Hourglass_On(void);
  272. void Hourglass_Start(int startdelay);
  273. void Hourglass_Percentage(int percent);
  274. void Hourglass_Off(void);
  275. void Hourglass_Smash(void);DeskLib:Icon.h
  276. #Table 7 23
  277. <Icon_BarIcon>
  278. <Icon_GetSelect>
  279. <Icon_GetShade>
  280. <Icon_SetSelect>
  281. <Icon_Select>
  282. <Icon_Deselect>
  283. <Icon_SetShade>
  284. <Icon_Shade>
  285. <Icon_Unshade>
  286. <Icon_ForceWindowRedraw>
  287. <Icon_SetCaret>
  288. <Icon_LoseCaret>
  289. <Icon_SetInteger>
  290. <Icon_SetDouble>
  291. <Icon_SetText>
  292. <Icon_printf>
  293. <Icon_GetDouble>
  294. <Icon_GetInteger>
  295. <Icon_GetText>
  296. <Icon_SetRadios>
  297. <Icon_WhichRadio>
  298. <Icon_ClickWait>
  299. <Icon_StartDrag>
  300. <Icon_StartSolidDrag>
  301. <Icon_DisposeIndData>
  302. #EndTable
  303.  
  304. Slider icons: See "DeskLib.Libraries.Icon.c.Slider" for details
  305. #Table 1 23
  306. <Icon_SetSlider>
  307. <Icon_UpdateSlider>
  308. <Icon_DragSlider>
  309. <Icon_ReadSlider>
  310. #EndTableDeskLib:Kbd.h
  311. There is one type:
  312. <kbd_neginkey>
  313.  
  314. And one function:
  315. <Kbd_KeyDown>DeskLib:KeyCodes.h
  316. This header defines constants for key codes.
  317.  
  318. Some keypresses are returned the same if shift, ctrl are held down, so we
  319. don't want people to think that keycode_SHIFT_X returns a different
  320. value to keycode_X, these get the value <UNDEFINED>
  321.  
  322. <Keys on their own=>Key_own>
  323. <Keys in combination with SHIFT=>Key_shift>
  324. <Keys in combination with CTRL=>Key_ctrl>
  325. <Keys in combination with SHIFT & CTRL=>Key_shiftctrl>DeskLib:LinkList.h
  326. #Table 4 23
  327. <LinkList_AddToHead>
  328. <LinkList_AddToTail>
  329. <LinkList_InsertBefore>
  330. <LinkList_InsertAfter>
  331. <LinkList_InList>
  332. <LinkList_ListLength>
  333. <LinkList_Unlink>
  334. <LinkList_Init>
  335. <LinkList_InitItem>
  336. <LinkList_NextItem>
  337. <LinkList_PreviousItem>
  338. #EndTableDeskLib:Mem.h
  339. "Flex" is the RISC OS Lib 'flexible' malloc for desktop tasks
  340. "Mem" is DeskLib's equivalent thereof.
  341.  
  342. <Notes on the Mem library=>Mem_Note>
  343.  
  344. #Table 3 23
  345. <Mem_Initialise>
  346. <Mem_Alloc>
  347. <Mem_MidExtend>
  348. <Mem_MoveAnchor>
  349. <Mem_Free>
  350. <Mem_Compact>
  351. <Mem_Size>
  352. #EndTableDeskLib:Menu.h
  353. <Notes on the use of Menu_ functions=>Menu_Note>
  354.  
  355. Functions:
  356. #Table 4 25
  357. <Menu_New>
  358. <Menu_Extend>
  359. <Menu_Show>
  360. <Menu_ShowLast>
  361. <Menu_AddSubMenu>
  362. <Menu_MakeWritable>
  363. <Menu_SetFlags>
  364. <Menu_SetText>
  365. <Menu_CalcHeight>
  366. <Menu_SysHandle>
  367. <Menu_SDispose>
  368. #EndTable
  369.  
  370. Global variables:
  371. #Table 1 25
  372. <menu_currentpos>
  373. <menu_currentopen>
  374. #EndTableDeskLib:Msgs.h
  375. These functions provide a C calling
  376. interface for the MessageTrans module:
  377. #Table 3 23
  378. <Msgs_Lookup>
  379. <Msgs_printf>
  380. <Msgs_LoadFile>
  381. <Msgs_DropGroup>
  382. <Msgs_Report>
  383. <Msgs_ReportFatal>
  384. #EndTableDeskLib:PDriver.h
  385. #Table 6 25
  386. <PDriver_Info>
  387. <PDriver_PrinterName>
  388. <PDriver_CheckFeatures>
  389. <PDriver_PageSize>
  390. <PDriver_SelectJob>
  391. <PDriver_CurrentJob>
  392. <PDriver_EndJob>
  393. <PDriver_AbortJob>
  394. <PDriver_GiveRectangle>
  395. <PDriver_DrawPage>
  396. <PDriver_GetRectangle>
  397. <PDriver_CancelJob>
  398. <PDriver_ScreenDump>
  399. <PDriver_EnumerateJobs>
  400. <PDriver_CancelJobWithError>
  401. <PDriver_SelectIllustration>
  402. <PDriver_InsertIllustration>
  403. #EndTableDeskLib:PopUp.h
  404. <NOTE on the use of PopUp.h=>PopUp_Note>
  405.  
  406. <How to use the ProgInfo PopUp=>PopUp_ProgInfoHelp>
  407. <How to use the SaveAs PopUp=>PopUp_SaveAsHelp>
  408.  
  409. <Constants defined in PopUp.h=>PopUp_Consts>
  410.  
  411. Type: <message_popuprequest>
  412.  
  413. Functions:
  414. #Table 2 20
  415. <PopUp_Open>
  416. <PopUp_Close>
  417. <PopUp_ShowMenuLeaf>
  418. <PopUp_ShowPtr>
  419. <PopUp_ShowStandalone>
  420. <PopUp_ShowStatic>
  421. #EndTableDeskLib:Resource.h
  422. One of the following functions:
  423. <Resource_Initialise>
  424. <Resource_InitialisePath>
  425.  
  426. sets the variable <resource_pathname>. Other
  427. modules use this to find their resources.DeskLib:Screen.h
  428. EXTRA NOTES:
  429. See Handler.c and '!TestApp.c' for examples of mode_change handlers to
  430. automatically keep all these mode variables up-to-date, etc.
  431.  
  432. These variables can be accessed globally for maximum efficiency.
  433. Note that they are not valid unless screen_mode == the current screen mode
  434. This can be guaranteed if you call <Screen_CacheModeInfo>() every time
  435. you get a mode change message, or before you attempt to use these variables
  436.  
  437.  Usage should be:
  438.    <Screen_CacheModeInfo>();
  439.    ...
  440.    screenwidth = screen_size.x;   (or whatever)
  441.    ...
  442.  
  443. extern int        screen_mode;
  444. extern <wimp_point> screen_size;
  445. extern <wimp_point> screen_eig;
  446. extern <wimp_point> screen_delta;
  447. extern int        screen_bpp;DeskLib:Sound.h
  448. Sound_SysBeep()
  449. extern void Sound_SysBeep(void);
  450.  
  451. Simply writes a character 7 (system beep) to the VDU stream, in order
  452. to sound a system beep. It sorta goes 'beep', really.
  453.  
  454. defined in <Sound>DeskLib:Sprite.h
  455. Constants:
  456. #Table 1 23
  457. <spritepool_SYSTEM>
  458. <spritepool_WIMP>
  459. #EndTable
  460.  
  461. Types defined in Sprite.h:
  462. #Table 1 23
  463. <sprite_header>
  464. #EndTable
  465.  
  466. SpriteOp veneers:
  467. #Table 5 23
  468. <Sprite_ScreenSave>
  469. <Sprite_ScreenLoad>
  470. <Sprite_InitArea>
  471. <Sprite_Load>
  472. <Sprite_Save>
  473. <Sprite_Create>
  474. <Sprite_Delete>
  475. <Sprite_Rename>
  476. <Sprite_Copy>
  477. <Sprite_Get>
  478. <Sprite_Plot>
  479. <Sprite_ReadInfo>
  480. <Sprite_Redirect>
  481. <Sprite_UnRedirect>
  482. <Sprite_ReadSaveAreaSize>
  483. #EndTable
  484.  
  485. Sprite manipulation functions:
  486. #Table 1 23
  487. <Sprite_MemorySize>
  488. <Sprite_IconMemorySize>
  489. #EndTableDeskLib:StringCR.h
  490. Purpose: Provides functions identical in operation to those defined in
  491.          ANSI \<string.h\>, except that these functions all work with strings
  492.          that have non-zero terminating characters (BASIC and the WIMP
  493.          often use a char 13 instead of a char 0 to terminate their
  494.          strings). ANY char \< 32 will terminate these strings.
  495.          These functions are currently defined in Sublibrary Misc.c.*
  496.  
  497. #Table 1 15
  498. <strlencr>
  499. <strcmpcr>
  500. <strcatcr>
  501. <strcpycr>
  502. #EndTableDeskLib:SWI
  503. This header defines the function:
  504. <SWI=>SWI_f>DeskLib:Template.h
  505. Template.h defines the following functions:
  506. #Table 3 23
  507. <Template_Initialise>
  508. <Template_Find>
  509. <Template_Clone>
  510. <Template_Free>
  511. <Template_Delete>
  512. <Template_ClearAll>
  513. <Template_LoadFile>
  514. <Template_UseOutlineFonts>
  515. #EndTableDeskLib:TextFile.h
  516. This Header defines the following
  517. TextFile manipulation functions:
  518. <TextFile_Lowercase>
  519. <TextFile_SkipBlanks>
  520. <TextFile_GetToken>
  521. <TextFile_ReadToDelimiter>DeskLib:Time.h
  522. This header defines the function:
  523. <Time_Monotonic>DeskLib:Validation.h
  524. This header defines the function:
  525. <Validation_ScanString>DeskLib:Wimp.h
  526. Wimp.h defines the following constants:
  527. <Wimp colours and palettes =>Wimp_colours>
  528. <Wimp icon data =>Wimp_icons>
  529. <wimp_NUMBEROFEVENTS>
  530.  
  531. Wimp.h defines the following types:
  532. #Table 3 22
  533. <wimp_coord>
  534. <wimp_colour>
  535. <palette_entry>
  536. <window_colourindices>
  537. <message_action>
  538. <message_header>
  539. #EndTableDeskLib:WimpSWIs.h
  540. Task handling: init, closedown, messages, transfers, etc.
  541. #Table 3 23
  542. <Wimp_Initialise>
  543. <Wimp_CloseDown>
  544. <Wimp_StartTask>
  545. <Wimp_SlotSize>
  546. <Wimp_TransferBlock>
  547. <Wimp_ReportError>
  548. <Wimp_ReportErrorR>
  549. <Wimp_SendMessage>
  550. #EndTable
  551.  
  552. window handling
  553. #Table 5 23
  554. <Wimp_OpenTemplate>
  555. <Wimp_CloseTemplate>
  556. <Wimp_LoadTemplate>
  557. <Wimp_CreateWindow>
  558. <Wimp_OpenWindow>
  559. <Wimp_CloseWindow>
  560. <Wimp_DeleteWindow>
  561. <Wimp_RedrawWindow>
  562. <Wimp_UpdateWindow>
  563. <Wimp_GetRectangle>
  564. <Wimp_GetWindowState>
  565. <Wimp_GetWindowInfo>
  566. <Wimp_GetWindowOutline>
  567. <Wimp_SetExtent>
  568. <Wimp_ForceRedraw>
  569. #EndTable
  570.  
  571. Icon handling
  572. #Table 2 23
  573. <Wimp_CreateIcon>
  574. <Wimp_DeleteIcon>
  575. <Wimp_SetIconState>
  576. <Wimp_GetIconState>
  577. <Wimp_WhichIcon>
  578. <Wimp_PlotIcon>
  579. #EndTable
  580.  
  581. Poll handling
  582. <--- Notes on Poll handling ---=>Wimp_PollNote>
  583. #Table 2 23
  584. <Wimp_Poll>
  585. <Wimp_PollIdle>
  586. <Wimp_Poll3>
  587. <Wimp_PollIdle3>
  588. <Wimp_SaveFPStateOnPoll>
  589. <Wimp_CorruptFPStateOnPoll>
  590. #EndTable
  591.  
  592. Pointer/Mouse handling
  593. #Table 1 23
  594. <Wimp_GetPointerInfo>
  595. <Wimp_SetPointerShape>
  596. <Wimp_DragBox>
  597. #EndTable
  598.  
  599. Caret handling
  600. #Table 1 23
  601. <Wimp_SetCaretPosition>
  602. <Wimp_GetCaretPosition>
  603. #EndTable
  604.  
  605. Menu handling
  606. #Table 1 23
  607. <Wimp_CreateMenu>
  608. <Wimp_CreateSubMenu>
  609. <Wimp_DecodeMenu>
  610. #EndTable
  611.  
  612. Keyboard handling
  613. <Wimp_ProcessKey>
  614.  
  615. Graphics/Screen handling
  616. #Table 4 23
  617. <Wimp_SetMode>
  618. <Wimp_SetColour>
  619. <Wimp_ReadPalette>
  620. <Wimp_SetPalette>
  621. <Wimp_ReadPixTrans>
  622. <Wimp_SetFontColours>
  623. <Wimp_SpriteOp>
  624. <Wimp_BaseOfSprites>
  625. <Wimp_BlockCopy>
  626. <Wimp_CommandWindow>
  627. #EndTableDeskLib:Window.h
  628. Window.h defines these functions:
  629. #Table 4 23
  630. <Window_Create>
  631. <Window_Show>
  632. <Window_CreateAndShow>
  633. <Window_Hide>
  634. <Window_Delete>
  635. <Window_GetInfo>
  636. <Window_ParentName>
  637. <Window_AutoHelp>
  638. <Window_HelpHandler>
  639. <Window_ModeChange>
  640. <Window_SetTitle>
  641. #EndTableWimp_Initialise
  642. extern <os_error> *Wimp_Initialise(unsigned int *version,
  643.                                  char         *name,
  644.                                  <task_handle>  *task,
  645.                                  int          *messages);
  646.  
  647. See also: <SWI Wimp_Initialise=>SWI.Wimp_Initialise>
  648.  
  649. defined in <WimpSWIs>Wimp_CloseDown
  650. extern <os_error> *Wimp_CloseDown(<task_handle> task);
  651.  
  652. See also: <SWI Wimp_CloseDown=>SWI.Wimp_CloseDown>
  653.  
  654. defined in <Wimp_SWIs>Wimp_StartTask
  655. extern <os_error> *Wimp_StartTask(char *command);
  656.  
  657. See also: <SWI Wimp_StartTask=>SWI.Wimp_StartTask>
  658.  
  659. defined in <Wimp_SWIs>Wimp_SlotSize
  660. extern <os_error> *Wimp_SlotSize(int *currentslot, int *nextslot, int *freepool);
  661.  
  662. See also: <SWI Wimp_SlotSize=>SWI.Wimp_SlotSize>
  663.  
  664. defined in <Wimp_SWIs>Wimp_TransferBlock
  665. extern <os_error> *Wimp_TransferBlock(<task_handle>  sourcetask,
  666.                                     void         *sourcebuffer,
  667.                                     <task_handle>  desttask,
  668.                                     void         *destbuffer,
  669.                                     unsigned int length);
  670. See also: <SWI Wimp_TransferBlock=>SWI.Wimp_TransferBlock>
  671.  
  672. defined in <Wimp_SWIs>Wimp_ReportError
  673. Reports an error in the standard WIMP non-multitasking error box.
  674. Avoid (by using your own multitasking error box) where possible!
  675. See also <Wimp_ReportErrorR>
  676.  
  677. extern <os_error> *Wimp_ReportError(<os_error> *error, int <flags=>error_flags>, char *name);
  678.  
  679. See also: <SWI Wimp_ReportError=>SWI.Wimp_ReportError>
  680.  
  681. defined in <Wimp_SWIs>Wimp_ReportErrorR
  682. Identical to <Wimp_ReportError>, except this version returns the flags
  683. that are returned by the SWI. That is, the return code from this
  684. function is 1 if OK was pressed or 2 if Cancel was pressed.
  685.  
  686. extern int Wimp_ReportErrorR(<os_error> *error, int <flags=>error_flags>, char *name);
  687.  
  688. See also: <SWI Wimp_ReportError=>SWI.Wimp_ReportError>
  689.  
  690. defined in <Wimp_SWIs>Wimp_SendMessage
  691. extern <os_error> *Wimp_SendMessage (<event_type>       eventtype,
  692.                                    <message_block>    *message,
  693.                                    <message_destinee> destinee,
  694.                                    <icon_handle>      icon);
  695. See also: <SWI Wimp_SendMessage=>SWI.Wimp_SendMessage>
  696.  
  697. defined in <Wimp_SWIs>Wimp_OpenTemplate
  698. extern <os_error> *Wimp_OpenTemplate(char *name);
  699.  
  700. See also: <SWI Wimp_OpenTemplate=>SWI.Wimp_OpenTemplate>
  701.  
  702. defined in <Wimp_SWIs>Wimp_CloseTemplate
  703. extern <os_error> *Wimp_CloseTemplate(void);
  704.  
  705. See also: <SWI Wimp_CloseTemplate=>SWI.Wimp_CloseTemplate>
  706.  
  707. defined in <Wimp_SWIs>Wimp_LoadTemplate
  708. extern <os_error> *Wimp_LoadTemplate(<template_block> *template);
  709.  
  710. See also: <SWI Wimp_LoadTemplate=>SWI.Wimp_LoadTemplate>
  711.  
  712. defined in <WimpSWIs>Wimp_CreateWindow
  713. extern <os_error> *Wimp_CreateWindow(<window_block> *block, <window_handle> *window);
  714.  
  715. See also: <SWI Wimp_CreateWindow=>SWI.Wimp_CreateWindow>
  716.  
  717. defined in <WimpSWIs>Wimp_OpenWindow
  718. extern <os_error> *Wimp_OpenWindow(<window_openblock> *block);
  719.  
  720. See also: <SWI Wimp_OpenWindow=>SWI.Wimp_OpenWindow>
  721.  
  722. defined in <WimpSWIs>Wimp_CloseWindow
  723. extern <os_error> *Wimp_CloseWindow(<window_handle> window);
  724.  
  725. See also: <SWI Wimp_CloseWindow=>SWI.Wimp_CloseWindow>
  726.  
  727. defined in <WimpSWIs>Wimp_DeleteWindow
  728. extern <os_error> *Wimp_DeleteWindow(<window_handle> window);
  729.  
  730. See also: <SWI Wimp_DeleteWindow=>SWI.Wimp_DeleteWindow>
  731.  
  732. defined in <WimpSWIs>Wimp_RedrawWindow
  733. extern <os_error> *Wimp_RedrawWindow(<window_redrawblock> *block, BOOL *more);
  734.  
  735. See also: <SWI Wimp_RedrawWindow=>SWI.Wimp_RedrawWindow>
  736.  
  737. defined in <WimpSWIs>Wimp_GetRectangle
  738. extern <os_error> *Wimp_GetRectangle(<window_redrawblock> *block, BOOL *more);
  739.  
  740. See also: <SWI Wimp_GetRectangle=>SWI.Wimp_GetRectangle>
  741.  
  742. defined in <WimpSWIs>Wimp_GetWindowState
  743. extern <os_error> *Wimp_GetWindowState(<window_handle> window, <window_state> *state);
  744.  
  745. See also: <SWI Wimp_GetWindowState=>SWI.Wimp_GetWindowState>
  746.  
  747. defined in <WimpSWIs>Wimp_GetWindowInfo
  748. extern <os_error> *Wimp_GetWindowInfo(<window_info> *info);
  749.  
  750. See also: <SWI Wimp_GetWindowInfo=>SWI.Wimp_GetWindowInfo>
  751.  
  752. defined in <WimpSWIs>Wimp_UpdateWindow
  753. extern <os_error> *Wimp_UpdateWindow(<window_redrawblock> *block, BOOL *more);
  754.  
  755. See also: <SWI Wimp_UpdateWindow=>SWI.Wimp_UpdateWindow>
  756.  
  757. defined in <WimpSWIs>Wimp_GetWindowOutline
  758. extern <os_error> *Wimp_GetWindowOutline(<window_outline> *outline);
  759.  
  760. See also: <SWI Wimp_GetWindowOutline=>SWI.Wimp_GetWindowOutline>
  761.  
  762. defined in <WimpSWIs>Wimp_SetExtent
  763. extern <os_error> *Wimp_SetExtent(<window_handle> window, <wimp_box> *newextent);
  764.  
  765. See also: <SWI Wimp_SetExtent=>SWI.Wimp_SetExtent>
  766.  
  767. defined in <WimpSWIs>Wimp_ForceRedraw
  768. extern <os_error> *Wimp_ForceRedraw(<window_redrawblock> *block);
  769.  
  770. See also: <SWI Wimp_ForceRedraw=>SWI.Wimp_ForceRedraw>
  771.  
  772. defined in <WimpSWIs>Wimp_CreateIcon
  773. extern <os_error> *Wimp_CreateIcon(<icon_createblock> *block, <icon_handle> *icon);
  774.  
  775. See also: <SWI Wimp_CreateIcon=>SWI.Wimp_CreateIcon>
  776.  
  777. defined in <WimpSWIs>Wimp_DeleteIcon
  778. extern <os_error> *Wimp_DeleteIcon(<window_handle> window, <icon_handle> icon);
  779.  
  780. See also: <SWI Wimp_DeleteIcon=>SWI.Wimp_DeleteIcon>
  781.  
  782. defined in <WimpSWIs>Wimp_SetIconState
  783. extern <os_error> *Wimp_SetIconState(<window_handle> window,
  784.                                    <icon_handle>   icon,
  785.                                    int           value,
  786.                                    int           mask);
  787.  
  788. See also: <SWI Wimp_SetIconState=>SWI.Wimp_SetIconState>
  789.  
  790. defined in <WimpSWIs>Wimp_GetIconState
  791. extern <os_error> *Wimp_GetIconState(<window_handle> window,
  792.                                    <icon_handle>   icon,
  793.                                    <icon_block>    *iconinfo);
  794.  
  795. See also: <SWI Wimp_GetIconState=>SWI.Wimp_GetIconState>
  796.  
  797. defined in <WimpSWIs>Wimp_WhichIcon
  798. extern <os_error> *Wimp_WhichIcon(<window_handle>    window,
  799.                                 <icon_handle>      *icons,
  800.                                 int              mask,
  801.                                 int              settings);
  802.  
  803. See also: <SWI Wimp_WhichIcon=>SWI.Wimp_WhichIcon>
  804.  
  805. defined in <WimpSWIs>Wimp_PlotIcon
  806. extern <os_error> *Wimp_PlotIcon(<icon_block> *fakeicon);
  807.  
  808. See also: <SWI Wimp_PlotIcon=>SWI.Wimp_PlotIcon>
  809.  
  810. defined in <WimpSWIs>Wimp_Poll
  811. #define Wimp_Poll(mask, evt) <Wimp_Poll3>(mask, evt, 0)
  812.  
  813. See also: <SWI Wimp_Poll=>SWI.Wimp_Poll>
  814.  
  815. defined in <WimpSWIs>WimpPollIdle
  816. #define Wimp_PollIdle(mask, evt, time) <Wimp_PollIdle3>(mask, evt, time, 0)
  817.  
  818. See also: <SWI WimpPollIdle=>SWI.WimpPollIdle>
  819.  
  820. defined in <WimpSWIs>Wimp_Poll3
  821. extern <os_error> *Wimp_Poll3(<event_pollmask> mask, <event_pollblock> *event,
  822.                             void *pollword);
  823.  
  824. See also: <SWI Wimp_Poll=>SWI.Wimp_Poll>
  825.  
  826. defined in <Wimp_SWIs>Wimp_PollIdle3
  827. extern <os_error> *Wimp_PollIdle3(<event_pollmask> mask, <event_pollblock> *block,
  828.                                 int earliest, void *pollword);
  829.  
  830. See also: <SWI Wimp_PollIdle=>SWI.Wimp_PollIdle>
  831.  
  832. defined in <WimpSWIs>Wimp_SaveFPStateOnPoll
  833. extern <os_error> *Wimp_SaveFPStateOnPoll(void);
  834.  
  835. See also: <Wimp_CorruptFPStateOnPoll>
  836.  
  837. See also: <SWI Wimp_SaveFPStateOnPoll=>SWI.Wimp_SaveFPStateOnPoll>
  838.  
  839. defined in <WimpSWIs>Wimp_CorruptFPStateOnPoll
  840. extern <os_error> *Wimp_CorruptFPStateOnPoll(void);
  841.  
  842. See also: <Wimp_SaveFPStateOnPoll>
  843.  
  844. See also: <SWI Wimp_CorruptFPStateOnPoll=>SWI.Wimp_CorruptFPStateOnPoll>
  845.  
  846. defined in <WimpSWIs>Wimp_GetPointerInfo
  847. extern <os_error> *Wimp_GetPointerInfo(<mouse_block> *ptrinfo);
  848.  
  849. See also: <SWI Wimp_GetPointerInfo=>SWI.Wimp_GetPointerInfo>
  850.  
  851. defined in <WimpSWIs>Wimp_SetPointerShape
  852. extern <os_error> *Wimp_SetPointerShape(<pointer_shapeblock> *shape);
  853.  
  854. See also: <SWI Wimp_SetPointerShape=>SWI.Wimp_SetPointerShape>
  855.  
  856. defined in <WimpSWIs> Wimp_DragBox
  857. extern <os_error> *Wimp_DragBox(<drag_block> *draginfo);
  858.  
  859. See also: <SWI Wimp_DragBox=>SWI.Wimp_DragBox>
  860.  
  861. defined in <WimpSWIs>Wimp_SetCaretPosition
  862. extern <os_error> *Wimp_SetCaretPosition(<caret_block> *caret);
  863.  
  864. See also: <Wimp_GetCaretPosition>
  865.  
  866. See also: <SWI Wimp_SetCaretPosition=>SWI.Wimp_SetCaretPosition>
  867.  
  868. defined in <WimpSWIs>Wimp_GetCaretPosition
  869. extern <os_error> *Wimp_GetCaretPosition(<caret_block> *caret);
  870.  
  871. See also: <Wimp_SetCaretPosition>
  872.  
  873. See also: <SWI Wimp_GetCaretPosition=>SWI.Wimp_GetCaretPosition>
  874.  
  875. defined in <WimpSWIs>Wimp_CreateMenu
  876. extern <os_error> *Wimp_CreateMenu(<menu_block> *menu, int xpos, int ypos);
  877.  
  878. See also: <SWI Wimp_CreateMenu=>SWI.Wimp_CreateMenu>
  879.  
  880. defined in <WimpSWIs>Wimp_CreateSubMenu
  881. extern <os_error> *Wimp_CreateSubMenu(<menu_block> *menu, int xpos, int ypos);
  882.  
  883. See also: <SWI Wimp_CreateSubMenu=>SWI.Wimp_CreateSubMenu>
  884.  
  885. defined in <WimpSWIs>Wimp_DecodeMenu
  886. extern <os_error> *Wimp_DecodeMenu(<menu_block> *menu,
  887.                                  int        *selections,
  888.                                  char       *result);
  889.                                  
  890. See also: <SWI Wimp_DecodeMenu=>SWI.Wimp_DecodeMenu>
  891.  
  892. defined in <WimpSWIs>Wimp_ProcessKey
  893. extern <os_error> *Wimp_ProcessKey(int character);
  894.  
  895. See also: <SWI Wimp_ProcessKey=>SWI.Wimp_ProcessKey>
  896.  
  897. defined in <WimpSWIs>Wimp_SetMode
  898. extern <os_error> *Wimp_SetMode(int mode);
  899.  
  900. See also: <SWI Wimp_SetMode=>SWI.Wimp_SetMode>
  901.  
  902. defined in <WimpSWIs>Wimp_SetColour
  903. extern <os_error> *Wimp_SetColour(int colour);
  904.  
  905. See also: <SWI Wimp_SetColour=>SWI.Wimp_SetColour>
  906.  
  907. defined in <WimpSWIs>Wimp_ReadPalette
  908. extern <os_error> *Wimp_ReadPalette(<palette_block> *palette);
  909.  
  910. See also: <Wimp_SetPalette>
  911.  
  912. See also: <SWI Wimp_ReadPalette=>SWI.Wimp_ReadPalette>
  913.  
  914. defined in <WimpSWIs>Wimp_SetPalette
  915. extern <os_error> *Wimp_SetPalette(<palette_block> *palette);
  916.  
  917. See also: <Wimp_ReadPalette>
  918.  
  919. See also: <SWI Wimp_SetPalette=>SWI.Wimp_SetPalette>
  920.  
  921. defined in <WimpSWIs>Wimp_ReadPixTrans
  922. extern <os_error> *Wimp_ReadPixTrans(int         areaindex,
  923.                                    void        *area,
  924.                                    void        *sprite,
  925.                                    <scale_block> *scaleblock,
  926.                                    char        *transblock);
  927.  
  928. See also: <SWI Wimp_ReadPixTrans=>SWI.Wimp_ReadPixTrans>
  929.  
  930. defined in <WimpSWIs>Wimp_SetFontColours
  931. extern <os_error> *Wimp_SetFontColours(int foreground, int background);
  932.  
  933. See also: <SWI Wimp_SetFontColours=>SWI.Wimp_SetFontColours>
  934.  
  935. defined in <WimpSWIs>Wimp_SpriteOp
  936. extern <os_error> *Wimp_SpriteOp(<_kernel_swi_regs> *registers);
  937.  
  938. See also: <SWI Wimp_SpriteOp=>SWI.Wimp_SpriteOp>
  939.  
  940. defined in <WimpSWIs>Wimp_BaseOfSprites
  941. extern <os_error> *Wimp_BaseOfSprites(void **rom_base, void **ram_base);
  942.  
  943. See also: <SWI Wimp_BaseOfSprites=>SWI.Wimp_BaseOfSprites>
  944.  
  945. defined in <WimpSWIs>Wimp_BlockCopy
  946. extern <os_error> *Wimp_BlockCopy(<window_handle> window, <wimp_box> *source,
  947.                                                       int x, int y);
  948.  
  949. See also: <SWI Wimp_BlockCopy=>SWI.Wimp_BlockCopy>
  950.  
  951. defined in <WimpSWIs>Wimp_CommandWindow
  952. extern <os_error> *Wimp_CommandWindow(int);
  953.  
  954. See also: <SWI Wimp_CommandWindow=>SWI.Wimp_CommandWindow>
  955.  
  956. defined in <WimpSWIs>type: wimp_point
  957. typedef struct
  958. {
  959.   int x, y;
  960. } wimp_point;
  961.  
  962. defined in <Wimp>type: wimp_coord
  963. typedef <wimp_point> wimp_coord;
  964.  
  965. defined in <Wimp>type: wimp_rect
  966. typedef struct
  967. {
  968.   <wimp_point> min;
  969.   <wimp_point> max;
  970. } wimp_rect;
  971.  
  972. defined in <Wimp>type: wimp_box
  973. typedef <wimp_rect> wimp_box;
  974.  
  975. defined in <Wimp>type: window_handle
  976. typedef int window_handle;
  977.  
  978. defined in <Wimp>type: icon_handle
  979. typedef int icon_handle;
  980.  
  981. defined in <Wimp>type: task_handle
  982. typedef int task_handle;
  983.  
  984. defined in <Wimp>Const: wimp_MAXNAME
  985. The size of wimp names (icon text fields, sprite names, etc)
  986. #define wimp_MAXNAME 12
  987.  
  988. defined in <Wimp>Wimp colour constants:
  989. #define colour_WHITE        0
  990. #define colour_GREY0        0
  991. #define colour_GREY1        1
  992. #define colour_GREY2        2
  993. #define colour_GREY3        3
  994. #define colour_GREY4        4
  995. #define colour_GREY5        5
  996. #define colour_GREY6        6
  997. #define colour_GREY7        7
  998. #define colour_BLACK        7
  999. #define colour_DARK_BLUE    8
  1000. #define colour_YELLOW       9
  1001. #define colour_GREEN       10
  1002. #define colour_RED         11
  1003. #define colour_CREAM       12
  1004. #define colour_ARMY_GREEN  13
  1005. #define colour_ORANGE      14
  1006. #define colour_LIGHT_BLUE  15
  1007.  
  1008. #define colour_TRANSPARENT 255 
  1009.  
  1010. defined in <Wimp>type: wimp_colour
  1011. typedef union
  1012. {
  1013.   int value;
  1014.   struct
  1015.   {
  1016.     unsigned int wimpcolour : 4;
  1017.     unsigned int gcolaction : 3;
  1018.     unsigned int foreback   : 1;
  1019.     unsigned int padding    : 24;
  1020.   } data;
  1021. } wimp_colour;
  1022.  
  1023. defined in <Wimp>type: palette_entry
  1024. typedef union
  1025. {
  1026.   int value;
  1027.   struct
  1028.   {
  1029.     char gcol;
  1030.     char red;
  1031.     char green;
  1032.     char blue;
  1033.   } data;
  1034. } palette_entry;
  1035.  
  1036. defined in <Wimp>type: palette_block
  1037. typedef struct
  1038. {
  1039.   palette_entry colour[16];
  1040.   palette_entry border;
  1041.   palette_entry mouse1;
  1042.   palette_entry mouse2;
  1043.   palette_entry mouse3;
  1044. } palette_block;
  1045.  
  1046. defined in <Wimp>Wimp icons data constants
  1047. #define iconbtype_NEVER            0
  1048. #define iconbtype_ALWAYS           1
  1049. #define iconbtype_AUTOREPEAT       2
  1050. #define iconbtype_CLICK            3
  1051. #define iconbtype_RELEASE          4
  1052. #define iconbtype_DOUBLECLICK      5
  1053. #define iconbtype_CLICKDRAG        6
  1054. #define iconbtype_RELEASEDRAG      7
  1055. #define iconbtype_DOUBLEDRAG       8
  1056. #define iconbtype_MENU             9
  1057. #define iconbtype_DOUBLECLICKDRAG 10
  1058. #define iconbtype_RADIO           11
  1059. #define iconbtype_RESERVED1       12
  1060. #define iconbtype_RESERVED2       13
  1061. #define iconbtype_WRITECLICKDRAG  14
  1062. #define iconbtype_WRITABLE        15
  1063.  
  1064.  
  1065. Icon bar icon positions, and the window handle of
  1066. the iconbar when returned by the Wimp
  1067.  
  1068. #define iconbar_RIGHT -1
  1069. #define iconbar_LEFT  -2
  1070. #define window_ICONBAR -2
  1071.  
  1072. Icon flag bits
  1073. #define icon_TEXT        0x00000001   icon contains text
  1074. #define icon_SPRITE      0x00000002   icon is a sprite
  1075. #define icon_BORDER      0x00000004   icon has a border
  1076. #define icon_HCENTRE     0x00000008   text is horizontally centred
  1077. #define icon_VCENTRE     0x00000010   text is vertically centred
  1078. #define icon_FILLED      0x00000020   icon has a filled background
  1079. #define icon_FONT        0x00000040   text is an anti-aliased font
  1080. #define icon_NEEDSHELP   0x00000080   redraw needs application's help
  1081. #define icon_INDIRECTED  0x00000100   icon data is 'indirected'
  1082. #define icon_RJUSTIFY    0x00000200   text right justified in box
  1083. #define icon_ALLOWADJUST 0x00000400   Allow multiple select with adjust
  1084. #define icon_HALVESPRITE 0x00000800   plot sprites half-size
  1085. #define icon_BUTTONTYPE  0x00001000   4-bit field: button type
  1086. #define icon_SELECTED    0x00200000   icon selected by user (inverted)
  1087. #define icon_SHADED      0x00400000   icon cannot be selected (shaded)
  1088. #define icon_DELETED     0x00800000   icon has been deleted
  1089.  
  1090. #define icon_FORECOLOUR  0x01000000   4-bit field: foreground colour
  1091. #define icon_BACKCOLOUR  0x10000000   4-bit field: background colour
  1092.  
  1093. #define iconvalid_ALLOW           'A'
  1094. #define iconvalid_BORDERTYPE      'R'
  1095. #define iconvalid_DISPLAY         'D'
  1096. #define iconvalid_FONTCOLOURS     'F'
  1097. #define iconvalid_LINESPACE       'L'
  1098. #define iconvalid_SPRITENAME      'S'
  1099.  
  1100. #define iconborder_PLINTH          0
  1101. #define iconborder_SURROUND        1
  1102. #define iconborder_OKBUTTON        2
  1103. #define iconborder_INDENT          3
  1104.  
  1105. defined in <Wimp>type: icon_flags
  1106. typedef union
  1107. {
  1108.   unsigned int value;
  1109.  
  1110.   struct
  1111.   {
  1112.     unsigned int garbage1      : 6;    /* New struct to allow easy access to */
  1113.     unsigned int font          : 1;    /* the font handle of an icon. NOTE   */
  1114.     unsigned int garbage2      : 17;   /* that handle is ONLY valid IF       */
  1115.     unsigned int handle        : 8;    /* 'font' is TRUE.                    */
  1116.   } font;
  1117.  
  1118.   struct
  1119.   {
  1120.     unsigned int text          : 1;
  1121.     unsigned int sprite        : 1;
  1122.     unsigned int border        : 1;
  1123.     unsigned int hcentre       : 1;
  1124.     unsigned int vcentre       : 1;
  1125.     unsigned int filled        : 1;
  1126.     unsigned int font          : 1;
  1127.     unsigned int needshelp     : 1;
  1128.     unsigned int indirected    : 1;
  1129.     unsigned int rightjustify  : 1;
  1130.     unsigned int allowadjust   : 1;
  1131.     unsigned int halfsize      : 1;
  1132.     unsigned int buttontype    : 4;
  1133.     unsigned int esg           : 5;
  1134.     unsigned int selected      : 1;
  1135.     unsigned int shaded        : 1;
  1136.     unsigned int deleted       : 1;
  1137.     unsigned int foreground    : 4;
  1138.     unsigned int background    : 4;
  1139.   } data;
  1140. } icon_flags;
  1141.  
  1142. defined in <Wimp>type: icon_indtext
  1143. typedef struct
  1144. {
  1145.   char         *buffer;
  1146.   char         *validstring;
  1147.   unsigned int bufflen;
  1148. } icon_indtext;
  1149.  
  1150. defined in <Wimp>type: icon_indsprite
  1151. typedef struct
  1152. {
  1153.   const char   *name;
  1154.   unsigned int *spritearea;
  1155.   unsigned int nameisname;
  1156. } icon_indsprite;
  1157.  
  1158. defined in <Wimp>type: icon_data
  1159. typedef union
  1160. {
  1161.   char           text[<wimp_MAXNAME>];
  1162.   <icon_indtext>   indirecttext;
  1163.   char           spritename[<wimp_MAXNAME>];
  1164.   <icon_indsprite> indirectsprite;
  1165. } icon_data;
  1166.  
  1167. defined in <Wimp>type: icon_block
  1168. typedef struct
  1169. {
  1170.   <wimp_box>   workarearect;
  1171.   <icon_flags> flags;
  1172.   <icon_data>  data;
  1173. } icon_block;
  1174.  
  1175. defined in <Wimp> type: icon_createblock
  1176. typedef struct
  1177. {
  1178.   <window_handle> window;
  1179.   <icon_block>    icondata;
  1180. } icon_createblock;
  1181.  
  1182. defined in <Wimp>type: window_flags
  1183. typedef union
  1184. {
  1185.   struct
  1186.   {
  1187.     unsigned int hastitle      : 1;  /* these are "old-style" flags  */
  1188.     unsigned int moveable      : 1;  /* You should not be using them */
  1189.     unsigned int hasvscroll    : 1;  /* " */
  1190.     unsigned int hashscroll    : 1;  /* " */
  1191.     unsigned int autoredraw    : 1;  /* " */
  1192.     unsigned int pane          : 1;  /* " */
  1193.     unsigned int nobounds      : 1;  /* " */
  1194.     unsigned int nobackclose   : 1;  /* " */
  1195.   
  1196.     unsigned int scrollrq      : 1;
  1197.     unsigned int scrollrqdebounced : 1;
  1198.     unsigned int realcolours   : 1;
  1199.     unsigned int backwindow    : 1;
  1200.     unsigned int hotkeys       : 1;
  1201.     unsigned int dummy13       : 1;
  1202.     unsigned int dummy14       : 1;
  1203.     unsigned int dummy15       : 1;
  1204.     unsigned int open          : 1;
  1205.     unsigned int top           : 1;
  1206.     unsigned int fullsize      : 1;
  1207.     unsigned int istoggling    : 1;
  1208.     unsigned int focus         : 1;
  1209.     unsigned int dummy21       : 1;
  1210.     unsigned int dummy22       : 1;
  1211.     unsigned int dummy23       : 1;
  1212.     unsigned int backicon      : 1;
  1213.     unsigned int closeicon     : 1;
  1214.     unsigned int titlebar      : 1;
  1215.     unsigned int toggleicon    : 1;
  1216.     unsigned int vscroll       : 1;
  1217.     unsigned int adjusticon    : 1;
  1218.     unsigned int hscroll       : 1;
  1219.     unsigned int newflags      : 1;  /* This should always be TRUE */
  1220.   } data;
  1221.   int value;
  1222. } window_flags;
  1223.  
  1224. defined in <Wimp>type: window_minsize
  1225. typedef struct       /* Minimum width/height of window. Used to be: */
  1226. {                    /*   unsigned short minwidth, minheight;       */
  1227.   int x : 16;        /* This has been changed for compatability     */
  1228.   int y : 16;        /* with compilers other than Desktop C         */
  1229. } window_minsize;
  1230.  
  1231. defined in <Wimp>type: window_colourindices
  1232. typedef enum
  1233. {
  1234.   windowcol_TITLEFORE = 0,
  1235.   windowcol_TITLEBACK,
  1236.   windowcol_WORKFORE,
  1237.   windowcol_WORKBACK,
  1238.   windowcol_SCROLLBACK,
  1239.   windowcol_SCROLLFORE,
  1240.   windowcol_TITLEHILITE
  1241. } window_colourindices;
  1242.  
  1243. defined in <Wimp>type: window_block
  1244. typedef struct
  1245. {
  1246.   <wimp_box>       screenrect;
  1247.   <wimp_point>     scroll;
  1248.   <window_handle>  behind;
  1249.   <window_flags>   flags;
  1250.   char           colours[8];
  1251.   <wimp_box>       workarearect;
  1252.   <icon_flags>     titleflags;
  1253.   <icon_flags>     workflags;
  1254.   void           *spritearea;
  1255.   <window_minsize> minsize;
  1256.   <icon_data>      title;
  1257.   unsigned int   numicons;
  1258.   /*
  1259.    *  What we really want here is :
  1260.   icon_block        icons [0];
  1261.    *  but unfortunately 'C' (stupidly) doesn't allow it.  Just think it.
  1262.    */
  1263. } window_block;
  1264.  
  1265. defined in <Wimp>type: window_openblock
  1266. typedef struct
  1267. {
  1268.   <window_handle> window;
  1269.   <wimp_box>      screenrect;
  1270.   <wimp_point>    scroll;
  1271.   <window_handle> behind;
  1272. } window_openblock;
  1273.  
  1274. defined in <Wimp>type: window_state
  1275. typedef struct
  1276. {
  1277.   <window_openblock> openblock;
  1278.   <window_flags>     flags;
  1279. } window_state;
  1280.  
  1281. defined in <Wimp>type: window_info
  1282. typedef struct
  1283. {
  1284.   <window_handle> window;
  1285.   <window_block>  block;
  1286. } window_info;
  1287.  
  1288. defined in <Wimp>type: window_redrawblock
  1289. typedef struct
  1290. {
  1291.   <window_handle> window;
  1292.   <wimp_box>      rect;
  1293.   <wimp_point>    scroll;
  1294.   <wimp_box>      cliprect;
  1295. } window_redrawblock;
  1296.  
  1297. defined in <Wimp>type: window_outline
  1298. typedef struct
  1299. {
  1300.   <window_handle> window;
  1301.   <wimp_box>      screenrect;
  1302. } window_outline;
  1303.  
  1304. defined in <Wimp>type: button_state
  1305. typedef union
  1306. {
  1307.   unsigned int value;
  1308.   struct
  1309.   {
  1310.     unsigned int adjust       : 1;
  1311.     unsigned int menu         : 1;
  1312.     unsigned int select       : 1;
  1313.     unsigned int dummy3       : 1;
  1314.     unsigned int dragadjust   : 1;
  1315.     unsigned int dummy5       : 1;
  1316.     unsigned int dragselect   : 1;
  1317.     unsigned int dummy7       : 1;
  1318.     unsigned int clickadjust  : 1;
  1319.     unsigned int dummy9       : 1;
  1320.     unsigned int clickselect  : 1;
  1321.   } data;
  1322. } button_state;
  1323.  
  1324. defined in <Wimp.h>type: message_action
  1325. Wimp message data:
  1326.  
  1327. typedef enum
  1328. {
  1329.   message_QUIT           = 0,
  1330.   message_CLOSEDOWN      = 0,
  1331.   message_DATASAVE       = 1,
  1332.   message_DATASAVEACK    = 2,
  1333.   message_DATASAVEOK     = 2,
  1334.   message_DATALOAD       = 3,
  1335.   message_DATALOADACK    = 4,
  1336.   message_DATALOADOK     = 4,
  1337.   message_DATAOPEN,
  1338.   message_RAMFETCH,
  1339.   message_RAMTRANSMIT,
  1340.   message_PREQUIT,
  1341.   message_PALETTECHANGE,
  1342.   message_SAVEDESK,
  1343.   message_DEVICECLAIM,
  1344.   message_DEVICEINUSE,
  1345.   message_DATASAVED,
  1346.  
  1347.   message_FILEROPENDIR   = 0x400,
  1348.   message_FILERCLOSEDIR,
  1349.  
  1350.   message_HELPREQUEST    = 0x502,
  1351.   message_HELPREPLY,
  1352.  
  1353.   message_NOTIFY         = 0x40040,
  1354.   message_MENUWARNING    = 0x400C0,
  1355.   message_MENUWARN       = 0x400C0,
  1356.   message_MODECHANGE,
  1357.   message_TASKINITIALISE = 0x400C2,
  1358.   message_INITTASK       = 0x400C2,
  1359.   message_TASKCLOSEDOWN  = 0x400C3,
  1360.   message_CLOSETASK      = 0x400C3,
  1361.   message_SLOTSIZE       = 0x400C4,
  1362.   message_SLOTCHANGE     = 0x400C4,
  1363.   message_SETSLOT        = 0x400C5,
  1364.   message_TASKNAMERQ,
  1365.   message_TASKNAMEIS,
  1366.   message_TASKSTARTED,
  1367.   message_MENUSDELETED,              /* RO3 Menu closed warning    */
  1368.   message_WINDOWINFO     = 0x400CC,  /* RO3 For window iconisation */
  1369.  
  1370.   message_POPUPRQ        = 0x46D40,  /* PopUp messages - cf PopUp.h */
  1371.   message_POPUPREQUEST   = 0x46D40,
  1372.   message_POPUPSTATE,
  1373.   message_POPUPCLOSED,
  1374.  
  1375.   message_PRINTFILE      = 0x80140,
  1376.   message_WILLPRINT,
  1377.   message_PRINTTYPEODD   = 0x80145,
  1378.   message_PRINTTYPEKNOWN,
  1379.   message_PRINTERCHANGE
  1380. } message_action;
  1381.  
  1382. defined in <Wimp>: scale_block
  1383. typedef struct
  1384. {
  1385.   <wimp_point> mul;
  1386.   <wimp_point> div;
  1387. } scale_block;
  1388.  
  1389. defined in <Wimp>type: template_block
  1390. typedef struct
  1391. {
  1392.   <window_block>   *buffer;
  1393.   char           *workfree;
  1394.   char           *workend;
  1395.   <font_array>     *font;
  1396.   char           *name;
  1397.   unsigned int   index;
  1398. } template_block;
  1399.  
  1400. defined in <Wimp>Font usage array  (font_array)
  1401. This array is indexed by the font handle - each entry contains a
  1402. count of how many times we have <Font_FindFont>'d this font. This is used
  1403. mainly by the template system (<Wimp_LoadTemplate>).
  1404. See <Font_LoseAllFonts>
  1405.  
  1406. typedef struct
  1407. {
  1408.   char fonts[256];
  1409. } font_array;
  1410.  
  1411. For convenience, this is defined in <Wimp>.h (it is mainly used for
  1412. template loading)type: event_pollblock
  1413. typedef struct
  1414. {
  1415.   <event_type> type;
  1416.   <event_data> data;
  1417. } event_pollblock;
  1418.  
  1419. defined in <Wimp>type: event_data
  1420. typedef union
  1421. {
  1422.   <caret_block>      caret;
  1423.   <key_block>        key;
  1424.   <pollword_block>   pollword;
  1425.   <window_openblock> openblock;
  1426.   <message_block>    message;
  1427.   <mouse_block>      mouse;
  1428.   <wimp_box>         screenrect;
  1429.   int              selection[10];
  1430.   <scroll_rq>        scroll;
  1431.   char             bytes [256];
  1432.   int              words [64];
  1433. } event_data;
  1434.  
  1435. defined in <Wimp>type: scrolls_rq
  1436. typedef struct
  1437. {
  1438.   <window_openblock> openblock;
  1439.   <wimp_point>       direction;
  1440. } scroll_rq;
  1441.  
  1442. defined in <Wimp>type: event_pollmask
  1443. typedef union
  1444. {
  1445.   unsigned int value;
  1446.   struct
  1447.   {
  1448.     unsigned int null                : 1;
  1449.     unsigned int redraw              : 1;
  1450.     unsigned int open                : 1;
  1451.     unsigned int close               : 1;
  1452.     unsigned int ptrleave            : 1;
  1453.     unsigned int ptrenter            : 1;
  1454.     unsigned int click               : 1;
  1455.     unsigned int userdrag            : 1;
  1456.     unsigned int key                 : 1;
  1457.     unsigned int menu                : 1;
  1458.     unsigned int scroll              : 1;
  1459.     unsigned int losecaret           : 1;
  1460.     unsigned int gaincaret           : 1;
  1461.     unsigned int nonzeropollword     : 1;
  1462.     unsigned int dummy14             : 1;
  1463.     unsigned int dummy15             : 1;
  1464.     unsigned int dummy16             : 1;
  1465.     unsigned int usermessage         : 1;
  1466.     unsigned int usermessagerecorded : 1;
  1467.     unsigned int usermessageack      : 1;
  1468.     unsigned int dummy20             : 1;
  1469.     unsigned int dummy21             : 1;
  1470.     unsigned int r3ispollwordptr     : 1;
  1471.     unsigned int highprioritypoll    : 1;
  1472.     unsigned int keepfpregisters     : 1;
  1473.   } data;
  1474. } event_pollmask;
  1475.  
  1476. defined in <Wimp>type: event_type
  1477. typedef enum
  1478. {
  1479.   event_ANY                 = -99,  
  1480.      /*  see event.c: this is used to denote
  1481.       *  any event type, any window handle,
  1482.       *  or any icon handle ... thus -99.
  1483.       */
  1484.   event_NULL                = 0,
  1485.   event_REDRAW,
  1486.   event_OPEN,
  1487.   event_CLOSE,
  1488.   event_PTRLEAVE,
  1489.   event_PTRENTER,
  1490.   event_CLICK = 6,
  1491.   event_BUTTON = 6,
  1492.   event_USERDRAG,
  1493.   event_KEY,
  1494.   event_MENU,
  1495.   event_SCROLL,
  1496.   event_LOSECARET,
  1497.   event_GAINCARET,
  1498.   event_NONZEROPOLLWORD,
  1499.   event_USERMESSAGE         = 17,
  1500.   event_SEND                = 17,
  1501.   event_USERMESSAGERECORDED = 18,
  1502.   event_SENDWANTACK         = 18,
  1503.   event_USERMESSAGEACK      = 19,
  1504.   event_ACK                 = 19
  1505. } event_type;
  1506.  
  1507. defined in <Wimp>Const: wimp_NUMBEROFEVENTS
  1508. #define wimp_NUMBEROFEVENTS 20
  1509.  
  1510. N.B.  There aren't 20, but you need an array this big to store them
  1511. due to the way they are numbered.
  1512.  
  1513. defined in <Wimp>
  1514. type: message_block
  1515. typedef struct
  1516. {
  1517.   message_header  header;
  1518.   union
  1519.   {
  1520.     char                 bytes [236];
  1521.     int                  words [59];
  1522.     <message_datasave>     datasave;
  1523.     <message_datasaveack>  datasaveack;
  1524.     <message_dataload>     dataload;
  1525.     <message_dataopen>     dataopen;
  1526.     <message_ramfetch>     ramfetch;
  1527.     <message_ramtransmit>  ramtransmit;
  1528.     <message_helprequest>  helprequest;
  1529.     <message_helpreply>    helpreply;
  1530.     <message_print>        print;
  1531.     <message_menuwarn>     menuwarn;
  1532.  
  1533. #if FALSE
  1534.     /* If <PopUp> in use, also include */
  1535.     /* the relevant PopUp messages    */
  1536.     <message_popuprequest> popuprequest;
  1537.     <message_popupstate>   popupstate;
  1538. #endif
  1539.  
  1540.   } data;
  1541. } message_block;
  1542.  
  1543. defined in <Wimp>type: message_menuwarn
  1544. typedef struct
  1545. {
  1546.   int        id;             /* The number given to Wimp_CreateMenu */
  1547.   <wimp_point> openpos;        /* Position to open window/menu at     */
  1548.   int        selection[10];  /* -1 terminated list of menu hits     */
  1549. } message_menuwarn;
  1550.  
  1551. defined in <Wimp>type: message_print
  1552. typedef struct
  1553. {
  1554.   int filler[5];
  1555.   int filetype;
  1556.   char filename[212];
  1557. } message_print;
  1558.  
  1559. defined in <Wimp>type: message_helpreply
  1560. typedef struct
  1561. {
  1562.   char text[200];
  1563. } message_helpreply;
  1564.  
  1565. defined in <Wimp>type: message_helprequest
  1566. typedef struct
  1567. {
  1568.   mouse_block where;  /* Where is help needed for? */
  1569. } message_helprequest;
  1570.  
  1571. defined in <Wimp>tyep: message_ramtransmit
  1572. typedef struct
  1573. {
  1574.   char *buffer;   /* copied directly from initiating RamFetch */
  1575.   int  byteswritten;
  1576. } message_ramtransmit;
  1577.  
  1578. defined in <Wimp>type: message_ramfetch
  1579. typedef struct
  1580. {
  1581.   char *buffer;
  1582.   int  buffsize;
  1583. } message_ramfetch;
  1584.  
  1585. defined in <Wimp>type: message_dataopen
  1586. typedef <message_dataload> message_dataopen;
  1587.  
  1588. defined in <Wimp>type: message_dataload
  1589. typedef struct
  1590. {
  1591.   <window_handle> window;
  1592.   <icon_handle>   icon;
  1593.   <wimp_point>    pos;
  1594.   int           size;
  1595.   int           filetype;
  1596.   char          filename[212];
  1597. } message_dataload;
  1598.  
  1599. defined in <Wimp>type: message_datasaveack
  1600. typedef struct
  1601. {
  1602.   <window_handle> window;   /* window, icon, pos, estsize, filetype all copied */
  1603.   <icon_handle>   icon;     /* from the initiating datasave message            */
  1604.   <wimp_point>    pos;
  1605.   int           estsize;
  1606.   int           filetype;
  1607.   char          filename[212];
  1608. } message_datasaveack;
  1609.  
  1610. defined in <Wimp>type: message_datasave
  1611. typedef struct
  1612. {
  1613.   <window_handle> window;
  1614.   <icon_handle>   icon;
  1615.   <wimp_point>    pos;
  1616.   int           estsize;
  1617.   int           filetype;
  1618.   char          leafname[12];
  1619. } message_datasave;
  1620.  
  1621. defined in <Wimp>type: message_header
  1622. typedef struct
  1623. {
  1624.   unsigned int   size;
  1625.   <task_handle>    sender;
  1626.   unsigned int   myref;
  1627.   unsigned int   yourref;
  1628.   <message_action> action;
  1629. } message_header;
  1630.  
  1631. defined in <Wimp>type: message_destinee
  1632. Window or Task handle
  1633.  
  1634. typedef int message_destinee;
  1635.  
  1636. defined in <Wimp>type: pollword_block
  1637. typedef struct
  1638. {
  1639.   int address;
  1640.   int contents;
  1641. } pollword_block;
  1642.  
  1643. defined in <Wimp>type: key_block
  1644. typedef struct
  1645. {
  1646.   <caret_block> caret;
  1647.   <key_press>   code;
  1648. } key_block;
  1649.  
  1650. defined in <Wimp>type: caret_block
  1651. typedef struct
  1652. {
  1653.   <window_handle> window;
  1654.   <icon_handle>   icon;
  1655.   <wimp_point>    offset;
  1656.   int           height;
  1657.   int           index;
  1658. } caret_block;
  1659.  
  1660. defined in <Wimp>type: key_press
  1661. typedef int key_press;
  1662.  
  1663. defined in <Wimp>type: menu_block
  1664. typedef struct menu_block
  1665. {
  1666.   char     title [wimp_MAXNAME];
  1667.   char     titlefore, titleback, workfore, workback;
  1668.   unsigned int width;
  1669.   unsigned int height;
  1670.   unsigned int gap;
  1671.   /*  Followed immediately by <menu items=>menu_item> */
  1672. } menu_block;
  1673.  
  1674. defined in <Wimp>type: menu_item
  1675. typedef struct
  1676. {
  1677.   <menu_flags>   menuflags;
  1678.   <menu_submenu> submenu;
  1679.   <icon_flags>   iconflags;
  1680.   <icon_data>    icondata;
  1681. } menu_item;
  1682.  
  1683. defined in <Wimp>type: menu_submenu
  1684. typedef union
  1685. {
  1686.   <menu_ptr>      menu;
  1687.   <window_handle> window;
  1688.   int           value;
  1689. } menu_submenu;
  1690.  
  1691. defined in <Wimp>type: menu_flags
  1692. typedef union
  1693. {
  1694.   unsigned int value;
  1695.   struct
  1696.   {
  1697.     unsigned int ticked     : 1;
  1698.     unsigned int dotted     : 1;
  1699.     unsigned int writable   : 1;
  1700.     unsigned int notifysub  : 1;
  1701.     unsigned int dummy3     : 3;
  1702.     unsigned int last       : 1;
  1703.     unsigned int dummy14    : 14;
  1704.     unsigned int shaded     : 1;
  1705.     unsigned int dummy1     : 1;
  1706.     unsigned int foreground : 4;
  1707.     unsigned int background : 4;
  1708.   } data;
  1709. } menu_flags;
  1710.  
  1711. defined in <Wimp>type: menu_ptr
  1712. typedef struct <menu_block> *menu_ptr;
  1713.  
  1714. defined in <Wimp>type: error_flags
  1715. typedef union
  1716. {
  1717.   unsigned int value;
  1718.   struct
  1719.   {
  1720.     unsigned int ok               : 1;
  1721.     unsigned int cancel           : 1;
  1722.     unsigned int highlightcancel  : 1;
  1723.     unsigned int noprompt         : 1;
  1724.     unsigned int noprefix         : 1;
  1725.     unsigned int nowait           : 1;
  1726.     unsigned int closebox         : 1;
  1727.   } data;
  1728. } error_flags;
  1729.  
  1730. defined in <Wimp>type: drag_block
  1731. typedef struct
  1732. {
  1733.   <window_handle> window;
  1734.   <drag_type>     type;
  1735.   <wimp_box>      screenrect;
  1736.   <wimp_box>      parent;
  1737. } drag_block;
  1738.  
  1739. defined in <Wimp>type: drag_type
  1740. typedef enum
  1741. {
  1742.   drag_MOVEWINDOW    = 1,
  1743.   drag_RESIZEWINDOW,
  1744.   drag_SCROLLX,
  1745.   drag_SCROLLY,
  1746.   drag_FIXEDBOX,
  1747.   drag_RUBBERBOX,
  1748.   drag_INVISIBLE,
  1749.   drag_USERFIXEDBBOX,
  1750.   drag_USERRUBBERBOX,
  1751.   drag_USERFIXEDNC,
  1752.   drag_USERRUBBERNC
  1753. } drag_type;
  1754.  
  1755. defined in <Wimp>type: pointer_shapeblock
  1756. typedef struct
  1757. {
  1758.   int           shapenumber;
  1759.   char          *shapedata;
  1760.   unsigned int  width;
  1761.   unsigned int  height;
  1762.   <wimp_point>    active;
  1763. } pointer_shapeblock;
  1764.  
  1765. defined in <Wimp>type: mouse_block
  1766. typedef struct
  1767. {
  1768.   <wimp_point>    pos;
  1769.   <button_state>  button;
  1770.   <window_handle> window;
  1771.   <icon_handle>   icon;
  1772. } mouse_block;
  1773.  
  1774. defined in <Wimp>type: convert_block
  1775. typedef struct
  1776. {
  1777.   <wimp_rect>  screenrect;
  1778.   <wimp_point> scroll;
  1779. } convert_block;
  1780.  
  1781. defined in <Coord>Coord_PointInRect(point, rectangle)
  1782. extern BOOL Coord_PointInRect(<wimp_point> *, <wimp_rect> *);
  1783.  
  1784. Tests whether the point is within the rectangle. If it is on the line
  1785. its counted as in (just like in tennis).
  1786.  
  1787. defined in <Coord> Coord_RectContained(InsideRect, OutsideRect)
  1788. extern BOOL Coord_RectContained(<wimp_rect> *, <wimp_rect> *);
  1789.  
  1790. Test whether the InsideRect is wholly contained by the OutsideRect.
  1791. Shared vertices/edges are considered to be inside.
  1792.  
  1793. defined in <Coord>Coord_RectsOverlap(RectangleA, RectangeB)
  1794. extern BOOL Coord_RectsOverlap(<wimp_rect> *, <wimp_rect> *);
  1795.  
  1796. Returns TRUE if the two rectangles overlap (includes containment)
  1797.  
  1798. defined in <Coord>Coord_RectsIntersect(RectangleA, RectangeB)
  1799. #define Coord_RectsIntersect(r1, r2) (<Coord_RectsOverlap>(r1, r2) && \\
  1800.                                      !<Coord_RectContained>(r1, r2) && \\
  1801.                                      !<Coord_RectContained>(r2, r1))
  1802.  
  1803. Returns TRUE if the two rectangles intersect but neither is contained
  1804. wholly within the other.
  1805.  
  1806. defined in <Coord>Coord_WindowOrigin
  1807. extern void Coord_WindowOrigin(<wimp_point> *origin, <convert_block> *convert);
  1808.  
  1809. Returns the origin (TOP LEFT (0,0) corner) of the window's work-area
  1810. in screen coordinates. This can then be used as a redraw-origin
  1811. for redraws - any drawing done relative to this origin will appear at
  1812. the correct screen position regardless of scroll bar offsets and screen
  1813. position of the window.
  1814. Remember to call this at the start of each redraw - whenever the window
  1815. is moved or scrolled, the position of this origin (in screen coordinates)
  1816. will change, so it must be recalculated.
  1817.  
  1818. defined in <Coord>Coord_XToScreen
  1819. #define Coord_XToScreen(X, C) (((X) - (C)->scroll.x) + (C)->screenrect.min.x)
  1820.  
  1821. This takes in an integer x-workarea-coord and a pointer to a convert_block,
  1822. and returns the screen-coordinate equivalent
  1823.  
  1824. defined in <Coord>Coord_YToScreen
  1825. #define Coord_YToScreen(Y, C) ( ((Y) - (C)->scroll.y) + (C)->screenrect.max.y )
  1826.  
  1827. This takes in an integer y-workarea-coord and a pointer to a <convert_block>,
  1828. and returns the screen-coordinate equivalent
  1829.  
  1830. defined in <Coord>Coord_PointToScreen
  1831. extern void Coord_PointToScreen(<wimp_point> *point, <convert_block> *convert);
  1832.  
  1833. Input:  A point in Work Area coords
  1834. Output: The same point in Screen coordinates
  1835.  
  1836. defined in <Coord>Coord_RectToScreen
  1837. extern void Coord_RectToScreen(<wimp_rect> *rect, <convert_block> *convert);
  1838.  
  1839. Input:  A rectangle in Work Area coords
  1840. Output: The same rectangle in Screen coordinates
  1841.  
  1842. defined in <Coord>Coord_XToWorkArea
  1843. #define Coord_XToWorkArea(X, C) (((X)-(C)->screenrect.min.x)+(C)->scroll.x)
  1844.  
  1845. This takes in an integer x-screen-coord and a pointer to a <convert_block>,
  1846. and returns the workarea-coordinate equivalent
  1847.  
  1848. defined in <Coord>Coord_YToWorkArea
  1849.  
  1850. #define Coord_YToWorkArea(Y, C) (((Y)-(C)->screenrect.max.y)+(C)->scroll.y)
  1851.  
  1852. This takes in an integer y-screen-coord and a pointer to a <convert_block>,
  1853. and returns the workarea-coordinate equivalent
  1854.  
  1855. defined in <Coord>Coord_PointToWorkArea
  1856. extern void Coord_PointToWorkArea(<wimp_point> *point, <convert_block> *convert);
  1857.  
  1858. Input:  A point in Screen coords
  1859. Output: The same point in Work Area coordinates
  1860.  
  1861. defined in <Coord>Coord_RectToWorkArea
  1862. extern void Coord_RectToWorkArea(<wimp_rect> *rect, <convert_block> *convert);
  1863.  
  1864. Input:  A rectangle in Screen coords
  1865. Output: The same rectangle in Work Area coordinates
  1866.  
  1867. defined in <Coord>Menu_New()
  1868. extern <menu_ptr> Menu_New(char *title, char *description);
  1869.  
  1870. Creates a new menu. "title" should be no more than 12 characters long
  1871. (including the terminator). "description" is a RISC OS Lib style
  1872. menu_new() string (Desktop C manual, page 240, but note their syntax
  1873. AND their example are both WRONG!), i.e.
  1874.     opt   :- " "  no special options (i.e. leading spaces are skipped)
  1875.              "!"  ticked
  1876.              "~"  shaded
  1877.              ">"  has submenu/subwindow
  1878.              "-"  dotted
  1879.     name  :- any character except "," and "|"
  1880.     entry :- {opt}* name
  1881.     sep   :- ","  to separate normal items
  1882.              "|"  to separate items and place a dotted line between them
  1883.     descr :- entry {sep entry}*
  1884.  
  1885.     EXAMPLES:
  1886.       "!Ticked,~Disabled,>Sub-menu,!~Ticked and disabled, Normal"
  1887.       ">Info, Create| Quit"         ; info with sublink arrow
  1888.                                     ; then create, dotted line, quit.
  1889.  
  1890. NOTES:
  1891.   Menu_New needs <Screen>_() functions. It assumes you have called
  1892.   <Screen_CacheModeInfo>() in this screen mode (to get screen_delta.x)
  1893.   If this call fails (out of malloc memory) then it will call
  1894.   <Error_OutOfMemory>() and then return NULL.
  1895.  
  1896. defined in <Menu>Menu_Extend()
  1897. extern <menu_ptr> Menu_Extend(<menu_ptr> menu, char *description);
  1898.  
  1899. Extends (if possible) the menu by appending the items in "description"
  1900. onto the menu structure "menu". If the memory reallocation fails, it
  1901. returns the pointer to the old, UNCHANGED menu structure.
  1902. "description" is the same as for <Menu_New>().
  1903.  
  1904. defined in <Menu>Menu_Show()
  1905. extern void Menu_Show(<menu_ptr> menu, int x, int y);
  1906. Shows the given menu on screen, at the given x and y position.
  1907. Set (y = -1) to place the menu at the correct position above the
  1908. icon bar.
  1909.  
  1910. defined in <Menu>Menu_ShowLast()
  1911. extern void Menu_ShowLast(void);
  1912. Re-opens the last menu opened (call when a menu item is chosen using
  1913. the adjust mouse button to keep the menu open).
  1914. Note that if no menu has been opened, or if the last menu opened
  1915. has been "dispose"d, this will have bad (dire) results.
  1916.  
  1917. defined in <Menu>Menu_AddSubMenu()
  1918. extern void Menu_AddSubMenu(<menu_ptr> menu, int entry, <menu_ptr> submenu);
  1919.  
  1920. Adds a menu to an existing menu as a submenu at a particular item.
  1921.  
  1922. defined in <Menu>Menu_MakeWritable()
  1923. extern void Menu_MakeWritable(<menu_ptr> menu, int entry,
  1924.                               char *buffer, int size, char *valid);
  1925.  
  1926. Makes a menu item writable. You supply the buffer into which the
  1927. menu item data will be written, as well as the size of this buffer
  1928. (including terminator), plus the validation string (as in Wimp icons)
  1929.  
  1930. defined in <Menu>Menu_SetFlags()
  1931. extern void Menu_SetFlags(<menu_ptr> menu, int entry, int ticked, int shaded);
  1932.  
  1933. Alters the state of a menu item. Setting ticked/shaded to 0 will
  1934. turn off the tick/make the item selectable. Setting them to 1 will
  1935. turn on a tick/make the item unselectable. Values other than 0 and 1
  1936. are undefined, so ensure the values you use are 0 and 1.
  1937.  
  1938. defined in <Menu>Menu_SetText()
  1939. extern void Menu_SetText(<menu_ptr> menu, int entry, char *text);
  1940.  
  1941. Retrieves the text for a menu entry.
  1942.  
  1943. defined in <Menu>Menu_CalcHeight()
  1944. extern int Menu_CalcHeight(<menu_ptr> menu);
  1945.  
  1946. Calculates the height of a menu in OS coords. For internal use.
  1947.  
  1948. defined in <Menu>Menu_SysHandle()
  1949. #define Menu_SysHandle(menu) (menu)
  1950.  
  1951. Returns a pointer to the 'underlying' Wimp menu definition. In DeskLib
  1952. this IS the menu definition.
  1953.  
  1954. defined in <Menu>Menu_SDispose()
  1955. #define Menu_SDispose(menu) free(menu)
  1956.  
  1957. Frees up the memory used by a menu. Note that this is a simple Dispose
  1958. which does not recursively dispose of attached submenus, and does not
  1959. dispose of memory used by long (indirected) item text.
  1960.  
  1961. defined in <Menu>var: menu_currentpos
  1962. extern <wimp_point> menu_currentpos;
  1963.  
  1964. menu_currentpos is a global variable which holds the
  1965. x,y position where the last menu was opened
  1966.  
  1967. If no menu has been opened, or the last menu has been disposed, then
  1968. the values will be invalid - use with care.
  1969.  
  1970. defined in <Coord>var: menu_currentopen
  1971. extern <menu_ptr>   menu_currentopen;
  1972.  
  1973. menu_currentopen is a global variable and points to the last menu opened.
  1974. If no menu has been opened, or the last menu has been disposed, then
  1975. the value will be invalid - use with care.
  1976.  
  1977. defined in <Menu>type: sprite
  1978. typedef struct <sprite_info>     *sprite;
  1979.  
  1980. defined in <Sprite>type: sprite_area
  1981. typedef struct <sprite_areainfo> *sprite_area;
  1982.  
  1983. defined in <Sprite>type: sprite_outputstate
  1984. typedef struct {
  1985.     int          callno ;
  1986.     <sprite_area>  spritearea ;
  1987.     <sprite=>sprite_ptr>       sprite ;
  1988.     void         *savearea ;
  1989. } sprite_outputstate;
  1990.  
  1991. defined in <Sprite>type: sprite_areainfo
  1992. typedef struct {
  1993.     unsigned int areasize;
  1994.     unsigned int numsprites;
  1995.     unsigned int firstoffset;
  1996.     unsigned int freeoffset;
  1997. } sprite_areainfo;
  1998.  
  1999. defined in <Sprite>type: sprite_info
  2000. typedef struct {
  2001.     unsigned int width;
  2002.     unsigned int height;
  2003.     unsigned int maskstatus;
  2004.     unsigned int mode;
  2005. } sprite_info;
  2006.  
  2007. defined in <Sprite>type: sprite_header
  2008. typedef struct
  2009. {
  2010.   int  offset_next;
  2011.   char name[<sprite_MAXNAME>];
  2012.   int  width;
  2013.   int  height;
  2014.   int  leftbit;
  2015.   int  rightbit;
  2016.   int  imageoffset;
  2017.   int  maskoffset;
  2018.   int  screenmode;
  2019. } sprite_header;
  2020.  
  2021. defined in <Sprite>Sprite_ScreenSave
  2022. extern <os_error> *Sprite_ScreenSave(char *filename, BOOL savepalette);
  2023.  
  2024. Save the screen as a sprite file - <SpriteOp 2=>SWI.OS_SpriteOp2>
  2025.  
  2026. defined in <Sprite>Sprite_ScreenLoad
  2027. extern <os_error> *Sprite_ScreenLoad(char *filename);
  2028.  
  2029. ScreenLoad a sprite file - <SpriteOp 3=>SWI.OS_SpriteOp3>
  2030.  
  2031. defined in <Sprite>Sprite_IconMemorySize
  2032. extern int Sprite_IconMemorySize(<window_block> *pWinBlock, <icon_handle> icon,
  2033.                                  int mode, <spritemem_flags> flags,
  2034.                                  <wimp_point> *dimensions);
  2035.  
  2036. This takes the given WIMP icon, and calculates the size of the sprite
  2037. needed to exactly fill it, by calling <Sprite_MemorySize> for you.
  2038. If 'dimensions' is not NULL, then it will be filled in with the needed
  2039. size (width/height) of the sprite in pixels.
  2040.  
  2041. The window is passed in as a window_block so that this can be applied
  2042. to templates as well as open windows.
  2043.  
  2044. Example:
  2045. {
  2046. <window_info> winfo;
  2047. int         s;
  2048.  
  2049. <Window_GetInfo>(mainwindow, &winfo);
  2050. s = Sprite_IconMemorySize(&winfo.block, 5,     /* Get info for icon 5    */
  2051.                           screen_mode,         /* in current screen mode */
  2052.                           sprite_HASNOMASKPAL, /* with no mask/palette   */
  2053.                           NULL);               /* Don't return dimensions*/
  2054. }
  2055.  
  2056. defined in <Sprite>Sprite_MemorySize
  2057. extern int Sprite_MemorySize(int width, int height, int mode,
  2058.                              <spritemem_flags> flags);
  2059.  
  2060. Returns the amount of memory to malloc to hold the sprite
  2061. defined by the parameters.
  2062.  
  2063. -- Example, create sprite area large enough for 3 identical sprites
  2064.    which are mode 12, 34x17, and have their own palettes.
  2065. {
  2066. <sprite_areainfo> *pUserSprites;
  2067.  
  2068. size = 3 * Sprite_MemorySize( 34, 17, 12, sprite_HASPAL );
  2069. size += sizeof( <sprite_areainfo> );
  2070. pUserSprites = (<sprite_areainfo>*) malloc( size );
  2071. }
  2072.  
  2073. defined in <Sprite>type: spritemem_flags
  2074. typedef enum
  2075. {
  2076.   sprite_HASNOMASKPAL = 0x00,   /* Sprite has no mask or palette */
  2077.   sprite_HASNOPALMASK = 0x00,
  2078.   sprite_HASMASK      = 0x01,   /* Sprite has a mask only        */
  2079.   sprite_HASPAL       = 0x02,   /* Sprite has a palette only     */
  2080.   sprite_HASMASKPAL   = 0x03,   /* Has both mask and palette     */
  2081.   sprite_HASPALMASK   = 0x03
  2082. } spritemem_flags;
  2083.  
  2084. defined in <Sprite>Sprite_InitArea
  2085. extern <os_error> *Sprite_InitArea(<sprite_area> area);
  2086.  
  2087. Initialise a sprite area - <SpriteOp 9=>SWI.OS_SpriteOp9>
  2088.  
  2089. defined in <Sprite>Sprite_Load
  2090. extern <os_error> *Sprite_Load(<sprite_area> area, char *filename);
  2091.  
  2092. Load a file into a sprite area - <SpriteOp 10=>SWI.OS_SpriteOp10>
  2093.  
  2094. defined in <Sprite>Sprite_Merge
  2095. extern os_error *Sprite_Merge(<sprite_area> area, char *filename);
  2096.  
  2097. Merge a file into a sprite area - SpriteOp 11
  2098.  
  2099. defined in <Sprite>Sprite_Save
  2100. extern <os_error> *Sprite_Save(<sprite_area> area, char *filename);
  2101.  
  2102. Save a sprite area into a file - <SpriteOp 12=>SWI.OS_SpriteOp12>
  2103.  
  2104. defined in <Sprite>Sprite_Create()
  2105. extern <os_error> *Sprite_Create(<sprite_area> area, char *name, int haspalette,
  2106.                                int width, int height, int screenmode);
  2107.  
  2108. Creates a sprite according to the parameters - <SpriteOp 15=>SWI.OS_SpriteOp15>
  2109.  
  2110. defined in <Sprite>Sprite_Delete
  2111. extern <os_error> *Sprite_Delete(<sprite_area> area, char *name);
  2112.  
  2113. Deletes the given sprite - <SpriteOp 25=>SWI.OS_SpriteOp25>
  2114.  
  2115. defined in <Sprite>Sprite_Rename
  2116. extern <os_error> *Sprite_Rename(<sprite_area> area,
  2117.                                char *oldname, char *newname);
  2118.  
  2119. Unsurprisingly, this renames a sprite - <SpriteOp 25=>SWI.OS_SpriteOp25>
  2120.  
  2121. defined in <Sprite>Sprite_Copy
  2122. extern <os_error> *Sprite_Copy(<sprite_area> area,
  2123.                              char *oldname, char *newname);
  2124.  
  2125. Unsurprisingly, this copies a sprite - <SpriteOp 26=>SWI.OS_SpriteOp26>
  2126.  
  2127. defined in <Sprite>Sprite_Get()
  2128. extern <os_error> *Sprite_Get(<sprite_area> area, char *name, int with_palette,
  2129.                             int left, int bottom, int right, int top,
  2130.                             <sprite=>sprite_ptr> *sprite_ptr);
  2131.  
  2132. Gets (creates and copies) a sprite from the given
  2133. screen rectangle - <SpriteOp 16=>SWI.OS_SpriteOp16>
  2134.  
  2135. defined in <Sprite>Sprite_Plot()
  2136. extern <os_error> *Sprite_Plot(<sprite_area> area, char *name, /* "PutUser" */
  2137.                              int x, int y, int plot_action);
  2138.  
  2139. Plots a sprite with it's bottom-left corners at the given coordinate,
  2140. using the given GCOL plot action (see <GFX>.h for plot actions) - <SpriteOp 34=>SWI.OS_SpriteOp34>
  2141.  
  2142. defined in <Sprite>Sprite_ReadInfo
  2143. extern <os_error> *Sprite_ReadInfo(<sprite_area> area, char *name,
  2144.                                  <sprite_info> *info);
  2145.  
  2146. Reads sprite information - <SpriteOp 40=>SWI.OS_SpriteOp40>
  2147.  
  2148. defined in <Sprite>Sprite_Redirect
  2149. extern <os_error> *Sprite_Redirect(<sprite_area> area, char *name,
  2150.                                  void *savearea, <sprite_outputstate> *oldstate);
  2151.  
  2152. redirects VDU output into the named sprite - <SpriteOp 60=>SWI.OS_SpriteOp60>
  2153.  
  2154. defined in <Sprite>Sprite_UnRedirect
  2155. extern <os_error> *Sprite_UnRedirect(<sprite_outputstate> *oldstate);
  2156.  
  2157. Un-redirects VDU output back to the saved state - <SpriteOp 60=>SWI.OS_SpriteOp60>
  2158.  
  2159. defined in <Sprite>Sprite_ReadSaveAreaSize
  2160. extern <os_error> *Sprite_ReadSaveAreaSize(<sprite_area> area, char *name,
  2161.                                          int *saveareasize);
  2162.  
  2163. Given a sprite area and a sprite name, returns the save area size needed
  2164. for the given sprite - <SpriteOp 62=>SWI.OS_SpriteOp62>
  2165.  
  2166. defined in <Sprite>Const: sprite_MAXNAME
  2167. #define sprite_MAXNAME    12
  2168.  
  2169. defined in <Sprite>spritepool_SYSTEM
  2170. #define spritepool_SYSTEM 0
  2171.  
  2172. defined in <Sprite>spritepool_WIMP
  2173. #define spritepool_WIMP   1
  2174.  
  2175. defined in <Sprite>Template_Initialise
  2176. extern void Template_Initialise(void);
  2177.  
  2178. Initialises the Template manager ready for use
  2179. Make sure you call this function before any other Template_ calls
  2180. --- In future, this call will be extended to include setting up
  2181.     the things necessary to use outline fonts in your windows.
  2182.  
  2183. defined in <Template>Template_Find
  2184. extern <window_block> *Template_Find(char *name);
  2185.  
  2186. Tries to find the named template, and return a pointer to it's
  2187. base window_block. This is so that you can alter the template
  2188. original. Note that this *is* the original, so don't stuff it up!
  2189. If you wish to USE the template, please use Template Clone!
  2190.  
  2191. defined in <Template>Template_Clone
  2192. extern <window_block> *Template_Clone(char *name, int maxtitlesize);
  2193.  
  2194. Makes a copy of the named template, and returns a pointer to the copy.
  2195.  
  2196. "maxtitlesize" is the number of bytes that should be allocated
  2197. for the title - this should be big enough to accomodate ANY title 
  2198. string you expect to give to this window. This is because the only way
  2199. to alter the size of this indirected field is to re-create the window
  2200. which is usually an undesirable thing to do. (See below for a list of
  2201. the possible values for this argument)
  2202.  
  2203. A value of 0 for maxtitlesize will use the default value (currently 260)
  2204. If the window's title icon is not indirected, this value is ignored
  2205. (so most of the time, using 0 is a sensible thing to do)
  2206.  
  2207. Returns NULL if the template can't be found
  2208. Dies with an error if a serious error occurs (malloc failure, etc.)
  2209.  
  2210. The following values may be used for 'maxtitlesize':
  2211.   TITLEDEFAULT   0     reserves 260 bytes, enough for a full pathname
  2212.   TITLEMIN      -1     reserves for the title as much room as set in the
  2213.                        template file (title indirected data size)
  2214.                        (the recommended value - especially for windows
  2215.                         with constant title strings)
  2216.   (any positive value) reserves 'maxtitlesize' bytes of storage for
  2217.                         the indirected title data
  2218.  
  2219. defined in <Template>Template_Free
  2220. extern void Template_Free(<window_block> **windowdef);
  2221.  
  2222. Frees up the memory used by a <Template_Clone>'d template. Results are
  2223. undefined if you free a non-Clone'd template or try to free it more
  2224. than once. (i.e. don't do it!)
  2225. Pass in a pointer to a (<window_block> *). The window definition's
  2226. memory (including indirected title/icons) will be freed, and the
  2227. (<window_block> *) will be set to NULL to ensure you don't try to use
  2228. it now that it is invalid.
  2229.  
  2230. defined in <Template>Template_Delete
  2231. extern void Template_Delete(char *name);
  2232.  
  2233. Deletes the named template from the list of available templates, freeing
  2234. any memory claimed by the template. This will "pull the rug out from
  2235. under" any windows created using this template, and your program will
  2236. crash if any such windows are open.
  2237. However, any windows created using <Template_Clone>'d templates will
  2238. be unaffected. (Moral of the story: Always use Clone)
  2239. Pass in the identifier string of the template you wish to delete
  2240.  
  2241. defined in <Template>Template_ClearAll
  2242. extern void Template_ClearAll(void);
  2243.  
  2244. Clears ALL currently held templates. (equivalent to you calling
  2245. <Template_Delete>() for each template in turn)
  2246.  
  2247. defined in <Template>Template_LoadFile
  2248. extern void Template_LoadFile(char *leafname);
  2249.  
  2250. Loads all template definitions from the specified file.
  2251. Due to the essential nature of templates, if any errors occur, this 
  2252. reports to <Error_ReportFatal>(Internal)
  2253. After loading a template file, use <Template_Clone> to get a copy
  2254. of any of the templates for use.
  2255.  
  2256. Loading a second file will simply ADD the new templates to the template
  2257. list. So long as there are no name clashes, you can then use any
  2258. template from either file.
  2259.  
  2260. Use Template_Delete/ClearAll if you don't want to keep old templates
  2261. when loading in new ones.
  2262.  
  2263. If you want to use outline fonts in windows, then remember to call
  2264. <Template_UseOutlineFonts>() BEFORE you call <Template_LoadFile>()
  2265.  
  2266. defined in <Template>Template_UseOutlineFonts
  2267. extern void Template_UseOutlineFonts(void);
  2268.  
  2269. Call this BEFORE calling <Template_LoadFile>() if you wish to use outline
  2270. fonts (rather than the system font) in your windows. It allocates the
  2271. font usage array, and also adds an atexit handler to lose all the fonts
  2272. you are using when your program exits.
  2273.  
  2274. NOTE that future versions of RISC OS *WILL* supply an outline font as the
  2275. system font, so your program should offer a choice of system font OR
  2276. outline font to the user.
  2277.  
  2278. defined in <Template>Const: UNDEFINED
  2279. #define UNDEFINED -1
  2280.  
  2281. defined in <KeyCodes>KeyCodes for Keys on their own
  2282. #define keycode_BACKSPACE   8
  2283. #define keycode_RETURN      13
  2284. #define keycode_ESCAPE      27
  2285. #define keycode_HOME        30
  2286. #define keycode_DELETE      127
  2287.  
  2288. #define keycode_F1          385
  2289. #define keycode_F2          386
  2290. #define keycode_F3          387
  2291. #define keycode_F4          388
  2292. #define keycode_F5          389
  2293. #define keycode_F6          390
  2294. #define keycode_F7          391
  2295. #define keycode_F8          392
  2296. #define keycode_F9          393
  2297.  
  2298. #define keycode_PRINT       384
  2299. #define keycode_TAB         394
  2300. #define keycode_COPY        395
  2301.  
  2302. #define keycode_CURSORLEFT  396
  2303. #define keycode_CURSORRIGHT 397
  2304. #define keycode_CURSORDOWN  398
  2305. #define keycode_CURSORUP    399
  2306. #define keycode_PAGEDOWN    414
  2307. #define keycode_PAGEUP      415
  2308.  
  2309. #define keycode_F10         458
  2310. #define keycode_F11         459
  2311. #define keycode_F12         460
  2312.  
  2313. #define keycode_INSERT      461
  2314.  
  2315. defined in <KeyCodes>KeyCodes for Keys in combination with SHIFT
  2316. #define keycode_SHIFT_BACKSPACE   <UNDEFINED>
  2317. #define keycode_SHIFT_RETURN      <UNDEFINED>
  2318. #define keycode_SHIFT_ESCAPE      <UNDEFINED>
  2319. #define keycode_SHIFT_HOME        <UNDEFINED>
  2320. #define keycode_SHIFT_DELETE      <UNDEFINED>
  2321.  
  2322. #define keycode_SHIFT_F1          401
  2323. #define keycode_SHIFT_F2          402
  2324. #define keycode_SHIFT_F3          403
  2325. #define keycode_SHIFT_F4          404
  2326. #define keycode_SHIFT_F5          405
  2327. #define keycode_SHIFT_F6          406
  2328. #define keycode_SHIFT_F7          407
  2329. #define keycode_SHIFT_F8          408
  2330. #define keycode_SHIFT_F9          409
  2331.  
  2332. #define keycode_SHIFT_PRINT       400
  2333. #define keycode_SHIFT_TAB         410
  2334. #define keycode_SHIFT_COPY        411
  2335.  
  2336. #define keycode_SHIFT_CURSORLEFT  412
  2337. #define keycode_SHIFT_CURSORRIGHT 413
  2338. #define keycode_SHIFT_CURSORDOWN  414
  2339. #define keycode_SHIFT_CURSORUP    415
  2340. #define keycode_SHIFT_PAGEDOWN    398
  2341. #define keycode_SHIFT_PAGEUP      399
  2342.  
  2343. #define keycode_SHIFT_F10         474
  2344. #define keycode_SHIFT_F11         475
  2345. #define keycode_SHIFT_F12         476
  2346.  
  2347. #define keycode_SHIFT_INSERT      477
  2348.  
  2349. defined in <KeyCodes>KeyCode for Keys in combination with CTRL
  2350. #define keycode_CTRL_BACKSPACE   <UNDEFINED>
  2351. #define keycode_CTRL_RETURN      <UNDEFINED>
  2352. #define keycode_CTRL_ESCAPE      <UNDEFINED>
  2353. #define keycode_CTRL_HOME        <UNDEFINED>
  2354. #define keycode_CTRL_DELETE      <UNDEFINED>
  2355.  
  2356. #define keycode_CTRL_F1          417
  2357. #define keycode_CTRL_F2          418
  2358. #define keycode_CTRL_F3          419
  2359. #define keycode_CTRL_F4          420
  2360. #define keycode_CTRL_F5          421
  2361. #define keycode_CTRL_F6          422
  2362. #define keycode_CTRL_F7          423
  2363. #define keycode_CTRL_F8          424
  2364. #define keycode_CTRL_F9          425
  2365.  
  2366. #define keycode_CTRL_PRINT       416
  2367. #define keycode_CTRL_TAB         426
  2368. #define keycode_CTRL_COPY        427
  2369.  
  2370. #define keycode_CTRL_CURSORLEFT  428
  2371. #define keycode_CTRL_CURSORRIGHT 429
  2372. #define keycode_CTRL_CURSORDOWN  430
  2373. #define keycode_CTRL_CURSORUP    431
  2374. #define keycode_CTRL_PAGEDOWN    446
  2375. #define keycode_CTRL_PAGEUP      447
  2376.  
  2377. #define keycode_CTRL_F10         490
  2378. #define keycode_CTRL_F11         491
  2379. #define keycode_CTRL_F12         492
  2380.  
  2381. #define keycode_CTRL_INSERT      493
  2382.  
  2383. #define keycode_CTRL_A             1
  2384. #define keycode_CTRL_B             2
  2385. #define keycode_CTRL_C             3
  2386. #define keycode_CTRL_D             4
  2387. #define keycode_CTRL_E             5
  2388. #define keycode_CTRL_F             6
  2389. #define keycode_CTRL_G             7
  2390. #define keycode_CTRL_H             8
  2391. #define keycode_CTRL_I             9
  2392. #define keycode_CTRL_J            10
  2393. #define keycode_CTRL_K            11
  2394. #define keycode_CTRL_L            12
  2395. #define keycode_CTRL_M            13
  2396. #define keycode_CTRL_N            14
  2397. #define keycode_CTRL_O            15
  2398. #define keycode_CTRL_P            16
  2399. #define keycode_CTRL_Q            17
  2400. #define keycode_CTRL_R            18
  2401. #define keycode_CTRL_S            19
  2402. #define keycode_CTRL_T            20
  2403. #define keycode_CTRL_U            21
  2404. #define keycode_CTRL_V            22
  2405. #define keycode_CTRL_W            23
  2406. #define keycode_CTRL_X            24
  2407. #define keycode_CTRL_Y            25
  2408. #define keycode_CTRL_Z            26
  2409.  
  2410. defined in <KeyCodes>Keys in combination with SHIFT & CTRL
  2411. #define keycode_CTRL_SHIFT_BACKSPACE   <UNDEFINED>
  2412. #define keycode_CTRL_SHIFT_RETURN      <UNDEFINED>
  2413. #define keycode_CTRL_SHIFT_ESCAPE      <UNDEFINED>
  2414. #define keycode_CTRL_SHIFT_HOME        <UNDEFINED>
  2415. #define keycode_CTRL_SHIFT_DELETE      <UNDEFINED>
  2416.  
  2417. #define keycode_CTRL_SHIFT_F1          0x1B1
  2418. #define keycode_CTRL_SHIFT_F2          0x1B2
  2419. #define keycode_CTRL_SHIFT_F3          0x1B3
  2420. #define keycode_CTRL_SHIFT_F4          0x1B4
  2421. #define keycode_CTRL_SHIFT_F5          0x1B5
  2422. #define keycode_CTRL_SHIFT_F6          0x1B6
  2423. #define keycode_CTRL_SHIFT_F7          0x1B7
  2424. #define keycode_CTRL_SHIFT_F8          0x1B8
  2425. #define keycode_CTRL_SHIFT_F9          0x1B9
  2426.  
  2427. #define keycode_CTRL_SHIFT_PRINT       0x1B0
  2428. #define keycode_CTRL_SHIFT_TAB         0x1BA
  2429. #define keycode_CTRL_SHIFT_COPY        0x1BB
  2430.  
  2431. #define keycode_CTRL_SHIFT_CURSORLEFT  0x1BC
  2432. #define keycode_CTRL_SHIFT_CURSORRIGHT 0x1BD
  2433. #define keycode_CTRL_SHIFT_CURSORDOWN  0x1BE
  2434. #define keycode_CTRL_SHIFT_CURSORUP    0x1BF
  2435. #define keycode_CTRL_SHIFT_PAGEDOWN    0x1AE
  2436. #define keycode_CTRL_SHIFT_PAGEUP      0x1AF
  2437.  
  2438. #define keycode_CTRL_SHIFT_F10         0x1FA
  2439. #define keycode_CTRL_SHIFT_F11         0x1FB
  2440. #define keycode_CTRL_SHIFT_F12         0x1FC
  2441.  
  2442. #define keycode_CTRL_SHIFT_INSERT      0x1FD
  2443.  
  2444. defined in <KeyCodes>Kbd_Keydown
  2445. extern BOOL Kbd_KeyDown(int keynum);
  2446.  
  2447. Checks to see if the given key is currently depressed.
  2448. 'keynum' is a negative INKEY number see also <kbd_neginkey>
  2449. Generally, it's use is for things like (eg) checking if CTRL is held
  2450. down when a click is made, as in:
  2451.     if (Kbd_KeyDown(inkey_CTRL)) ...
  2452.  
  2453. defined in <Kbd>type: kbd_neginkey
  2454. In the DeskTop environment, you shouldn't ever need to read more than the
  2455. the following keys via this method (everything else should come in via WIMP
  2456. events). If you need other values, look up the Appendix on INKEY values
  2457. in the BBC BASIC Guide (mine has this on page 411)
  2458.  
  2459. typedef enum
  2460. {
  2461.   inkey_ADJUST       = -12,       /* MOUSE 'Adj              */
  2462.   inkey_MENU         = -11,       /* MOUSE 'Menu' button     */
  2463.   inkey_SELECT       = -10,       /* MOUSE 'Select' button   */
  2464.  
  2465.   inkey_RALT         = -9,        /* Right ALT key           */
  2466.   inkey_LALT         = -6,        /* Left ALT key            */
  2467.   inkey_ALT          = -3,        /* Either/Both ALT keys    */
  2468.  
  2469.   inkey_RCTRL        = -8,        /* Right CTRL key          */
  2470.   inkey_LCTRL        = -5,        /* Left CTRL key           */
  2471.   inkey_CTRL         = -2,        /* Either/Both CTRL keys   */
  2472.  
  2473.   inkey_RSHIFT       = -7,        /* Right SHIFT key         */
  2474.   inkey_LSHIFT       = -4,        /* Left SHIFT key          */
  2475.   inkey_SHIFT        = -1         /* Either/Both SHIFT keys  */
  2476. } kbd_neginkey;
  2477.  
  2478. defined in <Kbd>Window_SetTitle
  2479. extern void Window_SetTitle(<window_handle> window, char *title);
  2480.  
  2481. (equivalent of RISC OS Lib's win_settitle, only far better)
  2482. This sets the text in the titlebar of the given window to the given string
  2483.  
  2484. NOTE that if the title is not indirected, It will be unable to change
  2485. the text, i.e. nothing will happen!
  2486.  
  2487. It has several advantages over win_settitle, however:
  2488.  + It uses legal OS calls to work out the rectange to redrawm so works
  2489.    properly even with strange sized toolsprite sets
  2490.  + It doesn't try to redraw anything if the window is CLOSED!
  2491.  + It handles indirected and text-only title icons, rather than bombing
  2492.    completely if the titlebar is not indirected.
  2493.  + It actually terminates the string if it was too long to fit!!!
  2494.  
  2495.  (And people wonder why I think ROLib is a load of excrement!)
  2496.  
  2497.  Unfortunately it is not possible to only invalidate the VISIBLE area
  2498.  of the window, so this may still create the occasional flicker of any
  2499.  windows over the top of your titlebar... this can't be helped.
  2500.  
  2501. defined in <Window>Window_ModeChange
  2502. extern void Window_ModeChange(void);
  2503.  
  2504. This function will go through all your templates and all windows that
  2505. were created with Window_ calls, and re-find their outline fonts so
  2506. that they are displayed correctly - this needs to be done after some
  2507. mode changes. See <Handler>.h - <Handler_ModeChangeWithFonts>() to see
  2508. how this should/can be used.
  2509.  
  2510. NOTE: If you create ANY windows without using <Window_Create> calls, then
  2511. this function will not fix their outline font use - but MUCH MORE
  2512. IMPORTANTLY it will release the font, which may later be replaced
  2513. by another font (or worse, cease to exists totally), so strange or
  2514. unhealthy effects might ensue. i.e. ONLY use this if using <Window_Create>.
  2515.  
  2516. Note also that this does NOT attempt to fix fonts in window titles
  2517. because
  2518.  a) The WIMP currently gets antialiased fonts *very* wrong with toolsprites
  2519.     and/or titlebar selection, so they aren't recommended
  2520.  b) Acorn DO have a new WIMP which uses an Outline font instead of system,
  2521.     so the problem WILL go away with the next OS release.
  2522.  c) This would involve re-creating the window, which would mean a possible
  2523.     change in the window handle, which is something we can't do.
  2524.  
  2525. defined in <Window>Window_HelpHandler
  2526. extern BOOL Window_HelpHandler(<event_pollblock> *event, void *reference);
  2527.  
  2528. This is an event handler (added with <Window_AutoHelp>) which provides
  2529. help on windows and their icons.
  2530. If you wish to augment the help available for a window, you can call
  2531. this handler yourself. Checking if it returns TRUE or FALSE gives an
  2532. indicator of whether or not a help reply has been sent.
  2533. Generally, you will check if the pointer is in an area of the window
  2534. and supply help for that special area - if not, you drop back to a
  2535. "fallback" position, and allow the "default" action, by callinf this
  2536. handler.
  2537. The other method is to add your own specialised help handler with
  2538. <Event_Claim>, and then add this handler, so that your handler gets first
  2539. choice when the event comes in.
  2540.  
  2541. defined in <Window>Window_AutoHelp
  2542. extern BOOL Window_AutoHelp(<window_handle> window, <icon_handle> icon);
  2543.  
  2544. This adds an event handler for the given window and icon (event_ANY and
  2545. window_ICONBAR may be used). Every HelpRequest message thereafter
  2546. received for that window will be answered (if possible) with a message
  2547. from your messages (see <Msgs>) file.
  2548. The message tag used will be constructed from the window's template-name
  2549. and the icon number, as in:
  2550.    mainwind.-1   - Any part of the window not covered by an icon
  2551.    mainwind.3    - Icon 3 of any window created from "mainwind" template
  2552.  
  2553. In the messages file, you can also use a catch-all message of:
  2554.    mainwind.*
  2555. which will catch ALL helprequests for the window, so ANY part of the
  2556. window is guaranteed to give help (if no specific help for an icon is
  2557. found, then the catch-all help will be used)
  2558.  
  2559. NOTE that this function (Window.AutoHelp.c) may be recompiled to use
  2560. <EventMsg_Claim> rather than <Event_Claim> if you so desire. However,
  2561. note that currently EventMsg ignores the icon handle.
  2562. <EventMsg> is more efficient than having multiple <Event_Claim>s on
  2563. incoming message events (especially when you add individual handlers for
  2564. single windows/icons), but ONLY if you are using several message event
  2565. handlers. Thus, the default here is to use <Event_Claim> so as to not
  2566. "pull in" the code for <EventMsg> unless you want to use it.
  2567.  
  2568. defined <Window>Window_ParentName
  2569. extern void Window_ParentName(<window_handle> window, char *windowname);
  2570.  
  2571. Given any window's handle, this function attempts to find the name
  2572. (8 characters only, truncated if necessary) of the template from which
  2573. the window was created (only works if created with <Window_Create>)
  2574. - if the window handle is a negative number, "iconbar" is returned.
  2575.  
  2576. defined in <Window>Window_GetInfo
  2577. extern void Window_GetInfo(<window_handle> window, <window_info> *result);
  2578.  
  2579. This is simply a frontend to the <Wimp_GetWindowInfo> call. However, it
  2580. returns the Window info block with the icon definitions STRIPPED.
  2581. Thus, you can use a window_info structure in your local variables without
  2582. having to allocate enough memory to cope with any icons that the window
  2583. happens to have in it.
  2584.  
  2585. defined in <Window_GetInfo>Window_Delete
  2586. extern void Window_Delete(<window_handle> window);
  2587.  
  2588. This Hides and deletes ANY window.
  2589. It also removes any Event handlers attached to the window.
  2590. If the window was created with <Window_Create>(), then it also
  2591. deallocates any memory used by the window.
  2592.  
  2593. defined in <Window>Window_Hide
  2594. #define Window_Hide(handle) <Wimp_CloseWindow>(handle)
  2595.  
  2596. Closes the specified window (removes it from screen)
  2597. THE WINDOW IS NOT DELETED, just "hidden". It is preferable that you use
  2598. <Window_Create>() and <Window_Delete>() every time you want a window to
  2599. appear/disappear, to avoid problems.
  2600.  
  2601. defined in <Window>Window_CreateAndShow
  2602. extern <window_handle> Window_CreateAndShow(char *windowname,
  2603.                                           int  maxtitlesize,
  2604.                                           <window_openpos> openpos);
  2605.  
  2606. Simply calls <Window_Create>() and then <Window_Show>()
  2607. (Just to make your programs slightly tidier)
  2608.  
  2609. defined in <Window>Window_Show
  2610. extern void Window_Show(<window_handle> window, <window_openpos> openpos);
  2611.  
  2612. This opens the given window on-screen in the desired position.
  2613. (It can be used with ANY window, even if not created with <Window_Create>)
  2614.  
  2615. defined in <Window>Window_Create
  2616. extern <window_handle> Window_Create(char *windowname, int maxtitlesize);
  2617.  
  2618. This finds the named window template and creates a new copy of the window.
  2619. It also records the memory allocated for the window so that it can be
  2620. deallocated when the window is closed (using <Window_Delete>)
  2621.  
  2622. "maxtitlesize" is the maximum length the window's title will be allowed
  2623. grow to. (See <Template>.h: <Template_Clone>())
  2624.  
  2625. Returns: The WIMP handle of the newly-created window.
  2626.  
  2627. defined in <Window>type: window_openpos
  2628. typedef enum
  2629. {
  2630.   open_WHEREVER,
  2631.   open_CENTERED,        /* center of screen */
  2632.   open_OVERCARET,       /* Over the current caret position 
  2633.                            NOTE: If no caret, window is opened open_CENTERED */
  2634.   open_UNDERPOINTER,    /* Under the current pointer position                */
  2635.   open_NEARLAST         /* Slightly offset from the T.L. pos of the last
  2636.                            window to be opened with <Window_Show>              */
  2637. } window_openpos;
  2638.  
  2639. defined in <Window>Screen_CacheModeInfo
  2640. extern BOOL Screen_CacheModeInfo(void);
  2641.  
  2642. This should be called before you try to use any of the global variables
  2643. in <Screen>. It only needs to be called whenever the screen mode changes
  2644. so call it:
  2645.   a) When you initialise your program, and whenever a mode change
  2646.      message is received (see <ModeChangeHandler>, below)
  2647.   b) Immediately before you use the variables (i.e. in your redraw
  2648.      handler, etc.)
  2649.  
  2650. It checks the screenmode, and if it has not changed, then the variables
  2651. are not updated, so it is not too bad if you call it more often than
  2652. you really need to (i.e. every time you redraw, for example).
  2653.  
  2654. defined in <Screen>type: filter_handler
  2655. typedef int (*filter_handler)(int event, const <event_pollblock> *event,
  2656.                              const int task);
  2657.  
  2658. defined in <Filter>Filter_RegisterPreFilter
  2659. extern void Filter_RegisterPreFilter(char *filtername,
  2660.                                      <filter_handler> handler, int R12,
  2661.                                      <task_handle> task);
  2662.  
  2663. defined in <Filter>Filter_RegisterPostFilte
  2664. extern void Filter_RegisterPostFilter(char *filtername,
  2665.                                       <filter_handler> handler, int R12,
  2666.                                       <task_handle> task, int eventmask);
  2667.  
  2668. defined in <Filter>Filter_DeRegisterPreFilter
  2669. extern void Filter_DeRegisterPreFilter(char *filtername,
  2670.                                        <filter_handler> handler, int R12,
  2671.                                        <task_handle> task);
  2672.  
  2673. defined in <Filter>Filter_DeRegisterPostFilter
  2674. extern void Filter_DeRegisterPostFilter(char *filtername,
  2675.                                         <filter_handler> handler, int R12,
  2676.                                         <task_handle> task);
  2677.  
  2678. defined in <Filter>type: os_error
  2679. typedef struct {
  2680.  int  errnum; 
  2681.  char errmess[252]; 
  2682. } os_error;
  2683.  
  2684. defined in <Core>Validation_ScanString
  2685. extern int Validation_ScanString(char *string, char tag);
  2686.  
  2687. Scan the passed-in string for the special tag character, and return the
  2688. index of the next char. e.g. scanning "a0-9;b3" for the bordertype can be
  2689. done as follows:
  2690.  
  2691. if (border = Icon_ScanValidString(icon.data.indirecttext.validstring, 'B'))
  2692. {
  2693.   border = icon.data.indirecttext.validstring[border] - '0';
  2694.   switch (border)
  2695.   ...
  2696. }
  2697.  
  2698. If the tag is not found, a value of 0 will be returned, else the value
  2699. is the index of the character FOLLOWING the tag in the string.
  2700. (NOTE that the tag must be either the first character, or must directly
  2701.  follow a semicolon)
  2702.  
  2703. defined in <Validation>type: colourtrans_fontblock
  2704. typedef struct
  2705. {
  2706.   int font;
  2707.   int back;
  2708.   int fore;
  2709.   int max;
  2710. } colourtrans_fontblock;
  2711.  
  2712. defined in <ColourTran>ColourTrans_SetGCOL
  2713. extern <os_error> *ColourTrans_SetGCOL(int palette, int flag, int gcol);
  2714.  
  2715. defined in <ColourTran>ColourTrans_InvalidateCache
  2716. extern <os_error> *ColourTrans_InvalidateCache(void);
  2717.  
  2718. defined in <ColourTran>ColourTrans_SelectTable
  2719. extern <os_error> *ColourTrans_SelectTable(int src_mode, int *src_pal,
  2720.                                          int dst_mode, int *dst_pal,
  2721.                                          char *table);
  2722.  
  2723. defined in <ColourTran>ColourTrans_ReturnFontColours
  2724. extern <os_error> *ColourTrans_ReturnFontColours(<colourtrans_fontblock> *fontcols);
  2725.  
  2726. defined in <ColourTran>Resource_InitialisePath
  2727. extern void Resource_InitialisePath(char *respath);
  2728.  
  2729. Initialises the resource manager.
  2730.  
  2731. If you prefer to use a path variable for your resources (for easier
  2732. setting of language resources), then you can initialise the resources
  2733. by calling this function.
  2734. (Instead of setting the resource prefix to "\<AppName$Dir\>.", it will
  2735.  set it to "AppName:", where "AppName" is the 'respath' parameter)
  2736.  
  2737. See also the ALTERNATIVE call, <Resource_Initialise>()
  2738.  
  2739. defined in <Resource>Resource_Initialise
  2740. extern void Resource_Initialise(char *respath);
  2741.  
  2742. Initialises the resource manager. Pass in the name of your application
  2743. (e.g. if you have set \<appname$Dir\>, pass in "appname")
  2744. This tells all DeskLib modules where to look for your resources
  2745. by setting resource_pathname to "\<Appname$Dir\>." - this is prepended
  2746. to all leafnames to create full resource pathnames.
  2747. This pathname is used by various DeskLib modules (<Template>, <Msgs>, etc)
  2748. -it adds very little code size to your program, and saves you the
  2749. work of doing the pathname yourself. It also makes changing the
  2750. resource directory at a later development stage far easier.
  2751.  
  2752. See also the ALTERNATIVE call, <Resource_InitialisePath>()
  2753.  
  2754. defined in <Resource>var: resource_pathname
  2755. extern char resource_pathname[32];
  2756.  
  2757. This string is used as a prefix for all pathnames in DSEdit that load
  2758. resource files. It is set up by either of the following calls, to be either
  2759.   "\<Name$Dir\>."
  2760. or
  2761.   "Name:"
  2762. It is prepended to a leafname (e.g. \<Floob$Dir\>.Sprites or Floob:Sprites)
  2763. by some Desklib modules in order to find the resources.
  2764. (See Misc.c.ResInit, Misc.c.ResInitPth to see exactly what these very
  2765. simple functions do)
  2766.  
  2767. defined in <Resource>Msgs_ReportFatal
  2768. extern void Msgs_ReportFatal(int errnum, char *tag, ...);
  2769.  
  2770. As for <Msgs_Report> but calls <Error_ReportFatal>
  2771.  
  2772. defined in <Msgs>Msgs_Report
  2773. extern void Msgs_Report(int errnum, char *tag, ...);
  2774.  
  2775. Reports an error for the message specified by tag.
  2776. You can also pass variable parameters for substitution.
  2777. (See <Error>.h - <Error_Report> for the non-messagetrans'd version of this)
  2778.  
  2779. defined in <Msgs>Msgs_DropGroup
  2780. extern void Msgs_DropGroup(char *grouptag);
  2781.  
  2782. Drops (deletes) a message group from memory
  2783. This is useful for regaining memory when a set of messages is no longer
  2784. needed (e.g. Help messages can be discarded when a user turns off help)
  2785.  
  2786. To get discarded messages back, you must re-call <Msgs_LoadFile> for the
  2787. appropriate messages file.
  2788.  
  2789. defined in <Msgs>Msgs_LoadFile
  2790. extern BOOL Msgs_LoadFile(char *leafname);
  2791.  
  2792. Merges the given messages file into the current list of messages
  2793. (Uses <Resource> to supply the pathname)
  2794. Messages with the same group.msg tag will be overwritten by the
  2795. new messages coming in from the file.
  2796.  
  2797. Expects lines of the form:
  2798.     group.msg: message text continuing to newline
  2799. Leading spaces are stripped
  2800.  
  2801. defined in <Msgs>Msgs_printf
  2802. extern void Msgs_printf(char *result, char *formattag, ...);
  2803.  
  2804. Equivalent to sprintf(), but the "formattag" string is NOT a format
  2805. string, but rather a Msgs tag which is given to <Msgs_Lookup> in order
  2806. to generate a format string for subsequent use.
  2807.  
  2808. defined in <Msgs>Msgs_Lookup
  2809. extern BOOL Msgs_Lookup(char *tag, char *result, int maxlength);
  2810.  
  2811. Looks up the tag in the current message list, and copies the appropriate
  2812. message into result if found. (no more than maxlength characters will
  2813. be copied, so you can copy directly into icon indirected text, etc.
  2814. REMEMBER that arrays start at 0, so if you have "char result[12]", use
  2815. Msgs_Lookup(tag, result, 11))
  2816.  
  2817. The tag string should be of the form:
  2818.   "group.tag:default"  or  "group.tag"
  2819.  
  2820. The message found will be searched for <> includes. If any are found,
  2821. Msgs_Lookup() will be recursively invoked in order to compile
  2822. the final string. Note that circular references are not detected,
  2823. and will cause stack-chewing recursion until all memory is eaten up,
  2824. at which point the recursion (and all life as it we know it) will stop.
  2825.  
  2826. Remember also that more memory than is immediately obvious will
  2827. be needed for messages which include others. However, everything will
  2828. be truncated if necessary at "maxlength" characters.
  2829.  
  2830. NOTE: leading spaces are NOT removed by this call - you MUST use
  2831.       a compact, space-free format in your program (though you can use
  2832.       spaces for readability of your messages files)
  2833.       [This saves code size in this function, as well as forcing you to
  2834.        not waste space in your executable]
  2835.  
  2836. -If the message for group.tag is not found, then default is returned
  2837.  (if no default, then the null string is returned - result[0] == '\0')
  2838.  
  2839. -If the message is found in the message list, TRUE is returned
  2840. -If the default has to be used, TRUE is returned
  2841. Otherwise FALSE is returned, and result[0] == '\0'
  2842.  
  2843. (Thus, if you get (Msgs_Lookup(...) == FALSE) then you have no valid
  2844. text to use. (Acorn's msgs returns the tag, which is very annoying
  2845. when you don't want tags appearing in your interface if anything goes
  2846. wrong)
  2847.  
  2848. defined in <Msgs>TextFile_ReadToDelimiter
  2849. extern void TextFile_ReadToDelimiter(FILE *infile, char delimiter,
  2850.                                      char *line, int maxlength);
  2851.  
  2852. Reads characters from the given file until eof or delimiter character
  2853. Delimiter is typically a newline character, which gives read-to-eol
  2854. Leading spaces/tabs are ignored
  2855. Won't read more than "maxlength" characters (maxlength *includes* 0
  2856. string-terminating character)
  2857.  
  2858. defined in <TextFile>TextFile_GetToken
  2859. extern void TextFile_GetToken(FILE *infile, char delimiter,
  2860.                               char *token,  BOOL lowercase);
  2861. Read in a token from a file. A token is defined as:
  2862.   A sequence of up to 32 characters, delimited by a specific character
  2863.   or a newline. Leading spaces/tabs are ignored.
  2864.  
  2865. This is generally used to read a word from a textfile (delimiter = ' ')
  2866. or to read tags from a msgtrans style file (delimiter = ":")
  2867.  
  2868. defined in <TextFile>TextFile_SkipBlanks
  2869. extern void TextFile_SkipBlanks(FILE *infile);
  2870.  
  2871. reads characters from the given file until eof or until a non-blank
  2872. (space or tab character) is found.
  2873.  
  2874. defined in <TextFile>TextFile_Lowercase
  2875. #define TextFile_Lowercase(x) (((x)\>='A' && (x)\<='Z') ? (x)+32 : (x))
  2876.  
  2877. This macro converts all uppercase chars to lowercase
  2878.  
  2879. defined in <TextFile>type: dispatch_proc
  2880. typedef void (*dispatch_proc)();
  2881.  
  2882. Used in <Dispatch>()Event_CloseDown
  2883. extern void Event_CloseDown(void);
  2884.  
  2885. Call this to CloseDown (quit) the application
  2886.  
  2887. defined in <Event>Event_Initialise3
  2888. extern void Event_Initialise3(char *taskname, int version, int *messages);
  2889.  
  2890. Extended version of <Event_Initialise> which allows the wimp version
  2891. number to be set and the list of acceptable messages to be passed
  2892.  
  2893. This function should only be used for version numbers of 300 or greater
  2894. (i.e. for tasks which will only run on RISC OS 3 or later versions).
  2895.  
  2896. defined in <Event>Event_Initialise
  2897.  
  2898. extern void Event_Initialise(char *taskname);
  2899.  
  2900. Call this once to initialise the Wimp and the event manager
  2901. **** This call is obsolescent, and should only be used if you still need
  2902.      RISC OS 2 compatability - see <Event_Initialise3>
  2903.  
  2904. defined in <Event>Event_Poll
  2905. extern void Event_Poll(void);
  2906.  
  2907. Main event poll routine. Use as in:
  2908.   while (TRUE)
  2909.     Event_Poll();
  2910.  
  2911. defined in <Event>Event_Process
  2912. extern void Event_Process(<event_pollblock> *event);
  2913.  
  2914. Call this to process a <Wimp_Poll> event. It will cascade the event down
  2915. through the event-handler hierarchy until one of your event handlers
  2916. returns TRUE to indicate succesful handling of the message.
  2917. NOTE that <Event_Poll> calls <Wimp_Poll> and <Event_Process> for you.
  2918.  
  2919. defined in <Event>Event_ReleaseWindow
  2920. extern void Event_ReleaseWindow(<window_handle> window);
  2921.  
  2922. This is similar to <Event_Release>, but rather than delinking ONE handler
  2923. it delinks ALL handlers attached to the given window. This should be done
  2924. if you close/delete the window using low-level routines. (It is done
  2925. automatically if you use <Window>_ calls to remove the window)
  2926.  
  2927. defined in <Event>Event_Release
  2928. extern BOOL Event_Release(<event_type> event,
  2929.                           <window_handle>  window, <icon_handle> icon,
  2930.                           <event_handler> handler, void *reference);
  2931.  
  2932. This will release your claim on an event, removing the given handler
  2933. from further usage.
  2934. The parameters passed in should be the same as those passed to
  2935. <Event_Claim>
  2936.  
  2937. defined in <Event>Event_Claim
  2938. extern BOOL Event_Claim(<event_type> eventtype,
  2939.                         <window_handle> window,  <icon_handle> icon,
  2940.                         <event_handler> handler, void *reference);
  2941.  
  2942. Call this function to claim an event. This attaches the given handler
  2943. function to the given event for all future event processing.
  2944.    eventtype should be event_ANY  - to handle all events, or
  2945.              an event type        - to handle a specific event
  2946.    window    should be event_ANY  - if not window-specific, or
  2947.              a window handle      - to attach ONLY to that window
  2948.    icon      should be event_ANY  - if not icon-specific, or
  2949.              an icon handle       - to attach ONLY to that icon
  2950.              (NOTE: if icon != event_ANY, window MUST be defined)
  2951.  
  2952.    handler   is the address of your handler function
  2953.    reference is a handle for any user-data you want passed to the
  2954.              function whenever it is called.
  2955.  
  2956. defined in <Event>type: event_handler
  2957. typedef BOOL (*event_handler) (<event_pollblock> *poll_block, void *reference);
  2958.  
  2959. user event_handler function
  2960.  
  2961. defined in <Event>Var: event_mask
  2962. extern <event_pollmask> event_mask;
  2963.  
  2964. Mask used by event_ FNs for <Wimp_Poll>
  2965.  
  2966. defined in <Event>Var: event_taskhandle
  2967. extern int event_taskhandle;
  2968.  
  2969. WIMP task-handle of this application
  2970.  
  2971. defined in <Event>Var: event_wimpversion
  2972. extern unsigned int event_wimpversion;
  2973.  
  2974. Wimp version number * 100
  2975.  
  2976. defined in <Event>event_taskname
  2977. extern char event_taskname[40];
  2978.  
  2979. Application name
  2980.  
  2981. defined in <Event>event_lastevent
  2982. extern <event_pollblock> event_lastevent;
  2983.  
  2984. Last event received by event_()
  2985.  
  2986. defined in <Wimp>EventMsg_ReleaseMessage
  2987. extern BOOL EventMsg_ReleaseMessage(<message_action> messagetype);
  2988.  
  2989. Finds and removes all message handlers that relate to the specified
  2990. message type. If you pass in event_ANY as the type, all handlers that
  2991. are not message-specific will be released.
  2992.  
  2993. defined in <EventMsg>EventMsg_ReleaseWindow
  2994. extern int EventMsg_ReleaseWindow(<window_handle> window);
  2995.  
  2996. Finds and removes all message handlers that relate to the given window.
  2997. If you pass in event_ANY as the window handle, all non-window-specific
  2998. handlers will be released.
  2999.  
  3000. defined in <EventMsg>EventMsg_Release
  3001. extern int EventMsg_Release(<message_action> messagetype, <window_handle> window,
  3002.                             <event_handler> handler);
  3003.  
  3004. Release the handler for a specific message type and specific window
  3005. combination.
  3006. If you pass in event_ANY for the messagetype, only non-message-specific
  3007. handlers may be released. (c.f. <EventMsg_ReleaseMessage>)
  3008. If you pass in event_ANY for the window handle, only non-window-specific
  3009. handlers may be released. (c.f. <EventMsg_ReleaseWindow>)
  3010.  
  3011. defined in <EventMsg>EventMsg_Claim
  3012. extern BOOL EventMsg_Claim(<message_action> messagetype, <window_handle> window,
  3013.                            <event_handler> handler, void *reference);
  3014.  
  3015. Much like <Event_Claim>
  3016. Pass in the type of message (message action) you wish to handle, or
  3017. event_ANY to handle ALL messages.
  3018. Pass in the window for which this applies (event_ANY == all windows)
  3019. Also pass in the handler function itself (a standard event_handler)
  3020. and your own reference.
  3021. Specific-window handlers will have priority over general handlers when
  3022. an incoming message is dispatched to your registered handlers.
  3023.  
  3024. defined in <EventMsg>EventMsg_Initialise
  3025. extern void EventMsg_Initialise(void);
  3026.  
  3027. Initialises the EventMsg system ready for use. Attaches EventMsg event
  3028. handlers to catch all incoming Wimp messages (events 17, 18).
  3029.  
  3030. defined in <EventMsg>Handler_ModeChange
  3031. extern BOOL Handler_ModeChange(<event_pollblock> *event, void *reference);
  3032.  
  3033. This is a handler for mode change events. It calls <Screen_CacheModeInfo>()
  3034. every time the screen mode changes, guaranteeing that the screen variables
  3035. are always correct (EXCEPT, YOU must call <Screen_CacheModeInfo>() once
  3036. during initialisation.
  3037.  
  3038. If you have called <Template_UseOutlineFonts>() and the screen resolution
  3039. has changed in such a way as to necessitate it, it also calls
  3040. <Window_ModeChange> to fix all your icons which use outline fonts
  3041. (otherwise, they often become the wrong size upon a mode change)
  3042. (Note that this won't have a very useful effect unless you use <Template>
  3043. and <Window> functions to create all your windows - in fact, such windows
  3044. will no longer 'own' the fonts they are using, and these fonts may
  3045. disappear or change at random in the future - so DON'T use this function
  3046. unless ALL your windows were created with <Window_Create>
  3047.  
  3048. See also <Window>.h
  3049.  
  3050. Attach it to mode change messages using:
  3051.  <EventMsg_Claim>(message_MODECHANGE, event_any, Handler_ModeChange, NULL);
  3052.  
  3053. defined in <Handler>Handler_ClickOK
  3054. Handler for clicks on "OK" or "Cancel" (3-d) type buttons
  3055. (Indents the button, waits for 1/3 second, and un-indents the button)
  3056.  
  3057. extern BOOL Handler_ClickOK(<event_pollblock> *event, void *reference);
  3058.  
  3059. defined in <Handler>Handler_NullRedraw
  3060. extern BOOL Handler_NullRedraw(<event_pollblock> *event, void *reference);
  3061.  
  3062. Supplies a NULL redraw loop (gets rectangles from the WIMP until
  3063. all rectangles have been "redrawn"). Doesn't actually do any drawing
  3064. though.
  3065.  
  3066. defined in <Handler>Handler_OpenWindow
  3067. extern BOOL Handler_OpenWindow(<event_pollblock> *event, void *reference);
  3068.  
  3069. Simply calls <Wimp_OpenWindow>()
  3070.  
  3071. defined in <Handler>Handler_DeleteWindow
  3072. extern BOOL Handler_DeleteWindow(<event_pollblock> *event, void *reference);
  3073.  
  3074. Alternate handler to <Handler_Close>, which calls the higher-level
  3075. <Window_Delete>() to close and delete the window, release memory, and
  3076. remove all handlers attached to the window.
  3077.  
  3078. defined in <Handler>Handler_CloseWindow
  3079. extern BOOL Handler_CloseWindow(<event_pollblock> *event, void *reference);
  3080.  
  3081. Simply calls Wimp_CloseWindow()
  3082.  
  3083. defined in <Handler>Dialog_StillOpen
  3084. extern BOOL Dialog_StillOpen(<dialog=>dialog_t> d);
  3085.  
  3086. Returns TRUE if the dialogue window is still open
  3087.  
  3088. defined in <Dialog>type: dialog
  3089. typedef <dialog_record> *dialog;
  3090.  
  3091. defined in <Dialog>type dialog_record
  3092. typedef struct
  3093. {
  3094.   <window_handle> window;         /* The window handle of this dialogue window */
  3095.   <icon_handle>   lastclicked;    /* The icon handle of the last icon that was
  3096.                                  * clicked, or dialog_NOCHOICE if no icons
  3097.                                  * have been clicked yet.
  3098.                                  */
  3099.   struct
  3100.   {
  3101.     unsigned int stillopen : 1;    /* The dialogue window is still open      */
  3102.     unsigned int persist   : 1;    /* It should persist (adjust was clicked) */
  3103.     unsigned int isstatic  : 1;    /* It is a static (permanent) dialogue    */ 
  3104.   } state;
  3105. } dialog_record;
  3106.  
  3107. defined in <Dialog>Dialog_LastClicked
  3108. extern <icon_handle> Dialog_LastClicked(<dialog=>dialog_t> d);
  3109.  
  3110. Returns the icon number of the last icon which was clicked in the
  3111. dialogue window. If no icons have been clicked yet, returns
  3112. dialog_NOCHOICE.
  3113.  
  3114. defined in <Dialog>Dialog_Persist
  3115. extern BOOL Dialog_Persist(<dialog=>dialog_t> d);
  3116.  
  3117. Returns TRUE if the last choice made for this dialogue box was made with
  3118. adjust, and the dialogue window is still open - i.e. the user wants
  3119. the dialogue to stay open.
  3120. Unlike RISC OS Lib, this remembers the last click rather than just
  3121. checking if Adjust is down when called, so will work even after an
  3122. indentation delay.
  3123.  
  3124. defined in <Dialog>Dialog_WindowHandle
  3125. extern <window_handle> Dialog_WindowHandle(<dialog=>dialog_t> d);
  3126.  
  3127. Returns the RISC OS Wimp window handle associated with this dialogue box.
  3128. This allows filling in of fields using, e.g. DeskLib's '<Icon>' module.
  3129.  
  3130. defined in <Dialog>Dialog_WaitForClick
  3131. extern int Dialog_WaitForClick(<dialog=>dialog_t> d);
  3132.  
  3133. Waits for an icon to be clicked in the dialogue box.  All other events
  3134. are processed as usual.  If the user closes the window, dialog_CLOSE
  3135. is returned.
  3136. Note that <Dialog_LastClicked> can be called at any time up until you call
  3137. <Dialog_Destroy>() to find out what the last valid icon click was (i.e.
  3138. the last positive value that <WaitForClick> returned)
  3139.  
  3140. defined in <Dialog>Dialog_ShowStatic
  3141. extern void Dialog_ShowStatic(<dialog=>dialog_t> d,<window_openpos> openpos);
  3142.  
  3143. As <Dialog_Show>(), but more permanent - only a click on the close icon
  3144. (if present) will close it.  Of course it may be closed by other means
  3145. if the application assigns special meaning to an icon  - e.g. a cancel
  3146. button - and closes it itself when this icon is clicked on.
  3147. Opens the window at the position specifeid by openpos
  3148.  
  3149. (It is very convenient if dialogues always appear under the mouse pointer
  3150. especially as mouse-movement distances (screen sizes) increase)
  3151.  
  3152. defined in <Dialog>Dialog_Show
  3153. extern void Dialog_Show(<dialog=>dialog_t> d);
  3154.  
  3155. Shows a dialogue box in the centre of the screen, as a submenu window.
  3156. (i.e. clicking outside the window or pressing escape will remove it)
  3157.  
  3158. defined in <Dialog>Dialog_Destroy
  3159. extern void Dialog_Destroy(<dialog=>dialog_t> d);
  3160.  
  3161. Removes from display and deletes a dialogue box structure.
  3162. NOTE that the dialog structure is free'd by this, so you cannot call
  3163. any dialogue functions (except Create of course) with it after a Destroy
  3164.  
  3165. defined in <Dialog>Dialog_Create
  3166. extern <dialog=>dialog_t> Dialog_Create(char *template_name, int maxtitlesize);
  3167.  
  3168. Creates (but does not show) a dialog box from a named template.
  3169.  
  3170. defined in <Dialog>An example of how to use Dialog.h
  3171. (Assuming a window where icon 0 is the 'OK' button, and icon 1 is the
  3172.  'Cancel' button)
  3173.  
  3174. {
  3175.   <dialog=>dialog_t> dlog;
  3176.  
  3177.   dlog = <Dialog_Create>("template", 0);           /* Create the window    */
  3178.   <Dialog_ShowStatic>(dlog, open_UNDERPOINTER);    /* Pop up under pointer */
  3179.  
  3180.   while (<Dialog_WaitForClick>(dlog) > 1 || <Dialog_Persist>(dlog))
  3181.     /* Busy wait loop */ ;                       /* Wait for OK/Cancel   */
  3182.  
  3183.   <Window_Hide>(dlog);      /* Hide the window before we start processing  */
  3184.  
  3185.   if (<Dialog_LastClicked>(dlog) == 0)
  3186.      ProcessTheData();     /* OK was clicked, so go ahead with processing */
  3187.  
  3188.   <Dialog_Destroy>(dlog);
  3189. }GFX_Wait
  3190. extern void GFX_Wait(void);
  3191.  
  3192. (equivalent to WAIT, *FX 19, OS_Byte 19)
  3193.  
  3194. This call does not return until the vertical refresh has finished.
  3195. This means that you get control back after the hardware has
  3196. finshed updating the screen so if you do any drawing immediately
  3197. after this call it will be done while the screen is not being
  3198. drawn. This helps reduce flicker. Calling this procedure in Wimp
  3199. applications should be only used sparingly as overuse will slow down
  3200. screen output to an unacceptable level. Generally only use by
  3201. experimentation--write your graphics code, if it flickers too much try
  3202. putting in a GFX_Wait() and see if it helps. If it does and the update
  3203. speed isn't adversly affected then leave it in.
  3204.  
  3205. defined in <GFX>GFX_WriteN
  3206. extern void GFX_WriteN(char *string, int numchars);
  3207.  
  3208. Writes 'numchars' characters from the given string to the VDU stream
  3209. (veneer for <SWI OS_WriteN=>SWI.OS_WriteN>)
  3210.  
  3211. defined in <GFX>GFX_Write0
  3212. extern void GFX_Write0(char *string);
  3213.  
  3214. Writes the given zero-terminated string to the VDU stream
  3215. (veneer for <SWI OS_Write0=>SWI.OS_Write0>)
  3216.  
  3217. defined in <GFX>GFX_VDU
  3218. extern void GFX_VDU(char ch);
  3219. #define VDU(C) GFX_VDU(C)
  3220.  
  3221. (An <OS_WriteC=>SWI.OS_WriteC> veneer)
  3222. Writes the given ASCII character to the VDU stream
  3223. A macro is defined to allow use of the form VDU() as well as GFX_VDU()
  3224.  
  3225. defined in <GFX>GFX_CLG
  3226. extern void GFX_CLG(void);
  3227.  
  3228. Clears the current graphics window to the current background colour
  3229.  
  3230. defined in <GFX>GFX_CircleFill
  3231. #define GFX_CircleFill(x, y, r)                             \\
  3232.   {                                                         \\
  3233.     <GFX_Move>(x, y);                                         \\
  3234.     <GFX_Plot>(plot_CIRCLEFILL + plot_DRAWRELFORE, (r), 0);   \\
  3235.   }
  3236.  
  3237. defined in <GFX>GFX_Circle
  3238. #define GFX_Circle(x, y, r)                                 \\
  3239.   {                                                         \\
  3240.     <GFX_Move>(x, y);                                         \\
  3241.     <GFX_Plot>(plot_CIRCLE + plot_DRAWRELFORE, (r), 0);       \\
  3242.   }
  3243.  
  3244. defined in <GFX>GFX_RectangleFill
  3245. #define GFX_RectangleFill(x, y, w, h)                       \\
  3246.   {                                                         \\
  3247.     GFX_Move(x, y);                                         \\
  3248.     <GFX_Plot>(plot_RECTANGLEFILL + plot_DRAWRELFORE, w, h);  \\
  3249.   }
  3250.  
  3251. defined in <GFX>GFX_Rectangle
  3252. extern void GFX_Rectangle(int x, int y, int width, int height);
  3253.  
  3254. defined in <GFX>GFX_ miscellaneous drawing macros
  3255. Below are some macros using GFX_Plot to make life easier for you.
  3256. the "By" form (MoveBy, etc) moves/draws relative to the current cursor
  3257. position, while the other form draws in absolute OS coords.
  3258.  
  3259. GFX_Move(X, Y)  Moves the graphics cursor to the OS co-ordinates X, Y
  3260. GFX_Plot(X, Y)  Plots a pixel at the specified position
  3261. GFX_Draw(X, Y)  Draws a line from the current cursor position to x,y
  3262.  
  3263. #define GFX_Move(x, y) GFX_Plot(plot_SOLIDBOTH + plot_MOVECURSORABS, x, y)
  3264. #define GFX_MoveBy(x, y) GFX_Plot(plot_SOLIDBOTH + plot_MOVECURSORREL, x, y)
  3265. #define GFX_PlotPoint(x, y) GFX_Plot(plot_POINT + plot_DRAWABSFORE, x, y)
  3266. #define GFX_PlotPointBy(x, y) GFX_Plot(plot_POINT + plot_DRAWRELFORE, x, y)
  3267. #define GFX_Draw(x, y) GFX_Plot(plot_SOLIDBOTH + plot_DRAWABSFORE, x, y)
  3268. #define GFX_DrawBy(x, y) GFX_Plot(plot_SOLIDBOTH + plot_DRAWRELFORE, x, y)
  3269.  
  3270. defined in <GFX>GFX_Plot
  3271. extern void GFX_Plot(int plotcode, int x, int y);
  3272.  
  3273. Executes one OS Plot command.
  3274. plotcode is the <Plot code=>GFX_PlotCodes>
  3275. x and y are the X and Y screen coordinates to use
  3276.  
  3277. See also: <SWI OS_Plot=>SWI.OS_Plot>
  3278.  
  3279. defined in <GFX>Plot codes for GFX_Plot
  3280. #Table 12 28
  3281. plot_SOLIDBOTH       0x00
  3282. plot_SOLIDEXFINAL    0x08
  3283. plot_DOTTEDBOTH      0x10
  3284. plot_DOTTEDEXFINAL   0x18
  3285. plot_SOLIDEXINIT     0x20
  3286. plot_SOLIDEXBOTH     0x28
  3287. plot_DOTTEDEXINIT    0x30
  3288. plot_DOTTEDEXBOTH    0x38
  3289. plot_POINT           0x40
  3290. plot_HHORZLINEFILLNB 0x48
  3291. plot_TRIANGLEFILL    0x50
  3292. plot_HORIZLINEFILLB  0x58
  3293. plot_RECTANGLEFILL   0x60
  3294. plot_HORIZLINEFILLF  0x68
  3295. plot_PARALLELFILL    0x70
  3296. plot_HORIZLINEFILLNF 0x78
  3297. plot_FLOODTOBACK     0x80
  3298. plot_FLOODTOFORE     0x88
  3299. plot_CIRCLE          0x90
  3300. plot_CIRCLEFILL      0x98
  3301. plot_CIRCLEARC       0xA0
  3302. plot_SEGMENT         0xA8
  3303. plot_SECTOR          0xB0
  3304. plot_BLOCK           0xB8
  3305. plot_ELLIPSE         0xC0
  3306. plot_ELLIPSEFILL     0xC8
  3307. plot_GRAPHICSCHAR    0xD0
  3308. plot_SPRITE          0xE8
  3309. #EndTable
  3310.  
  3311. Within each block of eight the offset from the base number means:
  3312. #Table 3 28
  3313. plot_MOVECURSORREL   0
  3314. plot_DRAWRELFORE     1
  3315. plot_DRAWRELINVERSE  2
  3316. plot_DRAWRELBACK     3
  3317. plot_MOVECURSORABS   4
  3318. plot_DRAWABSFORE     5
  3319. plot_DRAWABSINVERSE  6
  3320. plot_DRAWABSBACK     7
  3321. #EndTable
  3322.  
  3323. The above applies except for plot_BLOCK where the codes are as follows:
  3324. #Table 3 28
  3325. plot_BMOVEREL        0
  3326. plot_BMOVERECTREL    1
  3327. plot_BCOPYRECTREL    2
  3328. plot_BMOVEABS        4
  3329. plot_BMOVERECTABS    5
  3330. plot_BCOPYRECTABS    6
  3331. #EndTable
  3332.  
  3333. defined in <GFX>DragASprite_Start
  3334. extern <os_error> *DragASprite_Start(int flags, void *spritearea, char *name,
  3335.                                    <wimp_rect> *bound, <wimp_rect> *parent);
  3336.  
  3337. defined in <DragASprite>DragASprite_Stop
  3338. extern os_error *DragASprite_Stop(void);
  3339.  
  3340. defined in <DragASprite>DragASprite_DragIcon
  3341. extern <os_error> *DragASprite_DragIcon(<window_handle> window, <icon_handle> icon);
  3342.  
  3343. This is a simple interface for DragASpr. Simply call it when you want
  3344. to start a drag operation of a sprite icon, and it starts a dragasprite
  3345. drag IF POSSIBLE, or a normal Wimp_DragBox if not (i.e. this is a
  3346. RISC OS 2 compatible call)
  3347.  
  3348. defined in <DragASprite>Icon_BarIcon
  3349. extern <icon_handle> Icon_BarIcon(char *spritename, <window_handle> pos);
  3350.  
  3351. This function places an icon on the iconbar. It makes a "normal"
  3352. sprite-only icon, with the "normal" default flags. If you want an
  3353. icon that is not this default, then create it yourself (it isn't hard!)
  3354.  
  3355. If you wish to attach handlers/menus to the baricon, then remember
  3356. it's handle, and pass this to <Event_Claim>...
  3357. (Or wait for release 2 of DeskLib, which should have an Event_BarIcon)
  3358.  
  3359. Pass in "spritename" -  the name of a sprite in the Wimp Sprite pool
  3360. and "pos", which should be iconbar_LEFT or iconbar_RIGHT
  3361. The correct size of the icon will be determined and used
  3362. Returns: The icon handle of the created icon
  3363.  
  3364. defined in <Icon>Icon_GetSelect
  3365. extern BOOL Icon_GetSelect(<window_handle> window, <icon_handle> icon);
  3366.  
  3367. Returns TRUE if the given icon is selected
  3368.  
  3369. defined in <Icon>Icon_GetShade
  3370. extern BOOL Icon_GetShade(<window_handle> window, <icon_handle> icon);
  3371.  
  3372. Returns TRUE if the given icon is shaded
  3373.  
  3374. defined in <Icon>Icon_SetSelect
  3375. extern void Icon_SetSelect(<window_handle> window, <icon_handle> icon, int flag);
  3376.  
  3377. Equivalent in action to <Icon_Select> + <Icon_Deselect>: Pass in a flag to
  3378. set the new selected status of the icon (0 = deselect, 1 = select)
  3379.  
  3380. defined in <Icon>Icon_Select
  3381. extern void Icon_Select(<window_handle> window, <icon_handle> icon);
  3382.  
  3383. If the given icon is currently deselected, it is selected
  3384.  
  3385. defined in <Icon>Icon_Deselect
  3386. extern void Icon_Deselect(<window_handle> window, <icon_handle> icon);
  3387.  
  3388. If the given icon is currently selected, it is deselected
  3389.  
  3390. defined in <Icon>Icon_SetShade
  3391. extern void Icon_SetShade(<window_handle> window, <icon_handle> icon, int flag);
  3392.  
  3393. Equivalent in action to <Icon_Shade> + <Icon_Unshade>: Pass in a flag to
  3394. set the new shaded status of the icon (0 = unshaded, 1 = shaded)
  3395.  
  3396. defined in <Icon>Icon_Shade
  3397. extern void Icon_Shade(<window_handle> window, <icon_handle> icon);
  3398.  
  3399. if the icon is currently unshaded (active) it is shaded (made inactive)
  3400. This includes removing the caret from the icon.
  3401.  
  3402. defined in <Icon>Icon_Unshade
  3403. extern void Icon_Unshade(<window_handle> window, <icon_handle> icon);
  3404.  
  3405. if the icon is currently shaded (inactive) it is unshaded (made active)
  3406.  
  3407. defined in <Icon>Icon_ForceWindowRedraw
  3408. extern void Icon_ForceWindowRedraw(<window_handle> window, <icon_handle> icon);
  3409.  
  3410. Force Redraws the area of WINDOW surrounding the icon, *including*
  3411. the 3-d border (validation string "b\<bordertype\>")
  3412.  
  3413. defined in <Icon>Icon_ForceRedraw
  3414. #define Icon_ForceRedraw(wind, icon) <Wimp_SetIconState>(wind, icon, 0, 0);
  3415.  
  3416. Forces the WIMP to redraw (just) the icon
  3417.  
  3418. defined in <Icon>Icon_SetCaret
  3419. extern void Icon_SetCaret(<window_handle> window, <icon_handle> icon);
  3420.  
  3421. This routine sets the caret within the requested icon. It places the
  3422. caret at the (righthand) end of the text in the icon. If the icon is not
  3423. a text icon, then the function returns quietly
  3424.  
  3425. defined in <Icon>Icon_LoseCaret
  3426. extern void Icon_LoseCaret(<window_handle> window, <icon_handle> icon);
  3427.  
  3428. This routine ensures that the caret is *not* contained within the
  3429. designated icon. Only sets a new position if the icon currently contains
  3430. the caret.
  3431.  
  3432. defined in <Icon>Icon_SetInteger
  3433. extern void Icon_SetInteger(<window_handle> w, <icon_handle> i, int value);
  3434.  
  3435. Sets the given icon's text to hold the number in "value". (and redraws icon)
  3436. If the number is too long (too many digits) it will be truncated to fit.
  3437. If unable to set the text (incorrect icon type), it returns quietly
  3438.  
  3439. defined in <Icon>Icon_SetDouble
  3440. extern void Icon_SetDouble(<window_handle> w, <icon_handle> i,
  3441.                            double value, int decimalplaces);
  3442.  
  3443. Sets the given icon's text to hold the number in "value". (and redraws icon)
  3444. Only the first "decimalplaces" digits after the decimal point are
  3445. printed. If the number is too long (too many digits) it will be truncated
  3446. to fit. This may affect the accuracy or actual value of the number.
  3447. If unable to set the text (incorrect icon type), it returns quietly
  3448.  
  3449. defined in <Icon>Icon_SetText
  3450. extern void Icon_SetText(<window_handle> w, <icon_handle> i, char *text);
  3451.  
  3452. Copies the text string into the icon's indirected string buffer (and redraws)
  3453. If unable to set the text (incorrect icon type), it returns quietly
  3454. If text passed in is a NULL pointer, sets icon text to " "
  3455.  
  3456. defined in <Icon>Icon_printf
  3457. extern void Icon_printf(<window_handle> window, <icon_handle> icon,
  3458.                         char *format, ...);
  3459.  
  3460. Exactly the same as sprintf, but instead of passing in a string into which
  3461. the result is written, you pass in the window+icon identifier of an
  3462. indirected icon. (Anything other than an indirected icon will return
  3463. quietly with NO effect)
  3464. e.g Icon_printf(window, 5, "%d bytes copied", current);
  3465.  
  3466. defined in <Icon>Icon_GetDouble
  3467. extern double Icon_GetDouble(<window_handle> w, <icon_handle> i);
  3468.  
  3469. Gets the given icon's text and returns it in the form of a "double"
  3470. floating-point value. 0 will be returned from any error/invalid text
  3471.  
  3472. defined in <Icon>Icon_GetInteger
  3473. extern int Icon_GetInteger(<window_handle> w, <icon_handle> i);
  3474.  
  3475. Gets the given icon's text and returns it in the form of an integer
  3476. numeric value. 0 will be returned from any error/invalid text
  3477.  
  3478. defined in <Icon>Icon_GetText
  3479. extern void Icon_GetText(<window_handle> w, <icon_handle> i, char *text);
  3480.  
  3481. Copies the text string from the icon (sprite name, text, or indirected)
  3482. into the array pointed to by "text"
  3483.  
  3484. defined in <Icon>Icon_SetRadios
  3485. extern void Icon_SetRadios(<window_handle> window,
  3486.                            <icon_handle> first, <icon_handle> last,
  3487.                            <icon_handle> onradio);
  3488.  
  3489. Pass in a group of icons (specified by lowest-numbered icon and
  3490. highest-numbered icon), and the icon from this group that you want
  3491. selected. All icons except the one you want selected will be deselected.
  3492.  
  3493. defined in <Icon>Icon_WhichRadio
  3494. extern int Icon_WhichRadio(<window_handle> window,
  3495.                            <icon_handle> first, <icon_handle> last);
  3496.  
  3497. This function accepts parameters for the first (lowest numbered) and
  3498. last (highest numnbered) in a group of icons (generally a group of radio
  3499. buttons). It returns the icon number of the first icon it finds within
  3500. this range which is selected (or "last" if none are selected).
  3501. Use it to find which of a group of radios is selected.
  3502.  
  3503. defined in <Icon>Icon_ClickWait
  3504. extern void Icon_ClickWait(int waittime);
  3505.  
  3506. Waits for the given number of centiseconds.
  3507. This is a MULTITASKING wait - although your program will do nothing,
  3508. the rest of the desktop will continue to run.
  3509. The wait is aborted after the given time, or as soon as an event is
  3510. received. If an attempt is made to re-enter ClickWait(), it will return
  3511. immediately (i.e. if a click event causes ClickWait to ba called, then
  3512. a second click while "waiting" from the first click will have no effect.
  3513.  
  3514. defined in <Icon>Icon_StartDrag
  3515. extern void Icon_StartDrag(<window_handle> window, <icon_handle> icon);
  3516.  
  3517. Starts a drag operation based on the given icon.
  3518. This is mainly used in "save as" windows to start drags of the file icon
  3519. when it is clicked on, but may be useful elsewhere.
  3520.  
  3521. This call DOES NOT use DragASprite
  3522.  
  3523. defined in <Icon>Icon_StartSolidDrag
  3524. extern void Icon_StartSolidDrag(<window_handle> window, <icon_handle> icon);
  3525.  
  3526. Starts a drag operation based on the given icon, using DragASprite if available
  3527.  
  3528. defined in <Icon>Icon_DisposeIndData
  3529. extern void Icon_DisposeIndData(<icon_data> *data, <icon_flags> flags);
  3530.  
  3531. This will free any indirected data for this icon. It uses free(), so
  3532. obviously expects that malloc() was used to get the memory in the first
  3533. place, so make sure this is the case if you use this function.
  3534.  
  3535. defined in <Icon>Icon_SetSlider
  3536. extern int Icon_SetSlider(<window_handle> window,
  3537.                           <icon_handle> baseicon, <icon_handle> slidericon,
  3538.                           int sliderpos);
  3539.  
  3540. Sets a slider icon-pair to the specified position (specify as a
  3541. percentage). Values \< 0 and > 1000 are clipped, and the value to which the
  3542. slider has been set is returned.
  3543.  
  3544. defined in <Icon>Icon_UpdateSlider
  3545. extern int Icon_UpdateSlider(<window_handle> window,
  3546.                              <icon_handle> baseicon, <icon_handle> slidericon,
  3547.                              int lastpos);
  3548.  
  3549. (call on null events while slider being dragged)
  3550. Calculates a new slider percentage from the mouse pointer position.
  3551. If this differs from lastpos, the slider is updated (by recreating the
  3552. slidericon to the new length.
  3553. returns the new slider position percentage value.
  3554. NOTE: Slider update is achieved by DELETING and re-creating the slider
  3555. icon. This relies upon no icons of a lower icon handle having been deleted!
  3556.  
  3557. defined in <Icon>Icon_DragSlider
  3558. extern int Icon_DragSlider(<window_handle> window,
  3559.                            <icon_handle> baseicon, <icon_handle> slidericon);
  3560.  
  3561. Initiates the drag operation on a slider. Call this when you get a click
  3562. in either baseicon or slidericon.
  3563. Returns the new percentage represented by the slider (remember this so
  3564. you can pass it in to Icon_UpdateSlider to save unnecessary (flickery)
  3565. update.)
  3566. NOTE: It is up to you to turn on Null events and remember that
  3567. <Icon_UpdateSlider> must be called on each poll...
  3568. An alternative is to make the 2 slider icons use button type ALWAYS, and
  3569. check the mouse button state yourself to see whether a drag needs to be
  3570. started/continued...
  3571.  
  3572. defined in <Icon>Icon_ReadSlider
  3573. extern int Icon_ReadSlider(<window_handle> window,
  3574.                            <icon_handle> baseicon, <icon_handle> slidericon);
  3575.  
  3576. Given a slider icon-pair, returns a percentage representing the state
  3577.  
  3578. defined in <Icon>Notes on the use of Event_ functions
  3579. Event supplies a set of high-level functions for proper handling of WIMP
  3580. events.
  3581. It polls the WIMP for you, and then passes the resulting event to one of
  3582. your designated handler routines. Events are cascaded down through your
  3583. handlers until one of them returns TRUE, indicating that the event has
  3584. been successfully dealt with. This allows you to have application-wide
  3585. defaults for certain event types, with occasional overrides of that
  3586. default for specific windows or icons.
  3587.  
  3588. Handlers can be registered for the following (priority-ordered) things:
  3589.  
  3590.   Specific window, specific icon, specific event.
  3591.   Specific window, specific icon, any event.
  3592.   Specific window, any icon, specific event.
  3593.   Specific window, any icon, any event.
  3594.   Any window, specific event.
  3595.   Any window, any event.
  3596.  
  3597. When an non window-related event occurs, the order is as follows:
  3598.  
  3599.   Any window, specific event.
  3600.   Any window, any event.
  3601.  
  3602. A set of default handlers is also provided (handlers.c): You can copy
  3603. the code for the handlers you need into your own program as a base event
  3604. handling system.
  3605.  
  3606. Any event which has no registered handlers will automatically be masked
  3607. out in subsequent Wimp_Polls. (Except for "Quit" messages)
  3608.  
  3609. NULL events are treated (slightly) specially compared to other events.
  3610. After registering handler(s) for NULL events they will be turned on.
  3611. (They will NOT be turned on if you request a handler for ALL events. To
  3612. enable NULL events, you must specifically register a handler for
  3613. event_NULL events.)
  3614. As a default, Wimp_Poll will be used, but functions are supplied for
  3615. you to set a minimum return time (as in Wimp_PollIdle) if NULL events
  3616. are wanted less frequently 
  3617. TWO options for NULL event handling are open to you:
  3618.   Each NULL event is passed to ALL registered handlers,
  3619.     (To allow you to do important things as often as possible)
  3620.   Each handler gets one NULL event in turn, in a round-robin fashion.
  3621.     (To allow you to multitask several "subtask" functions alongside
  3622.      each other with ease)Notes on the use of Menu_ functions:
  3623. These are simple menu create and show functions along very
  3624. similar lines to RISC OS Lib's 'menu' functions. However, there
  3625. are major differences -
  3626.  + menu items are ALWAYS indexed starting from 0.
  3627.  + menu pointers point to real Wimp menu structures, no
  3628.    messing about
  3629.  + <Menu_Show> is provided to show the menus for you, including
  3630.    placing a menu in the correct position over the icon bar.Time_Monotonic
  3631. extern int Time_Monotonic(void);
  3632.  
  3633. Veneer for the OS_ReadMonotonicTime SWI
  3634. Returns an integer representing the time since the computer was switched
  3635. on, in centiseconds.
  3636. Used with Wimp_PollIdle to poll every now and then, as in:
  3637.   time = Time_Monotonic();
  3638.   <Wimp_PollIdle>(mask, block, time + 100);  /* Pollidle for 1 sec (100cs) */
  3639.  
  3640. Can also be used to time things, i.e.
  3641.   time = Time_Monotonic();
  3642.   while (Time_Monotonic \< time+100) /* wait */ ;    /* Wait for 1 second */
  3643.  
  3644. defined in <Time>Notes on Wimp_Poll handling:
  3645. DeskLib 2.04:
  3646. WimpSWIs.s.Poll has been updated to handle passing a WIMP pollword
  3647. under RISC OS 3. The new Poll functions have been named <Wimp_Poll3>
  3648. and <PollIdle3> so that you can't accidentally link with the new
  3649. forms of the functions.
  3650.  
  3651. <Wimp_Poll> and <Wimp_PollIdle> are now macros that map Poll calls
  3652. onto the new <Wimp_Poll3> functions (passing a zero for the pollword).
  3653. So long as you only try to use pollwords under RISC OS 3 onwards,
  3654. you should be fine!
  3655.  
  3656. If you wish to specifically use the pollword, then call the Poll3
  3657. functions directly, using the new parameter.SWI
  3658. <os_error> *SWI(int numregsin, int numregsout, int swicode, ... );
  3659.  
  3660. This function provides a general-purpose SWI call veneer.
  3661. It is not meant to be the most efficient SWI caller, but the most
  3662. general one. If you require faster SWI handling than this function
  3663. provides, then you will need to construct an assembler veneer for the SWI
  3664. (see <WimpSWIs> library source for examples)
  3665.  
  3666. Call it specifying the number of arguments you are passing in,
  3667.                    the number of arguments you want passed back,
  3668.                    the SWI number to call (X or normal),
  3669.                    and a list of parameters...
  3670. Parameters:
  3671.   The SWI list in should be a list of integers, exactly the number
  3672.   specified as "numregsin". These will be passed to the SWI as registers
  3673.   0, 1, 2, ... A maximum of 6 such registers can be specified.
  3674.  
  3675.   The SWI list out should be a list of pointers to result variables
  3676.   they will be assigned the register results from the SWI, in order.
  3677.   Pass in a NULL pointer for any of these if the result is to be ignored
  3678.  
  3679. <Examples=>SWI_Example>
  3680.  
  3681. When you want to use the SWI names, you have to #define your own
  3682. macros for them.
  3683.  
  3684. -- See <Hourglass>.h for examples of how to make low-level SWI calls
  3685.    look nice in your calling code without the extra expense of another
  3686.    function call.
  3687.  
  3688. defined in <SWI>.hExamples of the SWI function:
  3689. SWI(0, 0, SWI_Hourglass_On);
  3690. SWI(1, 0, SWI_Hourglass_Percentage, 33);
  3691. SWI(0, 0, SWI_XHourglass_Smash);
  3692.  
  3693. { int ramsprites, romsprites;
  3694.   /* Read rom sprite and ram sprite pool base addresses: */
  3695.   SWI(0, 2, SWI_Wimp_BaseOfSprites, &romsprites, &ramsprites)
  3696.  
  3697.   /* Read ram sprite base ONLY */
  3698.   SWI(0, 2, SWI_Wimp_BaseOfSprites, NULL, &ramsprites)
  3699. }Error_ReportInternal
  3700. extern void Error_ReportInternal(int errornum, char *report, ...);
  3701.  
  3702. This is identical to <Error_Report>, except it is used for most DeskLib
  3703. library internal errors. User code should use <Error_Report>. This allows
  3704. you to modify the treatment of internal errors, without affecting your
  3705. own error handling.
  3706.  
  3707. defined in <Error>Error_ReportFatalInternal
  3708. extern void Error_ReportFatalInternal(int errornum, char *report, ...);
  3709.  
  3710. This does an <Error_ReportInternal>, and then calls exit()
  3711.  
  3712. defined in <Error>Error_Report
  3713. extern void Error_Report(int errornum, char *report, ...);
  3714.  
  3715. This is a centralised user-error reporting function.
  3716. Call it, citing any error number you want, and any error string you want.
  3717. The current implementation merely invokes Wimp_ReportError, but use it
  3718. from your code, as then the method by which you report errors can be
  3719. altered just by changing Error.c
  3720.  
  3721. The report is a 'printf' style formatting string, optionally followed
  3722. by arguments just as in printf commands. This saves you from having to
  3723. pre-assemble strings to pass in.
  3724. examples:
  3725.   Error_Report(5, "My VIDC just blew up!");
  3726.   Error_Report(6, "You can't put the number %d in there!", thenumber);
  3727.  
  3728. defined in <Error>Error_ReportFatal
  3729. extern void Error_ReportFatal(int errornum, char *report, ...);
  3730.  
  3731. Exactly the same as <Error_Report>, except after reporting the error, it
  3732. terminates the program by calling exit()
  3733.  
  3734. Takes variable arguments a la 'printf'. See <Error_Report> for more info.
  3735.  
  3736. defined in <Error>Error_Check
  3737. extern BOOL Error_Check(<os_error> *error);
  3738.  
  3739. Used to encapsulate an OS call to automatically check for error return.
  3740. If the OS call returns an error, then it will be reported, and the
  3741. function returns TRUE.
  3742. Otherwise, no action is taken, and FALSE is returned
  3743.  
  3744. defined in <Error>Error_CheckFatal
  3745. extern void Error_CheckFatal(<os_error> *error);
  3746.  
  3747. Identical to <Error_Check>, but calls exit() if an error ocurred
  3748.  
  3749. defined in <Error>Error_OutOfMemory
  3750. extern BOOL Error_OutOfMemory(BOOL fatal, char *place);
  3751.  
  3752. Reports a memory error (e.g. "Unable to claim enough memory for
  3753. [Messages]"), where you supply just the "place" of the failure
  3754. (e.g. in this case, in the "Messages" section)
  3755. if "fatal" is TRUE, <Error_ReportFatal> is used, else <Error_Report>
  3756. is used.
  3757.  
  3758. This function ALWAYS returns FALSE (== 0 == NULL), so you can use:
  3759.   if (spritearea == NULL)
  3760.     return(Error_OutOfMemory(FALSE, "icon sprites"));
  3761.  
  3762. defined in <Error>Mem_Size
  3763. extern int Mem_Size(<mem_anchor> *anchor);
  3764.  
  3765. Returns the current size (in bytes) of a mem chunk
  3766.  
  3767. defined in <Mem>Mem_Compact
  3768. extern void Mem_Compact(void);
  3769.  
  3770. This call compacts the mem heap, moving all free space to the end of
  3771. the chunk, and giving back as much memory as possible to the Wimp.
  3772. This may result in some mem chunks moving, so you cannot rely on
  3773. anchors remaining the same across this call.
  3774. Ideally, you should call this just before calling Wimp_Poll, to
  3775. ensure the Wimp has all possible available memory (and also keep the
  3776. heap tidy)
  3777. Note that this may be automatically called by other Mem_ functions
  3778. IF <mem_autocompact> allows it. However, it will NEVER be called if
  3779. <mem_autocompact> == mem_NOCOMPACT
  3780.  
  3781. defined in <Mem>Mem_Free
  3782. extern void Mem_Free(<mem_anchor> *anchor);
  3783.  
  3784. Releases a chunk of memory back to the free pool
  3785. The contents of the anchor will be set to NULL to indicate it is no
  3786. longer a valid pointer.
  3787. If permitted to by the contents of <mem_autocompact>, this call MAY
  3788. relocate other mem chunks.
  3789.  
  3790. defined in <Mem>Mem_MoveAnchor
  3791. extern void Mem_MoveAnchor(<mem_anchor> *from, <mem_anchor> *to);
  3792.  
  3793. Allows you to move an anchor from one variable to another.
  3794. This allows you to allocate a chunk with a temporary anchor and then
  3795. move the anchor into permanent storage at a later time (without having
  3796. to allocate a new chunk and copy, as is necessary under flex)
  3797.  
  3798. Use with care - i.e. remember to check anchors to see if they are NULL
  3799. (in which case you're using the wrong anchor!)
  3800.  
  3801. If all goes well (i.e. 'from' was a valid chunk), *from will be set
  3802. to NULL and *to will now point at the chunk. From this point on,
  3803. the anchor 'to' will be adjusted whenever the chunk is moved.
  3804.  
  3805. Otherwise, from is left as it was, and to will be set to NULL
  3806.  
  3807. <Example=>Mem_MoveAnchEx>
  3808.  
  3809. defined in <Mem>Example use of Mem_MoveAnchor:
  3810. {
  3811.   char *old, *new;
  3812.   <Mem_Alloc>((<mem_anchor> *) &old, 1024);   /* Get some memory */
  3813.   if (old != NULL)
  3814.   {
  3815.     old[5] = 'a';
  3816.     Mem_MoveAnchor((<mem_anchor> *) &old, (<mem_anchor> *) &new);
  3817.         /* if 'old' was valid, 'new' now points to where old was, */
  3818.         /* and old is now NULL                                    */
  3819.  
  3820.     if (new == NULL)    printf("Error - old was invalid! \n");
  3821.     if (new[5] != 'a')  printf("Error - Jason's code is buggy! \n");
  3822.   }
  3823.   :
  3824. }Mem_MidExtend
  3825. extern BOOL Mem_MidExtend(<mem_anchor> *anchor, int at, int by);
  3826.  
  3827. Attempts to alter the size of a mem chunk.
  3828. "at" is a byte-offset within the data chunk
  3829. "by" is the number of bytes to extend by (negative to reduce the chunk)
  3830. If "by" is positive,
  3831.   'by' bytes of indeterminate value will be inserted at 'at', shifting
  3832.   the rest of the data up to make room
  3833. else
  3834.   'by' bytes of data BELOW 'at' will be deleted by moving the data
  3835.   from 'at' onwards down by 'by' bytes.
  3836.  
  3837. Returns TRUE if the extension was successful.
  3838. The allocated memory starts at a word-aligned address
  3839.  
  3840. If permitted to by the setting of <mem_autocompact>, this call MAY
  3841. relocate other mem chunks.
  3842.  
  3843. defined in <Mem>Mem_Alloc
  3844. extern BOOL Mem_Alloc(<mem_anchor> *anchor, int numbytes);
  3845.  
  3846. Attempts to allocate the given amount of memory (in bytes) in the mem
  3847. heap. Updates the anchor you pass in to point to this block, or
  3848. to contain NULL if it is unable to allocate the requested memory.
  3849. The returned block of memory starts at a word-aligned address
  3850. Returns TRUE if it succeeded
  3851.  
  3852. If permitted to by the setting of <mem_autocompact>, this call MAY
  3853. relocate other mem chunks.
  3854.  
  3855. defined in <Mem>Mem_Initialise
  3856. extern BOOL Mem_Initialise(void);
  3857.  
  3858. Initialises the Mem system ready for use.
  3859. Note that this locks down the malloc and stack memory area to the
  3860. current WimpSlot size at the point of calling, and builds a mem
  3861. heap above this. Malloc and stack allocation will not be able to get
  3862. more memory than is originally available in your WimpSlot, so get it
  3863. right!
  3864. Note that Mem_Initialise() provides a function to
  3865. _kernel_register-slotextend() to stop the SharedCLib being able to
  3866. overwrite the Mem heap with the stack/malloc chunks.
  3867.  
  3868. defined in <Mem>Type: mem_compaction
  3869. typedef enum
  3870. {
  3871.   mem_NOCOMPACT   = 0,  /* ONLY compacts if <Mem_Compact> called  */
  3872.   mem_FASTCOMPACT = 1,  /* Compacts only if necessary           */
  3873.   mem_PARTCOMPACT = 1,
  3874.   mem_FULLCOMPACT = 2   /* Compacts on every heap change        */
  3875. } mem_compaction;
  3876.  
  3877. defined in <Mem>Type: mem_anchor
  3878. typedef void *mem_anchor;
  3879.  
  3880. defined in <Mem>Compaction control
  3881. <mem_compaction> mem_autocompact
  3882.  
  3883. Apart from compacting when you call <Mem_Compact>(), Mem will also
  3884. compact at the following times, depending on the value of mem_autocompact
  3885.  
  3886.   mem_NOCOMPACT:    Auto compaction never occurs. This may be useful if
  3887.                     you wish to guarantee that chunks ONLY move when you
  3888.                     call <Mem_Compact>().
  3889.  
  3890.   mem_PARTCOMPACT:  Auto compaction occurs whenever compaction might make
  3891.                     an otherwise impossible memory claim possible. This is
  3892.                     the recommended (and default) setting.
  3893.  
  3894.   mem_FULLCOMPACT:  Auto compaction occurs every time a chunk is freed
  3895.                     (the way that RISC OS Lib flex() operates)
  3896.                     This is not reccommended, as it can be very inefficient
  3897.  
  3898. NOTE that the value of mem_autocompact may be changed at any time
  3899. and will take immediate effect. Therefore, if you wish to ensure that
  3900. pointers into mem chunks remain 'safe' for a short period of time, you
  3901. can set mem_autocompact = mem_NOCOMPACT while procssing, and return
  3902. it to its former value when finished.
  3903.  
  3904. defined in <Mem>Notes on the Mem library
  3905. Mem memory chunks are held in a 'heap' of memory above the area grabbed
  3906. by the SharedCLibrary for mallocs and stackspace, extending up to the
  3907. end of the WimpSlot, which is adjusted up & down as necessary.
  3908.  
  3909. The major feature that externally distinguishes Mem from flex() is that
  3910. the heap is NOT compacted automatically (flex keeps the entire heap
  3911. compacted at all times). This has several advantages:
  3912.   - You can rely on pointers remaining constant at all times between
  3913.     calls to <Mem_Compact>() (and other Mem_ calls if you allow it)
  3914.   - everything is a lot faster if you are allocating and/or
  3915.     deallocating many chunks in one go.
  3916.  
  3917. The idea behind this is that you simply call <Mem_Compact> before
  3918. calling Wimp_Poll - this returns free memory to the Wimp as effectively
  3919. as the flex system did, but saves us from having to waste time on
  3920. multiple compactions between Wimp_Polls.
  3921.  
  3922. Automatic compaction (a la flex) can be turned on (or off) at any time
  3923. so the Mem system can be made to emulate flex_ if you really want it.
  3924. To do this, set <mem_autocompact>.
  3925. NOTE that by default, mem will only autocompact if it has no choice,
  3926. but *may* autocompact during any Mem_ call.strcpycr == strcpy
  3927. Copies s2 into s1. Returns s1.
  3928. The returned string will be zero terminated.
  3929.  
  3930. extern char *strcpycr(char *s1, char *s2);
  3931.  
  3932. defined in <StringCR>strcatcr == strcat
  3933. extern char *strcatcr(char *s1, char *s2);
  3934.  
  3935. Concatenates s2 onto the end of s1. Returns s1.
  3936. The returned string will be zero terminated.
  3937.  
  3938. defined in <StringCR>strcmpcr == strcmp
  3939. extern int strcmpcr(char *s1, char *s2);
  3940.  
  3941. Returns 0 if the strings match
  3942. Returns -1 if s1 \< s2  (alphabetically less than, and/or shorter)
  3943. Returns +1 if s1 \> s2  (alphabetcally greater than, and/or longer)
  3944.  
  3945. defined in <StringCR>strlencr == strlen
  3946. extern int strlencr(char *s);
  3947.  
  3948. NOTE **** With release 2 of DeskLib this has been changed to return
  3949. the length of the string EXCLUDING the terminator (i.e. it now returns
  3950. 1 less than it used to in Desklib 1)
  3951.  
  3952. defined in <StringCR>Var: file_lasterror
  3953. extern <os_error> *file_lasterror;
  3954.  
  3955. file_lasterror is used to provide a more convenient SWI veneer for certain
  3956. file operations (Open, reading, etc, return handles/values directly,
  3957. rather than you having to provide the address of a variable for the
  3958. returned value, leaving no convenient way of returning errors!)
  3959.  
  3960. Thus, file_lasterror is set by the file operations:
  3961. #Table 3 20
  3962. <Open>
  3963. <Close>
  3964. <EOF>
  3965. <Read8/32/Bytes>
  3966. <Write8/32/Bytes>
  3967. <Seek>
  3968. <ReturnPos>
  3969. #EndTable
  3970.  
  3971. However, note that it is just a pointer to the error returned by the SWI
  3972. call, so it MUST be used immediately after the call, or else it may be
  3973. invalid or possibly even dangerously corrupted.
  3974. If for example, you wish to close the file before reporting the error,
  3975. you must first copy the error into your own <os_error> block.
  3976.  
  3977. If no error occurred on the last file op, file_lasterror will be NULL.
  3978. Most of the above functions also return values (filehandle = NULL etc)
  3979. that will indicate when an error may have occurred, at which time you
  3980. can interrogate file_lasterror to work out what the error was.
  3981.  
  3982. Note also that all of the above calls which do not have a specific
  3983. return value (Close, Write*, Seek) return the <os_error> pointer directly
  3984. as well as setting file_lasterror, for convenience.
  3985.  
  3986. defined in <File>File_Delete
  3987. extern <os_error> *File_Delete(char *filename);
  3988.  
  3989. Attempts to delete the named file. Use carefully!
  3990.  
  3991. defined in <File>File_Size
  3992. extern int File_Size(char *filename);
  3993.  
  3994. Reads the size (in bytes) of the file. A return value of 0 indicates
  3995. either the file is 0 bytes long, or an error occurred (which usually
  3996. means that the file doesn't exist)
  3997.  
  3998. defined in <File>File_Exists
  3999. extern BOOL File_Exists(char *filename);
  4000.  
  4001. This returns TRUE if the file exists.
  4002. (It attempts to open the file for reading - it returns TRUE if successful)
  4003.  
  4004. defined in <File>File_Open
  4005. extern <file_handle> File_Open(char *filename, <file_access> access);
  4006.  
  4007. Opens the given file for reading or writing (see file_access's above)
  4008. Returns the file handle, or NULL if it failed
  4009. (if NULL, you can check <file_lasterror> for the reason)
  4010.  
  4011. NOTE that the OS will return a NULL file handle if we try to open a
  4012. non existent file, but does NOT flag this as an error (i.e. File_Open
  4013. returns NULL, but file_lasterror is ALSO NULL). You must therefore
  4014. check <file_lasterror> before blindly trying to use it to report an error.
  4015.  
  4016. defined in <File>Type: file_access
  4017. typedef enum
  4018. {
  4019.   file_READ   = 0x40,   /* Open the file for reading                 */
  4020.   file_WRITE  = 0x80,   /* CREATE/WIPE the file, open it for writing */
  4021.   file_APPEND = 0xC0    /* Open for appending to existing file. NOTE
  4022.                          * that I don't have the PRMs so I can't tell
  4023.                          * you where this puts the initial file pointer
  4024.                          */
  4025. } file_access;
  4026.  
  4027. These values are used when opening files. NOTE that they correspond
  4028. directly to OS_File opening flags (OS_File R0 entry value)
  4029.  
  4030. defined in <File>File_Close
  4031. extern <os_error> *File_Close(<file_handle> handle);
  4032.  
  4033. Closes an open file stream, using the handle returned by <File_Open>
  4034. After a close, the file_handle is no longer valid, so do not try
  4035. to use it.
  4036.  
  4037. defined in <File>Type: file_handle
  4038. typedef int file_handle;
  4039.  
  4040. Specifies an open file for the File_* functions
  4041.  
  4042. defined in <File>File_EOF
  4043. extern BOOL File_EOF(<file_handle> handle);
  4044.  
  4045. Returns TRUE if the end of the file has been reached
  4046.  
  4047. defined in <File>File_Seek
  4048. extern <os_error> *File_Seek(<file_handle> handle, <file_position> position);
  4049.  
  4050. Seeks the file pointer to the given position (an offset in terms of
  4051. bytes offset from the start of the file). Subsequent read/write
  4052. operations will read from or write to that part of the file.
  4053.  
  4054. See also <File_ReturnPos>
  4055.  
  4056. defined in <File>Type: file_position
  4057. typedef int file_position;
  4058.  
  4059. defined in <File>File_ReturnPos
  4060. extern <file_position> File_ReturnPos(<file_handle> handle);
  4061.  
  4062. Returns the current file pointer position.
  4063. This is a value which, when passed to <File_Seek>, will return you
  4064. to the same position you were at when you called File_ReturnPos
  4065.  
  4066. defined in <File>File_WriteBytes
  4067. extern <os_error> *File_WriteBytes(<file_handle> handle,
  4068.                                  void *buffer, int numbytes);
  4069.  
  4070. This writes a chunk of data to the current position in a file opened
  4071. for writing. 'numbytes' bytes will be written from the given buffer.
  4072. It is important to check for errors from this call as Disc Full errors
  4073. are a common occurrence.
  4074.  
  4075. defined in <File>File_ReadBytes
  4076. extern int File_ReadBytes(<file_handle> handle, void *buffer, int numbytes);
  4077.  
  4078. Reads the given number of bytes of data from the given file, into the
  4079. given buffer. Returns the number of bytes NOT successfully read.
  4080. (i.e. if you hit EOF during the read, the return value will be non-zero)
  4081.  
  4082. defined in <File>File_Write8
  4083. extern <os_error> *File_Write8(<file_handle> handle, int byte);
  4084.  
  4085. Writes an 8-bit value (a byte/char) to the given output file.
  4086.  
  4087. defined in <File>File_WriteByte
  4088. #define File_WriteByte <File_Write8>
  4089.  
  4090. defined in <File>File_WriteChar
  4091. #define File_WriteChar <File_Write8>
  4092.  
  4093. defined in <File>File_Read8
  4094. extern int File_Read8(file_handle handle);
  4095.  
  4096. Reads an 8-bit value (a byte/char) from the given input file.
  4097. If an error (typically EOF) occurs during the read, <file_READERROR>
  4098. will be returned.
  4099.  
  4100. VERY IMPORTANT NOTE!
  4101. DO NOT use File_Read8() in a line like the following:
  4102.   shortvalue = File_Read8(infile) | (File_Read8(infile) \<\< 8);
  4103.  
  4104. The problem here is that the C compiler is allowed to evaluate the 2
  4105. functions in any order it sees fit, so may read the two bytes in the
  4106. incorrect order. You MUST therefore do such an operation with code
  4107. in the following form if you are to sure it will work:
  4108.   shortvalue = File_Read8(infile);
  4109.   shortvalue |= File_Read8(infile) \<\< 8;  
  4110.  
  4111. defined in <File>File_ReadByte
  4112. #define File_ReadByte <File_Read8>
  4113.  
  4114. defined in <File>File_ReadChar
  4115. #define File_ReadChar <File_Read8>
  4116.  
  4117. defined in <File>File_Write32
  4118. extern <os_error> *File_Write32(<file_handle> handle, int word);
  4119.  
  4120. Writes an 32-bit value (a word/int/long) to the given output file.
  4121.  
  4122. defined in <File>File_WriteWord
  4123. #define File_WriteWord <File_Write32>
  4124.  
  4125. defined in <File>File_WriteInt
  4126. #define File_WriteInt <File_Write32>
  4127.  
  4128. defined in <File>File_WriteLong
  4129. #define File_WriteLong <File_Write32>
  4130.  
  4131. defined in <File>File_Read32
  4132. extern int File_Read32(<file_handle> handle);
  4133.  
  4134. Reads a 32-bit value (a word/int/long) from the given input file.
  4135. If an error (typically EOF) occurs during the read, <file_READERROR>
  4136. will be returned. (Note that this is a perfectly legal value to read
  4137. from the file, though, so you should check file_lasterror to see if
  4138. an error occurred).
  4139.  
  4140. defined in <File>File_Read32R
  4141. extern int File_Read32R(<file_handle> handle);
  4142.  
  4143. Identical to <File_Read32>, but reverses the byte ordering as it reads
  4144. (converts from little endian to big endian format). This is very useful
  4145. for reading textual tags from files, as they can then be compared to
  4146. integer constants of the form 'aTag' rather than having to reverse the
  4147. byte order manually (i.e. using the tag 'gaTa' which is less human
  4148. readable)
  4149.  
  4150. defined in <File>File_Write32R
  4151. extern <os_error> *File_Write32R(<file_handle> handle, int word);
  4152.  
  4153. Same as <File_Write32>, but reverses the byte order before
  4154. writing. See <File_Read32R> for more details about why you'd
  4155. want to do this.
  4156.  
  4157. defined in <File>File_ReadWord
  4158. #define File_ReadWord <File_Read32>
  4159.  
  4160. defined in <File>File_ReadInt
  4161. #define File_ReadInt <File_Read32>
  4162.  
  4163. defined in <File>File_ReadLong
  4164. #define File_ReadLong <File_Read32>
  4165.  
  4166. defined in <File>File_ReadLongR
  4167. #define File_ReadLongR <File_Read32R>
  4168.  
  4169. defined in <File>File_ReadIntR
  4170. #define File_ReadIntR <File_Read32R>
  4171.  
  4172. defined in <File>File_ReadWordR
  4173. #define File_ReadWordR <File_Read32R>
  4174.  
  4175. defined in <File>File_WriteWordR
  4176. #define File_WriteWordR <File_Write32R>
  4177.  
  4178. defined in <File>File_WriteIntR
  4179. #define File_WriteIntR <File_Write32R>
  4180.  
  4181. defined in <File>File_WriteLongR
  4182. #define File_WriteLongR <File_Write32R>
  4183.  
  4184. defined in <File>file_READERROR
  4185. #define file_READERROR (-1)
  4186.  
  4187. Returned by som File_ functions to indicate
  4188. errors, see also <file_lasterror>
  4189.  
  4190. defined in <File>LinkList_NextItem
  4191. extern void *LinkList_NextItem(<linklist_header> *item);
  4192.  
  4193. Return the next item of a given one. If the current item is at
  4194. the tail of the list, a NULL pointer will be returned.
  4195.  
  4196. Old definition:
  4197.   #define LinkList_NextItem(x) ((void *)(x)->next)
  4198.  
  4199. NEW definition:
  4200.   you can now use   LinkList_NextItem(&item);
  4201.   instead of        LinkList_NextItem(&item->header);
  4202.  
  4203. See also <LinkList_PreviousItem>
  4204.  
  4205. defined in <LinkList>LinkList_PreviousItem
  4206. extern void *LinkList_PreviousItem(<linklist_header> *item);
  4207.  
  4208. Return the previous item of a given one. If the current item is
  4209. at the head of the list, a NULL pointer will be returned.
  4210.  
  4211. Old definitions:
  4212.   #define LinkList_PreviousItem(x) ((void *)(x)->previous)
  4213.  
  4214. NEW definition:
  4215.   you can now use   LinkList_PreviousItem(&item);
  4216.   instead of        LinkList_PreviousItem(&item->header);
  4217.  
  4218. See also: <LinkList_NextItem>
  4219.  
  4220. defined in <LinkList>LinkList_InitItem
  4221. extern void LinkList_InitItem(<linklist_header> *item);
  4222.  
  4223. Initialises a list item. Should be called before item used,
  4224. except when that item is immediately linked into a list
  4225.  
  4226. defined in <LinkList>LinkList_Init
  4227. extern void LinkList_Init(<linklist_header> *item);
  4228.  
  4229. Initialises a list anchor. Should be called before anchor used
  4230.  
  4231. defined in <LinkList>LinkList_FirstItem
  4232. extern void *LinkList_FirstItem(<linklist_header> *anchor);
  4233.  
  4234. Return pointers to the first item in the list
  4235.  
  4236. defined in <LinkList>LinkList_LastItem
  4237. extern void *LinkList_LastItem(<linklist_header> *anchor);
  4238.  
  4239. Return pointers to the last item in the list
  4240.  
  4241. defined in <LinkList>LinkList_Unlink
  4242. extern void LinkList_Unlink(<linklist_header> *anchor, <linklist_header> *item);
  4243.  
  4244. Unlinks the item "item" from the given list.
  4245. You must then free the memory used by it yourself.
  4246.  
  4247. defined in <LinkList>LinkList_ListLength
  4248. extern BOOL LinkList_ListLength(<linklist_header> *anchor);
  4249.  
  4250. Returns the number of items in the list. It follows all the links
  4251. and counts them... if you need this value a lot, I suggest you modify
  4252. LinkList to keep a count in the anchor...
  4253.  
  4254. defined in <LinkList>LinkList_InList
  4255. extern BOOL LinkList_InList(<linklist_header> *anchor, <linklist_header> *item);
  4256.  
  4257. Returns TRUE if the item is curently in the list. Note that this does
  4258. NOT check item contents, merely compares item pointers.
  4259. To check item contents, you must chain through the list yourself.
  4260.  
  4261. defined in <LinkList>Type: linklist_header
  4262. typedef struct linklist_header
  4263. {
  4264.   struct linklist_header *next;
  4265.   struct linklist_header *previous;
  4266. } linklist_header ;
  4267.  
  4268. defined in <LinkList>Implementation notes for DeskLib:LinkList.h
  4269. This module provides support for a linked list structure.
  4270. YOU must supply an anchor for the list (a variable of type
  4271. <linklist_header>). This is used to record pointers to the start and end
  4272. of the list.
  4273. The list itself is made up of your own structures, defined as follows:
  4274.   struct listelement
  4275.   {
  4276.     <linklist_header> header;
  4277.     ... Your own data here ...
  4278.   } listelement;
  4279.  
  4280. a list-terminating pointer is represented as NULL
  4281.  
  4282. The header's next field stores a pointer to the FIRST item
  4283.          its previous field stores a pointer to the LAST item
  4284.          (both these pointers will be nulls if the list is empty)
  4285.  
  4286. To insert items into the list, you must malloc memory for one of your
  4287. own listelement data structures, then call the appropriate function.
  4288. To delete an item from the list, call the unlink function, and then free
  4289. all memory used by your structure.LinkList_AddToHead
  4290. extern void LinkList_AddToHead(<linklist_header> *anchor, <linklist_header> *item);
  4291.  
  4292. Insert an item in a linked list to the head of the list.
  4293.  
  4294. defined in <LinkList>LinkList_InsertAfter
  4295. extern void LinkList_InsertAfter(<linklist_header> *anchor,
  4296.                                  <linklist_header> *pos,
  4297.                                  <linklist_header> *item);
  4298.  
  4299. Inserts the given item AFTER the item "pos"
  4300.  
  4301. defined in <LinkList>LinkList_InsertBefore
  4302. extern void LinkList_InsertBefore(<linklist_header> *anchor,
  4303.                                   <linklist_header> *pos,
  4304.                                   <linklist_header> *item);
  4305.  
  4306. Inserts the given item BEFORE the item "pos"
  4307.  
  4308. defined in <LinkList>LinkList_AddToTail
  4309. extern void LinkList_AddToTail(<linklist_header> *anchor, <linklist_header> *item);
  4310.  
  4311. Inserts the given item at the end of the list
  4312.  
  4313. defined in <LinkList>PopUp_ShowStandalone
  4314. <popup_handle> PopUp_ShowStandalone(char *name, <popup_data> *definition);
  4315.  
  4316. This macro simply makes <PopUp_ShowPtr> nicer to use without causing more
  4317. code bulk. It is used to show a standalone-menu.
  4318.  
  4319. defined in <PopUp>PopUp_ShowStatic
  4320. <popup_handle> PopUp_ShowStatic(char *name, <popup_data> *definition);
  4321.  
  4322. This macros simply makes <PopUp_ShowPtr> nicer to use without causing more
  4323. code bulk. It is used to show a static (permanent window) PopUp.
  4324.  
  4325. defined in <PopUp>PopUp_ShowPtr
  4326. extern <popup_handle> PopUp_ShowPtr(char *name, BOOL isstatic,
  4327.                                   <popup_data> *definition);
  4328.  
  4329. Higher level interface to <PopUp_Open,> which will open a STANDALONE MENU
  4330. or STATIC PopUp by filling in the position to open at (over the pointer)
  4331. and other header data for you, and open the PopUp as defined by the
  4332. passed in "<popup_data>" block.
  4333.  
  4334. 'name'       is the PopUp type name (e.g. "FontSelect")
  4335. 'isstatic'   indicates if the PopUp should be a static or menu PopUp.
  4336. 'definition' is the popup-specific description.
  4337.  
  4338. Rather than calling ShowPtr directly, use the macros
  4339. <PopUp_ShowStandalone>
  4340. <PopUp_ShowStatic>
  4341.  
  4342. defined in <PopUp>PopUp_ShowMenuLeaf
  4343. extern <popup_handle> PopUp_ShowMenuLeaf(char *name, <popup_data> *definition,
  4344.                                        <message_menuwarn> *msg);
  4345.  
  4346. Higher level interface to <PopUp_Open>, which will show a MENU-LEAF PopUp
  4347. given the PopUp type name and popup-specific data, plus the "menuwarn"
  4348. message that induced your desire to open the PopUp in the first place.
  4349.  
  4350. 'name'       is the PopUp type name (e.g. "FontSelect")
  4351. 'definition' is the popup-specific description.
  4352.  
  4353. <Hypothetical example of use=>PopUp_ShowMLEx>
  4354.  
  4355. defined in <PopUp>Example of PopUp_ShowMenuLeaf use:
  4356. case message_MENUWARN:
  4357.   switch(event->data.message.data.menuwarn.selection[0])
  4358.   {
  4359.     case 3: /* Save => menu item */
  4360.     {
  4361.       <popup_data> pud;
  4362.  
  4363.       strcpy(pud.saveas.iconsprite, "file_aff");   /* iconsprite name   */
  4364.       strcpy(pud.saveas.filename, "DrawFile");     /* Default file name */
  4365.       <PopUp_ShowMenuLeaf>("SaveAs", &saveas,
  4366.                          &event->data.message.datamenuwarn);PopUp_Close
  4367. extern void PopUp_Close(<popup_handle> handle);
  4368.  
  4369. Straight SWI veneer for PopUp_Close swi.
  4370. This will close any PopUp, given the handle as returned by other
  4371. PopUp calls (<PopUp_Open>, <PopUp_Show>)
  4372. Note that this is only necessary for STATIC PopUps, and that illegal
  4373. calls (popup isn't open, etc) will be ignored.
  4374.  
  4375. defined in <PopUp>PopUp_Open
  4376. extern <popup_handle> PopUp_Open(<popup_block> *params);
  4377.  
  4378. Straight SWI veneer for PopUp_Open swi.
  4379. You shouldn't have to call this function - use:
  4380. #Table 2 25
  4381. <PopUp_ShowMenuLeaf>
  4382. <PopUp_ShowPtr>
  4383. <PopUp_ShowStandalone>
  4384. <PopUp_ShowStatic>
  4385. #EndTable
  4386.  
  4387. defined in <PopUp>Type: popup_block
  4388. typedef struct
  4389. {
  4390.   <popup_header> header;
  4391.   <popup_data>   data;
  4392. } popup_block;
  4393.  
  4394. Block to send to <PopUp_Open>
  4395.  
  4396. defined in <PopUp>Type: popup_header
  4397. typedef struct
  4398. {
  4399.   char       name[12];      /* PopUp type name, eg "SaveAs"          */
  4400.   <wimp_point> openpos;       /* Position (top left) to open window at */
  4401.   char       flags;         /* menuleaf/standalone/static popup?     */
  4402.   char       reserved1, reserved2, reserved3;
  4403. } popup_header;
  4404.  
  4405. defined in <PopUp>Type: popup_data
  4406. typedef union
  4407. {
  4408.   <popup_magnify>    magnify;
  4409.   <popup_proginfo>   proginfo;
  4410.   <popup_report>     report;
  4411.   <popup_saveas>     saveas;
  4412.   <popup_wimpcolour> wimpcolour;
  4413.   <popup_truecolour> truecolour;
  4414. } popup_data;
  4415.  
  4416. Data to send to popup manager
  4417.  
  4418. defined in <PopUp>Type: popup_truecolour
  4419. typedef struct
  4420. {
  4421.   int colourmodel;    /* eg: popuptc_RGB + popuptc_TRANSPARENCY1 */
  4422.   union
  4423.   {
  4424.     <colour_rgb>  rgb;
  4425.     <colour_hsv>  hsv;
  4426.     <colour_cmyk> cmyk;
  4427.   } colour;
  4428.   
  4429.   int transparency;   /* 0..255 */
  4430. } popup_truecolour;
  4431.  
  4432. defined in <PopUp>Type: colour_rgb
  4433. typedef struct
  4434. {
  4435.   unsigned int transparency : 8;
  4436.   unsigned int red          : 8;
  4437.   unsigned int green        : 8;
  4438.   unsigned int blue         : 8;
  4439. } colour_rgb;
  4440.  
  4441. defined in <PopUp>Type: colour_hsv
  4442. typedef struct
  4443. {
  4444.   unsigned int value        : 8;    /* 0..255 */
  4445.   unsigned int saturation   : 8;    /* 0..255 */
  4446.   unsigned int hue          : 16;   /* 0..359 */
  4447. } colour_hsv;
  4448.  
  4449. defined in <PopUp>Type: colour_cmyk
  4450. typedef struct
  4451. {
  4452.   unsigned int key          : 8;
  4453.   unsigned int yellow       : 8;
  4454.   unsigned int magenta      : 8;
  4455.   unsigned int cyan         : 8;
  4456. } colour_cmyk;
  4457.  
  4458. defined in <PopUp>Type: popup_magnify
  4459. typedef struct
  4460. {
  4461.   int mul, div;
  4462.   int minmul, maxmul;
  4463.   int mindiv, maxdiv;
  4464. } popup_magnify;
  4465.  
  4466. defined in <PopUp>Type: popup_proginfo
  4467. typedef struct
  4468. {
  4469.   char appname[32];
  4470.   char purpose[32];
  4471.   char author[32];
  4472.   char version[32];
  4473. } popup_proginfo;
  4474.  
  4475. defined in <PopUp>Type: popup_saveas
  4476. typedef struct
  4477. {
  4478.   char iconsprite[12]; /* Save As file icon's Iconsprite name   */
  4479.   char filename[212];  /* Default text to put into writable icn */
  4480. } popup_saveas;
  4481.  
  4482. NOTE a different block is RETURNED: <popup_saveasreturn>
  4483.  
  4484. defined in <PopUp>Type: popup_saveasreturn
  4485. typedef struct
  4486. {
  4487.   struct
  4488.   {                                /* If TRUE:           | If FALSE:         */
  4489.     unsigned int wasdragged : 1;   /* File was dragged   | OK was 'pressed'  */
  4490.     unsigned int shiftdown  : 1;   /* SHIFT key was down | SHIFT key wasn't  */
  4491.     unsigned int reserved   : 30;
  4492.   } flags;
  4493.  
  4494.   int  reserved;
  4495.   char filename[212];              /* if (wasdragged) this is a leafname,
  4496.                                     * else            this is a full pathname
  4497.                                     */
  4498. } popup_saveasreturn;
  4499.  
  4500. defined in <PopUp>Note on PopUp.h
  4501. The PopUp system requires support of 2 Wimp message numbers. These
  4502. should be integrated into <Wimp>.h so that you can use:
  4503.   event->data.message.popupxxx. ...
  4504.  
  4505. However, to do this requires permanent wiring of the folowing typedefs
  4506. into Wimp.h, which is undesirable if you aren't using PopUps in every
  4507. .c file, as it will have a bad effect on compile time/memory use.
  4508.  
  4509. Thus, I recommend that you simply #include this file as needed, and
  4510. cast the generic message data type from Wimp.h into the specific type
  4511. of the message as necessary, e.g.
  4512.  
  4513. case message_POPUPSTATE:
  4514. {
  4515.   <message_popupstate> *state;
  4516.   state = (<message_popupstate> *) &event->data.message.data;
  4517.   switch (state->handle) ...Type: popup_handle
  4518. typedef int popup_handle;
  4519.  
  4520. defined in <PopUp>Type: message_popupstate
  4521. typedef struct
  4522. {
  4523.   <popup_handle>     handle;     /* PopUp handle                    */
  4524.   char             name[12];   /* PopUp type nam, e.g. "ProgInfo" */
  4525.   <popup_returndata> data;       /* Returned state data             */
  4526. } message_popupstate;
  4527.  
  4528. defined in <PopUp>Type: popup_returndata
  4529. typedef struct
  4530. {
  4531.   <popup_magnify>    magnify;
  4532.   <popup_report>     report;
  4533.   <popup_saveas>     saveasreturn;
  4534.   <popup_wimpcolour> wimpcolour;
  4535.   <popup_truecolour> truecolour;
  4536. } popup_returndata;
  4537.  
  4538. Data recieved in a <message_popupstate>
  4539.  
  4540. defined in <PopUp>To use the ProgInfo PopUp
  4541.  1. Call <EventMsg_Claim>(message_POPUPREQUEST, event_ANY, <OpenPopup=>PopUp_OpenPopup>, NULL)
  4542.     at some point in your initialisation.
  4543.  
  4544.  
  4545.  2. You would normally open the info dbox on a submenu warning, so call:
  4546.  
  4547.     <EventMsg_Claim>(message_MENUWARNING, event_ANY, <InfoRequest=>PopUp_InfoRequest>, NULL);
  4548.  
  4549.     somewhere in your initialisation code.
  4550.  
  4551. One note. The 'OpenPopUp' function decribed above is needed
  4552. for use of ANY type of MENU PopUp, not just the ProgInfo one.PopUp example code
  4553. BOOL InfoRequest(<event_pollblock> *event, void *reference)
  4554. {
  4555.   <popup_data> info;
  4556.  
  4557.   <Msgs_Lookup>("app.name", info.proginfo.appname, 32);
  4558.   <Msgs_Lookup>("app.purpose", info.proginfo.purpose, 32);
  4559.   <Msgs_Lookup>("app.author", info.proginfo.author, 32);
  4560.   <Msgs_Lookup>("app.version", info.proginfo.version, 32);
  4561.  
  4562.   <PopUp_ShowMenuLeaf>("ProgInfo", &info, &event->data.message.data.menuwarn);
  4563.   return TRUE;
  4564. }
  4565.  
  4566.     If you have more than one submenu warning set, you will need to check
  4567.     the hit code returned, eg
  4568.  
  4569.     switch (event->data.message.data.menuwarn.selection[0])
  4570.     {
  4571.       case iconmenu_INFO:
  4572.         ...PopUp example code
  4573. BOOL OpenPopup(<event_pollblock> *event, void *reference)
  4574. {
  4575.   <message_popuprequest> *request = (<message_popuprequest> *)
  4576.                                   &event->data.message.data;
  4577.  
  4578.   <Wimp_CreateSubMenu>((<menu_block> *)request->window,
  4579.                      request->openpos.x, request->openpos.y);
  4580.  
  4581.   return TRUE;
  4582. }
  4583.  
  4584. This gets called when the PopUp server needs your application to open
  4585. the window for it.To use the SaveAs PopUp
  4586.  1. Call <EventMsg_Claim>(message_POPUPSTATE, event_ANY, <PopUpState=>PopUp_PopUpState>, NULL) at
  4587.     some point in your initialisation. <PopUpState=>PopUp_PopUpState> will be called when the
  4588.     drag of the icon from the SaveAs box has been finished. Your
  4589.     application must then start the normal data transfer protocol.
  4590.  
  4591.  
  4592.  2. When you want the SaveAs PopUp to appear, go:
  4593.  
  4594.     strcpy(saveas.saveas.iconsprite, "file_fff");
  4595.     strcpy(saveas.saveas.filename, "FileName");
  4596.     <PopUp_ShowStandalone>("SaveAs", &saveas);PopUp example code
  4597. BOOL PopUpState(<event_pollblock> *event, void *reference)
  4598. {
  4599.   /* do a GetPointerInfo and build a datasave block */
  4600.   <message_block> message;
  4601.   <mouse_block> ptrinfo;
  4602.  
  4603.   <Wimp_GetPointerInfo>(&ptrinfo);
  4604.   memcpy(&message, &event->data, sizeof(message_block));
  4605.   message.header.yourref = 0;
  4606.   message.header.action = message_DATASAVE;
  4607.   message.data.datasave.window = ptrinfo.window;
  4608.   message.data.datasave.icon = ptrinfo.icon;
  4609.   message.data.datasave.pos = ptrinfo.pos;
  4610.   message.data.datasave.estsize = -1;
  4611.   message.data.datasave.filetype = 0xFFF;
  4612.   <Wimp_SendMessage>(event_SEND, &message, ptrinfo.window, ptrinfo.icon);
  4613.  
  4614.   return TRUE;
  4615. }Type: popup_report
  4616. typedef struct
  4617. {
  4618.   struct
  4619.   {
  4620.     unsigned int cancel     : 1;    /* Has cancel button / cancel was chosen */
  4621.     unsigned int ok         : 1;    /* Has OK button     / OK was chosen     */
  4622.     unsigned int reserved   : 6;
  4623.     unsigned int userhandle : 24;   /* Put anything you find useful here     */
  4624.   } flags;
  4625.   char oktext[12];                  /* Text for OK button (if any)           */
  4626.   char canceltext[12];              /* Text for cancel button (if any)       */
  4627.   char appname[12];                 /* Application name for window titlebar  */
  4628.   char message[188];                /* Text message to report to the user    */
  4629. } popup_report;
  4630.  
  4631. defined in <PopUp>Type: popup_wimpcolour
  4632. typedef struct
  4633. {
  4634.   char colour;     /* Colour 0..15 */
  4635. } popup_wimpcolour;
  4636.  
  4637. defined in <PopUp>Type: message_popuprequest
  4638. typedef struct
  4639. {
  4640.   <window_handle> window;
  4641.   <wimp_point>    openpos;
  4642. } message_popuprequest;
  4643.  
  4644. Pass this data directly to
  4645. <Wimp_CreateSubMenu>. Do not pass GO
  4646.  
  4647. defined in <PopUp>Constants defined in PopUp
  4648. PopUp flag byte: Values of flag bits
  4649. Preferably, use the 'all inclusive' values below instead
  4650.  
  4651. #define popup_ISLEAF   (0x01)
  4652. #define popup_ISSTATIC (0x02)
  4653.  
  4654.  
  4655. All-inclusive PopUp flag byte values
  4656.  
  4657. #define popup_STANDALONE (0x00)
  4658. #define popup_MENULEAF   (0x01)
  4659. #define popup_STATIC     (0x02)
  4660.  
  4661.  
  4662. Colour model numbers. See below for examples of use
  4663.  
  4664. #define popuptc_RGB  0
  4665. #define popuptc_HSV  1
  4666. #define popuptc_CMYK 2
  4667.  
  4668.  
  4669. Values to OR in to flag value for no transparency, 1 transparency value
  4670. ('none' option) and full transparency (256 transparency levels)
  4671.  
  4672. #define popuptc_TRANSPARENT0   0x00000
  4673. #define popuptc_TRANSPARENT1   0x10000
  4674. #define popuptc_TRANSPARENT256 0x20000
  4675.  
  4676. Examples:
  4677. 'Draw' style colour:   colourmodel  = popuptc_RGB | popuptc_TRANSPARENT1;
  4678. Full transparency HSV: colour model = popuptc_HSV | popuptc_TRANSPARENT256;Font_SetThresholds
  4679. extern <os_error> *Font_SetThresholds(<font_thresholds> *t);
  4680.  
  4681. defined in <Font>Font_ReadThresholds
  4682. extern <os_error> *Font_ReadThresholds(<font_thresholds> *t);
  4683.  
  4684. defined in <Font>Font_SetPalette
  4685. extern <os_error> *Font_SetPalette(int back_log,  int fore_log,
  4686.                                  int offset,
  4687.                                  int back_phys, int fore_phys);
  4688.  
  4689. defined in <Font>Font_SetFontColours
  4690. extern <os_error> *Font_SetFontColours(<font_handle> font,
  4691.                                      int back_colour, int fore_colour,
  4692.                                      int offset);
  4693.  
  4694. defined in <Font>Font_ReadScaleFactor
  4695. extern <os_error> *Font_ReadScaleFactor(int *xscale, int *yscale);
  4696.  
  4697. defined in <Font>Font_StringBBox
  4698. extern <os_error> *Font_StringBBox(char *string, <font_info> *info);
  4699.  
  4700. defined in <Font>Font_CharBBox
  4701. extern <os_error> *Font_CharBBox(<font_handle> font, char c,
  4702.                                int flags, <font_info> *info);
  4703.  
  4704. defined in <Font>Font_StringWidth
  4705. extern <os_error> *Font_StringWidth(<font_string> *string);
  4706.  
  4707. defined in <Font>Font_FindCaretJ
  4708. extern <os_error> *Font_FindCaretJ(<font_string> *s, int xoffset, int yoffset);
  4709.  
  4710. defined in <Font>Font_FindCaret
  4711. extern <os_error> *Font_FindCaret(<font_string> *string);
  4712.  
  4713. defined in <Font>Font_Caret
  4714. extern <os_error> *Font_Caret(int colour, int height, int flags, int x, int y);
  4715.  
  4716. defined in <Font>Font_Paint
  4717. extern <os_error> *Font_Paint(char *s, int options, int x, int y);
  4718.  
  4719. defined in <Font>Font_FutureFont
  4720. extern <os_error> *Font_FutureFont(<font_state> *state);
  4721.  
  4722. defined in <Font>Font_CurrentFont
  4723. extern <os_error> *Font_CurrentFont(<font_state> *state);
  4724.  
  4725. defined in <Font>Font_SetFont
  4726. extern <os_error> *Font_SetFont(<font_handle> font);
  4727.  
  4728. defined in <Font>Font_LoseAllFonts
  4729. extern void Font_LoseAllFonts(<font_array> *fonts);
  4730.  
  4731. Given a font usage array, this function calls <Font_LoseFont> for all fonts
  4732. used, and sets the font usage array to zeros. See <font_array> for info on
  4733. how a font usage array is organised...
  4734.  
  4735. defined in <Font>Type: font_handle
  4736. typedef int font_handle;
  4737.  
  4738. defined in <Font>Type: font_info
  4739. typedef struct
  4740. {
  4741.     int minx, miny, maxx, maxy;
  4742. } font_info;
  4743.  
  4744. defined in <Font>Type: font_defn
  4745. typedef struct
  4746. {
  4747.   char name[128];   /* NOTE: <Font_ReadDefn> returns this string CR terminated */
  4748.   int xsize, ysize, xres, yres;
  4749.   int age, usage;
  4750. } font_defn;
  4751.  
  4752. defined in <Font>Type: font_string
  4753. typedef struct
  4754. {
  4755.   char *s;        /* string */
  4756.   int x;          /* in/out, in 1/72000s of an inch */
  4757.   int y;          /* in/out, in 1/72000s of an inch */
  4758.   int split;      /* in/out: space char, or -1      */
  4759.                   /*         on exit, = count of space or printable */
  4760.   int term;       /* in/out: index into s */
  4761. } font_string;
  4762.  
  4763. defined in <Font>Type: font_state
  4764. typedef struct
  4765. {
  4766.   <font_handle>  font;
  4767.   <font_colours> colour;
  4768.   int          offset;
  4769. } font_state;
  4770.  
  4771. defined in <Font>Type: font_colours
  4772. typedef struct
  4773. {
  4774.   int background, foreground;
  4775. } font_colours;
  4776.  
  4777. defined in <Font>Type: font_thresholds
  4778. typedef struct
  4779. {
  4780.   char offset;
  4781.   char thresholds[15];
  4782. } font_thresholds;
  4783.  
  4784. defined in <Font>Font_CacheAddr
  4785. extern <os_error> *Font_CacheAddr(int *version, int *cacheused, int *cachesize);
  4786.  
  4787. defined in <Font>Font_ListFonts
  4788. extern <os_error> *Font_ListFonts(char *name, int *count);
  4789.  
  4790. defined in <Font>Font_ReadDefn
  4791. extern <os_error> *Font_ReadDefn(<font_handle> font, <font_defn> *defn);
  4792.  
  4793. defined in <Font>Font_ReadInfo
  4794. extern <os_error> *Font_ReadInfo(<font_handle> font, <font_info> *info);
  4795.  
  4796. defined in <Font>Font_ConvertToOS
  4797. extern <os_error> *Font_ConvertToOS(int x, int y, int *xout, int *yout);
  4798.  
  4799. Also Known As: Font_ConverttoOS()
  4800.                            ~
  4801. defined in <Font>Font_ConvertToPoints
  4802. extern <os_error> *Font_ConvertToPoints(int x, int y, int *xout, int *yout);
  4803.  
  4804. Also Known As: Font_Converttopoints
  4805.                            ~ ~
  4806. defined in <Font>Font_FindFont
  4807. extern <os_error> *Font_FindFont(<font_handle> *font, char *name,
  4808.                                int xsize, int ysize, int xres, int yres);
  4809. defined in <Font>Font_LoseFont
  4810. extern <os_error> *Font_LoseFont(<font_handle> font);
  4811.  
  4812. defined in <Font>PDriver_InsertIllustration
  4813. os_error *PDriver_InsertIllustration(int illustration_handle, void *drawpath,
  4814.                                      <wimp_point> *bottom_left,
  4815.                                      <wimp_point> *bottom_right,
  4816.                                      <wimp_point> *top_left);
  4817.  
  4818. NOTE - the drawpath will be changed from a void * when drawfile support
  4819. is added to DeskLib.
  4820.  
  4821. defined in <PDriver>PDriver_SelectIllustration
  4822. <os_error> *PDriver_SelectIllustration(<print_job> new, char *title, <print_job> *old);
  4823.  
  4824. defined in <PDriver>Type: print_job
  4825. typedef int print_job;
  4826.  
  4827. actually a RISC OS file handle
  4828.  
  4829. defined in <PDriver>PDriver_CancelJobWithError
  4830. <os_error> *PDriver_CancelJobWithError(<print_job> job, <os_error> *error);
  4831.  
  4832. defined in <PDriver>PDriver_EnumerateJobs
  4833. <os_error> *PDriver_EnumerateJobs
  4834.  
  4835. defined in <PDriver>PDriver_ScreenDump
  4836. <os_error> *PDriver_ScreenDump(<print_job> job);
  4837.  
  4838. defined in <PDriver>PDriver_CancelJob
  4839. <os_error> *PDriver_CancelJob(<print_job> job);
  4840.  
  4841. defined in <PDriver>PDriver_GetRectangle
  4842. <os_error> *PDriver_GetRectangle(<wimp_rect> *rectangle_to_print,
  4843.                                int *finished, int *rectangle_id);
  4844. defined in <PDriver>PDriver_DrawPage
  4845. <os_error> *PDriver_DrawPage(int copies, <wimp_rect> *rectangle_to_print,
  4846.                            int sequence_no, char *page,
  4847.                            int *finished, int *rectangle_id);
  4848.                            
  4849. defined in <PDriver>PDriver_GiveRectangle
  4850. <os_error> *PDriver_GiveRectangle(int rectangle_id, <wimp_rect> *rectangle,
  4851.                                 <print_transformation> *matrix,
  4852.                                 <wimp_point> *position, int background_colour);
  4853. defined in <PDriver>Type: print_transformation
  4854. typedef struct
  4855. {
  4856.   int xx;
  4857.   int xy;
  4858.   int yx;
  4859.   int yy;
  4860. } print_transformation;
  4861.  
  4862. See Page 1554 of the RISC OS 2 PRMs
  4863.  
  4864. defined in <PDriver>PDriver_AbortJob
  4865. <os_error> *PDriver_AbortJob(<print_job> job);
  4866.  
  4867. defined in <PDriver>PDriver_EndJob
  4868. <os_error> *PDriver_EndJob(<print_job> job);
  4869.  
  4870. defined in <PDriver>PDriver_CurrentJob
  4871. <os_error> *PDriver_CurrentJob(<print_job> *current);
  4872.  
  4873. defined in <PDriver>PDriver_SelectJob
  4874. <os_error> *PDriver_SelectJob(<print_job> new, char *title, <print_job> *old);
  4875.  
  4876. defined in <PDriver>PDriver_PageSize
  4877. <os_error> *PDriver_PageSize(<wimp_point> *size, <wimp_rect> *printable);
  4878.  
  4879. defined in <PDriver>PDriver_CheckFeatures
  4880. <os_error> *PDriver_CheckFeatures(<print_features> mask, <print_features> value);
  4881.  
  4882. defined in <PDriver>Type: print_features
  4883. The 'features' word represented as a structure:
  4884.  
  4885. typedef union
  4886. {
  4887.   int <value=>print_featuresdef>;
  4888.   struct
  4889.   {
  4890.     unsigned int colour        : 1;
  4891.     unsigned int limited       : 1;
  4892.     unsigned int discrete      : 1;
  4893.     unsigned int filler1       : 5;   /* reserved */
  4894.     unsigned int nofill        : 1;
  4895.     unsigned int nothickness   : 1;
  4896.     unsigned int nooverwrite   : 1;
  4897.     unsigned int filler2       : 5;   /* reserved */
  4898.     unsigned int filler3       : 8;   /* reserved */
  4899.     unsigned int screendump    : 1;
  4900.     unsigned int transforms    : 1;
  4901.     unsigned int illustrations : 1;
  4902.     unsigned int filler4       : 5;   /* reserved */
  4903.   } data;
  4904. } print_features;
  4905.  
  4906. defined in <PDriver>Constants for the print_feature word:
  4907. These #defines represent the bits of the 'features' word:
  4908.  
  4909. #define printfeat_COLOUR         0x00000001
  4910. #define printfeat_LIMITED        0x00000002
  4911. #define printfeat_DISCRETE       0x00000004
  4912. #define printfeat_NOFILL         0x00000100
  4913. #define printfeat_NOTHICKNESS    0x00000200
  4914. #define printfeat_NOOVERWRITE    0x00000400
  4915. #define printfeat_SCREENDUMP     0x01000000
  4916. #define printfeat_TRANSFORMS     0x02000000
  4917. #define printfeat_ILLUSTRATIONS  0x04000000PDriver_Info
  4918. os_error *PDriver_Info(<printer_info> *block);
  4919.  
  4920. Reads information on the printer driver.
  4921.  
  4922. defined in <PDriver>Type: printer_info
  4923. typedef struct
  4924. {
  4925.   unsigned int     version    : 16;
  4926.   int              <drivertype=>printer_drivertype> : 16;
  4927.   <wimp_point>       resolution;
  4928.   <print_features>   features;
  4929.   char             *description;
  4930.   <wimp_point>       halftone_res;
  4931.   int              id_number;
  4932. } printer_info;
  4933.  
  4934. info returned by <PDriver_Info> (RO2 PRM's pg 1539)
  4935.  
  4936. defined in <PDriver>Values for the drivertype field of printer_info:
  4937. #define printdriver_POSTSCRIPT  0
  4938. #define printdriver_FX80        1
  4939. #define printdriver_LASERJET    2
  4940. #define printdriver_INTEGREX    3PDriver_PrinterName (pseudo-SWI veneer)
  4941. extern char *PDriver_PrinterName(void);
  4942.  
  4943. This function calls <PDriver_Info>, and returns the Printer name returned
  4944. by that SWI. If no Printer Driver is installed, it returns NULL.
  4945.  
  4946. NOTE that the returned string should be treated as READ ONLY, as it
  4947. is a pointer into the PDriver's RMA workspace!
  4948.  
  4949. defined in <PDriver>