home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / h / wimp < prev    next >
Encoding:
Text File  |  1994-09-14  |  88.0 KB  |  2,757 lines

  1. #ifndef wimp_H
  2. #define wimp_H
  3.  
  4. /* C header file for Wimp
  5.  * written by DefMod (Sep  7 1994) on Wed Sep 14 13:17:56 1994
  6.  * Copyright © Acorn Computers Ltd, 1994
  7.  */
  8.  
  9. /*************************************************************************
  10.  * This source file was written by Acorn Computers Limited. It is part   *
  11.  * of the OSLib library for writing applications for RISC OS. It may be  *
  12.  * used freely in the creation of programs for RISC OS.                  *
  13.  *************************************************************************/
  14.  
  15. #ifndef types_H
  16.    #include "types.h"
  17. #endif
  18.  
  19. #ifndef os_H
  20.    #include "os.h"
  21. #endif
  22.  
  23. #ifndef osspriteop_H
  24.    #include "osspriteop.h"
  25. #endif
  26.  
  27. #ifndef font_H
  28.    #include "font.h"
  29. #endif
  30.  
  31. /**********************************
  32.  * SWI names and SWI reason codes *
  33.  **********************************/
  34. #undef  Wimp_Initialise
  35. #define Wimp_Initialise                         0x400C0
  36. #undef  XWimp_Initialise
  37. #define XWimp_Initialise                        0x600C0
  38. #undef  Wimp_CreateWindow
  39. #define Wimp_CreateWindow                       0x400C1
  40. #undef  XWimp_CreateWindow
  41. #define XWimp_CreateWindow                      0x600C1
  42. #undef  Wimp_CreateIcon
  43. #define Wimp_CreateIcon                         0x400C2
  44. #undef  XWimp_CreateIcon
  45. #define XWimp_CreateIcon                        0x600C2
  46. #undef  Wimp_CreateIconRelative
  47. #define Wimp_CreateIconRelative                 0x400C2
  48. #undef  XWimp_CreateIconRelative
  49. #define XWimp_CreateIconRelative                0x600C2
  50. #undef  Wimp_CreateIconPrioritised
  51. #define Wimp_CreateIconPrioritised              0x400C2
  52. #undef  XWimp_CreateIconPrioritised
  53. #define XWimp_CreateIconPrioritised             0x600C2
  54. #undef  Wimp_DeleteWindow
  55. #define Wimp_DeleteWindow                       0x400C3
  56. #undef  XWimp_DeleteWindow
  57. #define XWimp_DeleteWindow                      0x600C3
  58. #undef  Wimp_DeleteIcon
  59. #define Wimp_DeleteIcon                         0x400C4
  60. #undef  XWimp_DeleteIcon
  61. #define XWimp_DeleteIcon                        0x600C4
  62. #undef  Wimp_OpenWindow
  63. #define Wimp_OpenWindow                         0x400C5
  64. #undef  XWimp_OpenWindow
  65. #define XWimp_OpenWindow                        0x600C5
  66. #undef  Wimp_CloseWindow
  67. #define Wimp_CloseWindow                        0x400C6
  68. #undef  XWimp_CloseWindow
  69. #define XWimp_CloseWindow                       0x600C6
  70. #undef  Wimp_Poll
  71. #define Wimp_Poll                               0x400C7
  72. #undef  XWimp_Poll
  73. #define XWimp_Poll                              0x600C7
  74. #undef  Wimp_RedrawWindow
  75. #define Wimp_RedrawWindow                       0x400C8
  76. #undef  XWimp_RedrawWindow
  77. #define XWimp_RedrawWindow                      0x600C8
  78. #undef  Wimp_UpdateWindow
  79. #define Wimp_UpdateWindow                       0x400C9
  80. #undef  XWimp_UpdateWindow
  81. #define XWimp_UpdateWindow                      0x600C9
  82. #undef  Wimp_GetRectangle
  83. #define Wimp_GetRectangle                       0x400CA
  84. #undef  XWimp_GetRectangle
  85. #define XWimp_GetRectangle                      0x600CA
  86. #undef  Wimp_GetWindowState
  87. #define Wimp_GetWindowState                     0x400CB
  88. #undef  XWimp_GetWindowState
  89. #define XWimp_GetWindowState                    0x600CB
  90. #undef  Wimp_GetWindowInfo
  91. #define Wimp_GetWindowInfo                      0x400CC
  92. #undef  XWimp_GetWindowInfo
  93. #define XWimp_GetWindowInfo                     0x600CC
  94. #undef  Wimp_GetWindowInfoHeaderOnly
  95. #define Wimp_GetWindowInfoHeaderOnly            0x400CC
  96. #undef  XWimp_GetWindowInfoHeaderOnly
  97. #define XWimp_GetWindowInfoHeaderOnly           0x600CC
  98. #undef  Wimp_SetIconState
  99. #define Wimp_SetIconState                       0x400CD
  100. #undef  XWimp_SetIconState
  101. #define XWimp_SetIconState                      0x600CD
  102. #undef  Wimp_GetIconState
  103. #define Wimp_GetIconState                       0x400CE
  104. #undef  XWimp_GetIconState
  105. #define XWimp_GetIconState                      0x600CE
  106. #undef  Wimp_GetPointerInfo
  107. #define Wimp_GetPointerInfo                     0x400CF
  108. #undef  XWimp_GetPointerInfo
  109. #define XWimp_GetPointerInfo                    0x600CF
  110. #undef  Wimp_DragBox
  111. #define Wimp_DragBox                            0x400D0
  112. #undef  XWimp_DragBox
  113. #define XWimp_DragBox                           0x600D0
  114. #undef  Wimp_ForceRedraw
  115. #define Wimp_ForceRedraw                        0x400D1
  116. #undef  XWimp_ForceRedraw
  117. #define XWimp_ForceRedraw                       0x600D1
  118. #undef  Wimp_SetCaretPosition
  119. #define Wimp_SetCaretPosition                   0x400D2
  120. #undef  XWimp_SetCaretPosition
  121. #define XWimp_SetCaretPosition                  0x600D2
  122. #undef  Wimp_GetCaretPosition
  123. #define Wimp_GetCaretPosition                   0x400D3
  124. #undef  XWimp_GetCaretPosition
  125. #define XWimp_GetCaretPosition                  0x600D3
  126. #undef  Wimp_CreateMenu
  127. #define Wimp_CreateMenu                         0x400D4
  128. #undef  XWimp_CreateMenu
  129. #define XWimp_CreateMenu                        0x600D4
  130. #undef  Wimp_DecodeMenu
  131. #define Wimp_DecodeMenu                         0x400D5
  132. #undef  XWimp_DecodeMenu
  133. #define XWimp_DecodeMenu                        0x600D5
  134. #undef  Wimp_WhichIcon
  135. #define Wimp_WhichIcon                          0x400D6
  136. #undef  XWimp_WhichIcon
  137. #define XWimp_WhichIcon                         0x600D6
  138. #undef  Wimp_SetExtent
  139. #define Wimp_SetExtent                          0x400D7
  140. #undef  XWimp_SetExtent
  141. #define XWimp_SetExtent                         0x600D7
  142. #undef  Wimp_SetPointerShape
  143. #define Wimp_SetPointerShape                    0x400D8
  144. #undef  XWimp_SetPointerShape
  145. #define XWimp_SetPointerShape                   0x600D8
  146. #undef  Wimp_OpenTemplate
  147. #define Wimp_OpenTemplate                       0x400D9
  148. #undef  XWimp_OpenTemplate
  149. #define XWimp_OpenTemplate                      0x600D9
  150. #undef  Wimp_CloseTemplate
  151. #define Wimp_CloseTemplate                      0x400DA
  152. #undef  XWimp_CloseTemplate
  153. #define XWimp_CloseTemplate                     0x600DA
  154. #undef  Wimp_LoadTemplate
  155. #define Wimp_LoadTemplate                       0x400DB
  156. #undef  XWimp_LoadTemplate
  157. #define XWimp_LoadTemplate                      0x600DB
  158. #undef  Wimp_ProcessKey
  159. #define Wimp_ProcessKey                         0x400DC
  160. #undef  XWimp_ProcessKey
  161. #define XWimp_ProcessKey                        0x600DC
  162. #undef  Wimp_CloseDown
  163. #define Wimp_CloseDown                          0x400DD
  164. #undef  XWimp_CloseDown
  165. #define XWimp_CloseDown                         0x600DD
  166. #undef  Wimp_StartTask
  167. #define Wimp_StartTask                          0x400DE
  168. #undef  XWimp_StartTask
  169. #define XWimp_StartTask                         0x600DE
  170. #undef  Wimp_ReportError
  171. #define Wimp_ReportError                        0x400DF
  172. #undef  XWimp_ReportError
  173. #define XWimp_ReportError                       0x600DF
  174. #undef  Wimp_ReportErrorByCategory
  175. #define Wimp_ReportErrorByCategory              0x400DF
  176. #undef  XWimp_ReportErrorByCategory
  177. #define XWimp_ReportErrorByCategory             0x600DF
  178. #undef  Wimp_GetWindowOutline
  179. #define Wimp_GetWindowOutline                   0x400E0
  180. #undef  XWimp_GetWindowOutline
  181. #define XWimp_GetWindowOutline                  0x600E0
  182. #undef  Wimp_PollIdle
  183. #define Wimp_PollIdle                           0x400E1
  184. #undef  XWimp_PollIdle
  185. #define XWimp_PollIdle                          0x600E1
  186. #undef  Wimp_PlotIcon
  187. #define Wimp_PlotIcon                           0x400E2
  188. #undef  XWimp_PlotIcon
  189. #define XWimp_PlotIcon                          0x600E2
  190. #undef  Wimp_SetMode
  191. #define Wimp_SetMode                            0x400E3
  192. #undef  XWimp_SetMode
  193. #define XWimp_SetMode                           0x600E3
  194. #undef  Wimp_SetPalette
  195. #define Wimp_SetPalette                         0x400E4
  196. #undef  XWimp_SetPalette
  197. #define XWimp_SetPalette                        0x600E4
  198. #undef  Wimp_ReadPalette
  199. #define Wimp_ReadPalette                        0x400E5
  200. #undef  XWimp_ReadPalette
  201. #define XWimp_ReadPalette                       0x600E5
  202. #undef  Wimp_ReadTruePalette
  203. #define Wimp_ReadTruePalette                    0x400E5
  204. #undef  XWimp_ReadTruePalette
  205. #define XWimp_ReadTruePalette                   0x600E5
  206. #undef  Wimp_SetColour
  207. #define Wimp_SetColour                          0x400E6
  208. #undef  XWimp_SetColour
  209. #define XWimp_SetColour                         0x600E6
  210. #undef  Wimp_SendMessage
  211. #define Wimp_SendMessage                        0x400E7
  212. #undef  XWimp_SendMessage
  213. #define XWimp_SendMessage                       0x600E7
  214. #undef  Wimp_SendMessageToWindow
  215. #define Wimp_SendMessageToWindow                0x400E7
  216. #undef  XWimp_SendMessageToWindow
  217. #define XWimp_SendMessageToWindow               0x600E7
  218. #undef  Wimp_CreateSubMenu
  219. #define Wimp_CreateSubMenu                      0x400E8
  220. #undef  XWimp_CreateSubMenu
  221. #define XWimp_CreateSubMenu                     0x600E8
  222. #undef  Wimp_BaseOfSprites
  223. #define Wimp_BaseOfSprites                      0x400EA
  224. #undef  XWimp_BaseOfSprites
  225. #define XWimp_BaseOfSprites                     0x600EA
  226. #undef  Wimp_BlockCopy
  227. #define Wimp_BlockCopy                          0x400EB
  228. #undef  XWimp_BlockCopy
  229. #define XWimp_BlockCopy                         0x600EB
  230. #undef  Wimp_SlotSize
  231. #define Wimp_SlotSize                           0x400EC
  232. #undef  XWimp_SlotSize
  233. #define XWimp_SlotSize                          0x600EC
  234. #undef  Wimp_ReadPixTrans
  235. #define Wimp_ReadPixTrans                       0x400ED
  236. #undef  XWimp_ReadPixTrans
  237. #define XWimp_ReadPixTrans                      0x600ED
  238. #undef  Wimp_ClaimFreeMemory
  239. #define Wimp_ClaimFreeMemory                    0x400EE
  240. #undef  XWimp_ClaimFreeMemory
  241. #define XWimp_ClaimFreeMemory                   0x600EE
  242. #undef  WimpClaimFreeMemory_Alloc
  243. #define WimpClaimFreeMemory_Alloc               0x1
  244. #undef  WimpClaimFreeMemory_Free
  245. #define WimpClaimFreeMemory_Free                0x0
  246. #undef  Wimp_CommandWindow
  247. #define Wimp_CommandWindow                      0x400EF
  248. #undef  XWimp_CommandWindow
  249. #define XWimp_CommandWindow                     0x600EF
  250. #undef  Wimp_TextColour
  251. #define Wimp_TextColour                         0x400F0
  252. #undef  XWimp_TextColour
  253. #define XWimp_TextColour                        0x600F0
  254. #undef  Wimp_TransferBlock
  255. #define Wimp_TransferBlock                      0x400F1
  256. #undef  XWimp_TransferBlock
  257. #define XWimp_TransferBlock                     0x600F1
  258. #undef  Wimp_SetFontColours
  259. #define Wimp_SetFontColours                     0x400F3
  260. #undef  XWimp_SetFontColours
  261. #define XWimp_SetFontColours                    0x600F3
  262. #undef  Wimp_GetMenuState
  263. #define Wimp_GetMenuState                       0x400F4
  264. #undef  XWimp_GetMenuState
  265. #define XWimp_GetMenuState                      0x600F4
  266. #undef  Wimp_RegisterFilter
  267. #define Wimp_RegisterFilter                     0x400F5
  268. #undef  XWimp_RegisterFilter
  269. #define XWimp_RegisterFilter                    0x600F5
  270. #undef  Wimp_AddMessages
  271. #define Wimp_AddMessages                        0x400F6
  272. #undef  XWimp_AddMessages
  273. #define XWimp_AddMessages                       0x600F6
  274. #undef  Wimp_RemoveMessages
  275. #define Wimp_RemoveMessages                     0x400F7
  276. #undef  XWimp_RemoveMessages
  277. #define XWimp_RemoveMessages                    0x600F7
  278. #undef  Wimp_SetColourMapping
  279. #define Wimp_SetColourMapping                   0x400F8
  280. #undef  XWimp_SetColourMapping
  281. #define XWimp_SetColourMapping                  0x600F8
  282. #undef  Wimp_TextOp
  283. #define Wimp_TextOp                             0x400F9
  284. #undef  XWimp_TextOp
  285. #define XWimp_TextOp                            0x600F9
  286. #undef  WimpTextOp_SetColour
  287. #define WimpTextOp_SetColour                    0x0
  288. #undef  WimpTextOp_StringWidth
  289. #define WimpTextOp_StringWidth                  0x1
  290. #undef  WimpTextOp_Paint
  291. #define WimpTextOp_Paint                        0x2
  292. #undef  Wimp_SetWatchdogState
  293. #define Wimp_SetWatchdogState                   0x400FA
  294. #undef  XWimp_SetWatchdogState
  295. #define XWimp_SetWatchdogState                  0x600FA
  296. #undef  Wimp_Extend
  297. #define Wimp_Extend                             0x400FB
  298. #undef  XWimp_Extend
  299. #define XWimp_Extend                            0x600FB
  300. #undef  Wimp_ResizeIcon
  301. #define Wimp_ResizeIcon                         0x400FC
  302. #undef  XWimp_ResizeIcon
  303. #define XWimp_ResizeIcon                        0x600FC
  304. #undef  Service_Memory
  305. #define Service_Memory                          0x11
  306. #undef  Service_StartWimp
  307. #define Service_StartWimp                       0x49
  308. #undef  Service_StartedWimp
  309. #define Service_StartedWimp                     0x4A
  310. #undef  Service_MouseTrap
  311. #define Service_MouseTrap                       0x52
  312. #undef  Service_WimpCloseDown
  313. #define Service_WimpCloseDown                   0x53
  314. #undef  Service_WimpReportError
  315. #define Service_WimpReportError                 0x57
  316. #undef  Service_WimpSaveDesktop
  317. #define Service_WimpSaveDesktop                 0x5C
  318. #undef  Service_WimpPalette
  319. #define Service_WimpPalette                     0x5D
  320. #undef  Service_DesktopWelcome
  321. #define Service_DesktopWelcome                  0x7C
  322. #undef  Service_ShutDown
  323. #define Service_ShutDown                        0x7E
  324. #undef  Service_ShutDownComplete
  325. #define Service_ShutDownComplete                0x80
  326. #undef  Service_WimpSpritesMoved
  327. #define Service_WimpSpritesMoved                0x85
  328. #undef  Service_WimpRegisterFilters
  329. #define Service_WimpRegisterFilters             0x86
  330. #undef  Service_ErrorStarting
  331. #define Service_ErrorStarting                   0x400C0
  332. #undef  Service_ErrorButtonPressed
  333. #define Service_ErrorButtonPressed              0x400C1
  334. #undef  Service_ErrorEnding
  335. #define Service_ErrorEnding                     0x400C2
  336.  
  337. /************************************
  338.  * Structure and union declarations *
  339.  ************************************/
  340. typedef struct wimp_w_                          *wimp_w;
  341. typedef struct wimp_t_                          *wimp_t;
  342. typedef union  wimp_icon_data                   wimp_icon_data;
  343. typedef struct wimp_icon                        wimp_icon;
  344. typedef struct wimp_icon_create                 wimp_icon_create;
  345. typedef struct wimp_window                      wimp_window;
  346. typedef struct wimp_window_state                wimp_window_state;
  347. typedef struct wimp_icon_state                  wimp_icon_state;
  348. typedef struct wimp_window_info                 wimp_window_info;
  349. typedef struct wimp_outline                     wimp_outline;
  350. typedef struct wimp_draw                        wimp_draw;
  351. typedef struct wimp_open                        wimp_open;
  352. typedef struct wimp_close                       wimp_close;
  353. typedef struct wimp_leaving                     wimp_leaving;
  354. typedef struct wimp_entering                    wimp_entering;
  355. typedef struct wimp_pointer                     wimp_pointer;
  356. typedef struct wimp_dragged                     wimp_dragged;
  357. typedef struct wimp_key                         wimp_key;
  358. typedef struct wimp_selection                   wimp_selection;
  359. typedef struct wimp_scroll                      wimp_scroll;
  360. typedef struct wimp_pollword                    wimp_pollword;
  361. typedef struct wimp_drag                        wimp_drag;
  362. typedef struct wimp_caret                       wimp_caret;
  363. typedef struct wimp_menu_entry                  wimp_menu_entry;
  364. typedef struct wimp_menu                        wimp_menu;
  365. typedef struct wimp_message_data_xfer           wimp_message_data_xfer;
  366. typedef struct wimp_message_ram_xfer            wimp_message_ram_xfer;
  367. typedef struct wimp_message_prequit             wimp_message_prequit;
  368. typedef struct wimp_message_save_desktop        wimp_message_save_desktop;
  369. typedef struct wimp_message_device              wimp_message_device;
  370. typedef struct wimp_message_data_saved          wimp_message_data_saved;
  371. typedef struct wimp_message_shutdown            wimp_message_shutdown;
  372. typedef struct wimp_message_claim_entity        wimp_message_claim_entity;
  373. typedef struct wimp_message_data_request        wimp_message_data_request;
  374. typedef struct wimp_message_dragging            wimp_message_dragging;
  375. typedef struct wimp_message_drag_claim          wimp_message_drag_claim;
  376. typedef struct wimp_message_menu_warning        wimp_message_menu_warning;
  377. typedef struct wimp_message_task_initialise     wimp_message_task_initialise;
  378. typedef struct wimp_message_slot_size           wimp_message_slot_size;
  379. typedef struct wimp_message_set_slot            wimp_message_set_slot;
  380. typedef struct wimp_message_task_name_rq        wimp_message_task_name_rq;
  381. typedef struct wimp_message_task_name_is        wimp_message_task_name_is;
  382. typedef struct wimp_message_menus_deleted       wimp_message_menus_deleted;
  383. typedef struct wimp_message_iconise             wimp_message_iconise;
  384. typedef struct wimp_message_window_closed       wimp_message_window_closed;
  385. typedef struct wimp_message_window_info         wimp_message_window_info;
  386. typedef struct wimp_message_font_changed        wimp_message_font_changed;
  387. typedef struct wimp_message                     wimp_message;
  388. typedef union  wimp_block                       wimp_block;
  389. typedef struct wimp_message_list                wimp_message_list;
  390.  
  391. /********************
  392.  * Type definitions *
  393.  ********************/
  394. typedef int wimp_i;
  395.  
  396. typedef byte wimp_colour;
  397.  
  398. union wimp_icon_data
  399.    {  char text [12];
  400.       char sprite [12];
  401.       char text_and_sprite [12];
  402.       struct
  403.       {  char *text;
  404.          char *validation;
  405.          int size;
  406.       }
  407.       indirected_text;
  408.       struct
  409.       {  osspriteop_id id;
  410.          osspriteop_area *area;
  411.          int size;
  412.       }
  413.       indirected_sprite;
  414.       struct
  415.       {  char *text;
  416.          char *validation;
  417.          int size;
  418.       }
  419.       indirected_text_and_sprite;
  420.    };
  421.  
  422. struct wimp_icon
  423.    {  os_box extent;
  424.       bits flags;
  425.       wimp_icon_data data;
  426.    };
  427.  
  428. struct wimp_icon_create
  429.    {  wimp_w w;
  430.       wimp_icon icon;
  431.    };
  432.  
  433. struct wimp_window
  434.    {  os_box visible;
  435.       int xscroll;
  436.       int yscroll;
  437.       wimp_w next;
  438.       bits flags;
  439.       wimp_colour title_fg;
  440.       wimp_colour title_bg;
  441.       wimp_colour work_fg;
  442.       wimp_colour work_bg;
  443.       wimp_colour scroll_outer;
  444.       wimp_colour scroll_inner;
  445.       wimp_colour highlight_bg;
  446.       wimp_colour reserved;
  447.       os_box extent;
  448.       bits title_flags;
  449.       bits work_flags;
  450.       osspriteop_area *sprite_area;
  451.       short xmin;
  452.       short ymin;
  453.       wimp_icon_data title_data;
  454.       int icon_count;
  455.       wimp_icon icons [UNKNOWN];
  456.    };
  457.  
  458. #define wimp_WINDOW(N) \
  459.    struct \
  460.       {  os_box visible; \
  461.          int xscroll; \
  462.          int yscroll; \
  463.          wimp_w next; \
  464.          bits flags; \
  465.          wimp_colour title_fg; \
  466.          wimp_colour title_bg; \
  467.          wimp_colour work_fg; \
  468.          wimp_colour work_bg; \
  469.          wimp_colour scroll_outer; \
  470.          wimp_colour scroll_inner; \
  471.          wimp_colour highlight_bg; \
  472.          wimp_colour reserved; \
  473.          os_box extent; \
  474.          bits title_flags; \
  475.          bits work_flags; \
  476.          osspriteop_area *sprite_area; \
  477.          short xmin; \
  478.          short ymin; \
  479.          wimp_icon_data title_data; \
  480.          int icon_count; \
  481.          wimp_icon icons [N]; \
  482.       }
  483.  
  484. #define wimp_SIZEOF_WINDOW(N) \
  485.    (offsetof (wimp_window, icons) + \
  486.          (N)*sizeof ((wimp_window *) NULL)->icons)
  487.  
  488. struct wimp_window_state
  489.    {  wimp_w w;
  490.       os_box visible;
  491.       int xscroll;
  492.       int yscroll;
  493.       wimp_w next;
  494.       bits flags;
  495.    };
  496.  
  497. struct wimp_icon_state
  498.    {  wimp_w w;
  499.       wimp_i i;
  500.       wimp_icon icon;
  501.    };
  502.  
  503. struct wimp_window_info
  504.    {  wimp_w w;
  505.       os_box visible;
  506.       int xscroll;
  507.       int yscroll;
  508.       wimp_w next;
  509.       bits flags;
  510.       wimp_colour title_fg;
  511.       wimp_colour title_bg;
  512.       wimp_colour work_fg;
  513.       wimp_colour work_bg;
  514.       wimp_colour scroll_outer;
  515.       wimp_colour scroll_inner;
  516.       wimp_colour highlight_bg;
  517.       wimp_colour reserved;
  518.       os_box extent;
  519.       bits title_flags;
  520.       bits work_flags;
  521.       osspriteop_area *sprite_area;
  522.       short xmin;
  523.       short ymin;
  524.       wimp_icon_data title_data;
  525.       int icon_count;
  526.       wimp_icon icons [UNKNOWN];
  527.    };
  528.  
  529. #define wimp_WINDOW_INFO(N) \
  530.    struct \
  531.       {  wimp_w w; \
  532.          os_box visible; \
  533.          int xscroll; \
  534.          int yscroll; \
  535.          wimp_w next; \
  536.          bits flags; \
  537.          wimp_colour title_fg; \
  538.          wimp_colour title_bg; \
  539.          wimp_colour work_fg; \
  540.          wimp_colour work_bg; \
  541.          wimp_colour scroll_outer; \
  542.          wimp_colour scroll_inner; \
  543.          wimp_colour highlight_bg; \
  544.          wimp_colour reserved; \
  545.          os_box extent; \
  546.          bits title_flags; \
  547.          bits work_flags; \
  548.          osspriteop_area *sprite_area; \
  549.          short xmin; \
  550.          short ymin; \
  551.          wimp_icon_data title_data; \
  552.          int icon_count; \
  553.          wimp_icon icons [N]; \
  554.       }
  555.  
  556. #define wimp_SIZEOF_WINDOW_INFO(N) \
  557.    (offsetof (wimp_window_info, icons) + \
  558.          (N)*sizeof ((wimp_window_info *) NULL)->icons)
  559.  
  560. struct wimp_outline
  561.    {  wimp_w w;
  562.       os_box outline;
  563.    };
  564.  
  565. struct wimp_draw
  566.    {  wimp_w w;
  567.       os_box box;
  568.       int xscroll;
  569.       int yscroll;
  570.       os_box clip;
  571.    };
  572.  
  573. struct wimp_open
  574.    {  wimp_w w;
  575.       os_box visible;
  576.       int xscroll;
  577.       int yscroll;
  578.       wimp_w next;
  579.    };
  580.  
  581. struct wimp_close
  582.    {  wimp_w w;
  583.    };
  584.  
  585. struct wimp_leaving
  586.    {  wimp_w w;
  587.    };
  588.  
  589. struct wimp_entering
  590.    {  wimp_w w;
  591.    };
  592.  
  593. struct wimp_pointer
  594.    {  os_coord pos;
  595.       bits buttons;
  596.       wimp_w w;
  597.       wimp_i i;
  598.    };
  599.  
  600. struct wimp_dragged
  601.    {  os_box final;
  602.    };
  603.  
  604. struct wimp_key
  605.    {  wimp_w w;
  606.       wimp_i i;
  607.       os_coord pos;
  608.       int height;
  609.       int index;
  610.       int c;
  611.    };
  612.  
  613. struct wimp_selection
  614.    {  int items [9];
  615.    };
  616.  
  617. struct wimp_scroll
  618.    {  wimp_w w;
  619.       os_box visible;
  620.       int xscroll;
  621.       int yscroll;
  622.       wimp_w next;
  623.       int xmin;
  624.       int ymin;
  625.    };
  626.  
  627. struct wimp_pollword
  628.    {  byte *addr;
  629.       int word;
  630.    };
  631.  
  632. struct wimp_drag
  633.    {  wimp_w w;
  634.       int type;
  635.       os_box initial;
  636.       os_box bbox;
  637.       byte *handle;
  638.       void *draw;
  639.       void *undraw;
  640.       void *redraw;
  641.    };
  642.  
  643. struct wimp_caret
  644.    {  wimp_w w;
  645.       wimp_i i;
  646.       os_coord pos;
  647.       int height;
  648.       int index;
  649.    };
  650.  
  651. struct wimp_menu_entry
  652.    {  bits menu_flags;
  653.       wimp_menu *sub_menu;
  654.       bits icon_flags;
  655.       wimp_icon_data data;
  656.    };
  657.  
  658. struct wimp_menu
  659.    {  union
  660.       {  char text [12];
  661.          struct
  662.          {  char *text;
  663.             byte reserved [8];
  664.          }
  665.          indirected_text;
  666.       }
  667.       title_data;
  668.       wimp_colour title_fg;
  669.       wimp_colour title_bg;
  670.       wimp_colour work_fg;
  671.       wimp_colour work_bg;
  672.       int width;
  673.       int height;
  674.       int gap;
  675.       wimp_menu_entry entries [UNKNOWN];
  676.    };
  677.  
  678. #define wimp_MENU(N) \
  679.    struct \
  680.       {  union \
  681.          {  char text [12]; \
  682.             struct \
  683.             {  char *text; \
  684.                byte reserved [8]; \
  685.             } \
  686.             indirected_text; \
  687.          } \
  688.          title_data; \
  689.          wimp_colour title_fg; \
  690.          wimp_colour title_bg; \
  691.          wimp_colour work_fg; \
  692.          wimp_colour work_bg; \
  693.          int width; \
  694.          int height; \
  695.          int gap; \
  696.          wimp_menu_entry entries [N]; \
  697.       }
  698.  
  699. #define wimp_SIZEOF_MENU(N) \
  700.    (offsetof (wimp_menu, entries) + \
  701.          (N)*sizeof ((wimp_menu *) NULL)->entries)
  702.  
  703. struct wimp_message_data_xfer
  704.    {  wimp_w w;
  705.       wimp_i i;
  706.       os_coord pos;
  707.       int est_size;
  708.       bits file_type;
  709.       char file_name [212];
  710.    };
  711.  
  712. struct wimp_message_ram_xfer
  713.    {  byte *addr;
  714.       int size;
  715.    };
  716.  
  717. struct wimp_message_prequit
  718.    {  bits flags;
  719.    };
  720.  
  721. struct wimp_message_save_desktop
  722.    {  os_f file;
  723.       byte reserved [3];
  724.       bits flags;
  725.    };
  726.  
  727. struct wimp_message_device
  728.    {  int major;
  729.       int minor;
  730.       char info [228];
  731.    };
  732.  
  733. struct wimp_message_data_saved
  734.    {  int ref;
  735.    };
  736.  
  737. struct wimp_message_shutdown
  738.    {  bits flags;
  739.    };
  740.  
  741. struct wimp_message_claim_entity
  742.    {  bits flags;
  743.    };
  744.  
  745. struct wimp_message_data_request
  746.    {  wimp_w w;
  747.       wimp_i i;
  748.       os_coord pos;
  749.       bits flags;
  750.       bits file_types [54];
  751.    };
  752.  
  753. struct wimp_message_dragging
  754.    {  wimp_w w;
  755.       wimp_i i;
  756.       os_coord pos;
  757.       bits flags;
  758.       os_box box;
  759.       bits file_types [50];
  760.    };
  761.  
  762. struct wimp_message_drag_claim
  763.    {  bits flags;
  764.       bits file_types [58];
  765.    };
  766.  
  767. struct wimp_message_menu_warning
  768.    {  wimp_menu *sub_menu;
  769.       os_coord pos;
  770.       wimp_selection selection;
  771.    };
  772.  
  773. struct wimp_message_task_initialise
  774.    {  byte *cao;
  775.       int size;
  776.       char task_name [228];
  777.    };
  778.  
  779. struct wimp_message_slot_size
  780.    {  int new_curr;
  781.       int new_next;
  782.    };
  783.  
  784. struct wimp_message_set_slot
  785.    {  int new_curr;
  786.       wimp_t task;
  787.    };
  788.  
  789. struct wimp_message_task_name_rq
  790.    {  wimp_t task;
  791.    };
  792.  
  793. struct wimp_message_task_name_is
  794.    {  wimp_t task;
  795.       int size;
  796.       char task_name [228];
  797.    };
  798.  
  799. struct wimp_message_menus_deleted
  800.    {  wimp_menu *menu;
  801.    };
  802.  
  803. struct wimp_message_iconise
  804.    {  wimp_w w;
  805.       wimp_t task;
  806.       char title [20];
  807.    };
  808.  
  809. struct wimp_message_window_closed
  810.    {  wimp_w w;
  811.    };
  812.  
  813. struct wimp_message_window_info
  814.    {  wimp_w w;
  815.       int reserved;
  816.       char sprite_name [8];
  817.       char title [20];
  818.    };
  819.  
  820. struct wimp_message_font_changed
  821.    {  font_f font;
  822.    };
  823.  
  824. struct wimp_message
  825.    {  int size;
  826.       wimp_t sender;
  827.       int my_ref;
  828.       int your_ref;
  829.       bits action;
  830.       union
  831.       {  wimp_message_data_xfer data_xfer;
  832.          wimp_message_ram_xfer ram_xfer;
  833.          wimp_message_prequit prequit;
  834.          wimp_message_save_desktop save_desktop;
  835.          wimp_message_device device;
  836.          wimp_message_data_saved data_saved;
  837.          wimp_message_shutdown shutdown;
  838.          wimp_message_claim_entity claim_entity;
  839.          wimp_message_data_request data_request;
  840.          wimp_message_dragging dragging;
  841.          wimp_message_drag_claim drag_claim;
  842.          byte reserved [236];
  843.       }
  844.       data;
  845.    };
  846.  
  847. union wimp_block
  848.    {  wimp_draw redraw;
  849.       wimp_open open;
  850.       wimp_close close;
  851.       wimp_leaving leaving;
  852.       wimp_entering entering;
  853.       wimp_pointer pointer;
  854.       wimp_dragged dragged;
  855.       wimp_key key;
  856.       wimp_selection selection;
  857.       wimp_scroll scroll;
  858.       wimp_caret caret;
  859.       wimp_pollword pollword;
  860.       wimp_message message;
  861.       byte reserved [256];
  862.    };
  863.  
  864. struct wimp_message_list
  865.    {  int messages [UNKNOWN];
  866.    };
  867.  
  868. #define wimp_MESSAGE_LIST(N) \
  869.    struct \
  870.       {  int messages [N]; \
  871.       }
  872.  
  873. #define wimp_SIZEOF_MESSAGE_LIST(N) \
  874.    ((N)*sizeof ((wimp_message_list *) NULL)->messages)
  875.  
  876. /************************
  877.  * Constant definitions *
  878.  ************************/
  879. #define wimp_VERSION_RO2                        200
  880. #define wimp_VERSION_RO3                        310
  881. #define wimp_ICON_NAME_LIMIT                    12
  882. #define wimp_TEMPLATE_NAME_LIMIT                12
  883. #define wimp_MENU_NAME_LIMIT                    12
  884. #define wimp_MENU_DEPTH_LIMIT                   8
  885. #define wimp_CHAR_XSIZE                         16
  886. #define wimp_CHAR_YSIZE                         32
  887. #define wimp_NULL_REASON_CODE                   0
  888. #define wimp_REDRAW_WINDOW_REQUEST              1
  889. #define wimp_OPEN_WINDOW_REQUEST                2
  890. #define wimp_CLOSE_WINDOW_REQUEST               3
  891. #define wimp_POINTER_LEAVING_WINDOW             4
  892. #define wimp_POINTER_ENTERING_WINDOW            5
  893. #define wimp_MOUSE_CLICK                        6
  894. #define wimp_USER_DRAG_BOX                      7
  895. #define wimp_KEY_PRESSED                        8
  896. #define wimp_MENU_SELECTION                     9
  897. #define wimp_SCROLL_REQUEST                     10
  898. #define wimp_LOSE_CARET                         11
  899. #define wimp_GAIN_CARET                         12
  900. #define wimp_POLLWORD_NON_ZERO                  13
  901. #define wimp_USER_MESSAGE                       17
  902. #define wimp_USER_MESSAGE_RECORDED              18
  903. #define wimp_USER_MESSAGE_ACKNOWLEDGE           19
  904. #define wimp_POLL_WORD                          22
  905. #define wimp_POLLWORD_PRIORITY                  23
  906. #define wimp_FP                                 24
  907. #define wimp_MASK_NULL                          0x1u
  908. #define wimp_QUEUE_REDRAW                       0x2u
  909. #define wimp_MASK_LEAVING                       0x10u
  910. #define wimp_MASK_ENTERING                      0x20u
  911. #define wimp_QUEUE_MOUSE                        0x40u
  912. #define wimp_QUEUE_KEY                          0x100u
  913. #define wimp_MASK_LOSE                          0x800u
  914. #define wimp_MASK_GAIN                          0x1000u
  915. #define wimp_MASK_POLLWORD                      0x2000u
  916. #define wimp_MASK_MESSAGE                       0x20000u
  917. #define wimp_MASK_RECORDED                      0x40000u
  918. #define wimp_MASK_ACKNOWLEDGE                   0x80000u
  919. #define wimp_GIVEN_POLLWORD                     0x400000u
  920. #define wimp_POLL_HIGH_PRIORITY                 0x800000u
  921. #define wimp_SAVE_FP                            0x1000000u
  922. #define wimp_BROADCAST                          ((wimp_t) 0)
  923. #define wimp_BACKGROUND                         ((wimp_w) -1)
  924. #define wimp_ICON_BAR                           ((wimp_w) -2)
  925. #define wimp_ICON_BAR_RIGHT                     ((wimp_w) -1)
  926. #define wimp_ICON_BAR_LEFT                      ((wimp_w) -2)
  927. #define wimp_ICON_BAR_LEFT_RELATIVE             ((wimp_w) -3)
  928. #define wimp_ICON_BAR_RIGHT_RELATIVE            ((wimp_w) -4)
  929. #define wimp_ICON_BAR_LEFT_HIGH_PRIORITY        ((wimp_w) -5)
  930. #define wimp_ICON_BAR_LEFT_LOW_PRIORITY         ((wimp_w) -6)
  931. #define wimp_ICON_BAR_RIGHT_LOW_PRIORITY        ((wimp_w) -7)
  932. #define wimp_ICON_BAR_RIGHT_HIGH_PRIORITY       ((wimp_w) -8)
  933. #define wimp_TOP                                ((wimp_w) -1)
  934. #define wimp_BOTTOM                             ((wimp_w) -2)
  935. #define wimp_NO_ICON                            ((wimp_w) -1)
  936. #define wimp_ICON_WINDOW                        ((wimp_i) -1)
  937. #define wimp_ICON_BACK                          ((wimp_i) -2)
  938. #define wimp_ICON_CLOSE                         ((wimp_i) -3)
  939. #define wimp_ICON_TITLE                         ((wimp_i) -4)
  940. #define wimp_ICON_TOGGLE                        ((wimp_i) -5)
  941. #define wimp_ICON_SCROLL_UP                     ((wimp_i) -6)
  942. #define wimp_ICON_VSCROLL                       ((wimp_i) -7)
  943. #define wimp_ICON_SCROLL_DOWN                   ((wimp_i) -8)
  944. #define wimp_ICON_SIZE                          ((wimp_i) -9)
  945. #define wimp_ICON_SCROLL_LEFT                   ((wimp_i) -10)
  946. #define wimp_ICON_HSCROLL                       ((wimp_i) -11)
  947. #define wimp_ICON_SCROLL_RIGHT                  ((wimp_i) -12)
  948. #define wimp_ICON_FRAME                         ((wimp_i) -13)
  949. #define wimp_WINDOW_MOVEABLE                    0x2u
  950. #define wimp_WINDOW_AUTO_REDRAW                 0x10u
  951. #define wimp_WINDOW_PANE                        0x20u
  952. #define wimp_WINDOW_NO_BOUNDS                   0x40u
  953. #define wimp_WINDOW_SCROLL_REPEAT               0x100u
  954. #define wimp_WINDOW_SCROLL                      0x200u
  955. #define wimp_WINDOW_REAL_COLOURS                0x400u
  956. #define wimp_WINDOW_BACK                        0x800u
  957. #define wimp_WINDOW_HOT_KEYS                    0x1000u
  958. #define wimp_WINDOW_BOUNDED                     0x2000u
  959. #define wimp_WINDOW_IGNORE_XEXTENT              0x4000u
  960. #define wimp_WINDOW_IGNORE_YEXTENT              0x8000u
  961. #define wimp_WINDOW_OPEN                        0x10000u
  962. #define wimp_WINDOW_NOT_COVERED                 0x20000u
  963. #define wimp_WINDOW_FULL_SIZE                   0x40000u
  964. #define wimp_WINDOW_TOGGLED                     0x80000u
  965. #define wimp_WINDOW_HAS_FOCUS                   0x100000u
  966. #define wimp_WINDOW_BOUNDED_ONCE                0x200000u
  967. #define wimp_WINDOW_BACK_ICON                   0x1000000u
  968. #define wimp_WINDOW_CLOSE_ICON                  0x2000000u
  969. #define wimp_WINDOW_TITLE_ICON                  0x4000000u
  970. #define wimp_WINDOW_TOGGLE_ICON                 0x8000000u
  971. #define wimp_WINDOW_VSCROLL                     0x10000000u
  972. #define wimp_WINDOW_SIZE_ICON                   0x20000000u
  973. #define wimp_WINDOW_HSCROLL                     0x40000000u
  974. #define wimp_WINDOW_NEW_FORMAT                  0x80000000u
  975. #define wimp_ICON_TEXT                          0x1u
  976. #define wimp_ICON_SPRITE                        0x2u
  977. #define wimp_ICON_BORDER                        0x4u
  978. #define wimp_ICON_HCENTRED                      0x8u
  979. #define wimp_ICON_VCENTRED                      0x10u
  980. #define wimp_ICON_FILLED                        0x20u
  981. #define wimp_ICON_ANTI_ALIASED                  0x40u
  982. #define wimp_ICON_NEEDS_HELP                    0x80u
  983. #define wimp_ICON_INDIRECTED                    0x100u
  984. #define wimp_ICON_RJUSTIFIED                    0x200u
  985. #define wimp_ICON_ALLOW_ADJUST                  0x400u
  986. #define wimp_ICON_HALF_SIZE                     0x800u
  987. #define wimp_ICON_BUTTON_TYPE_SHIFT             12
  988. #define wimp_ICON_BUTTON_TYPE                   0xF000u
  989. #define wimp_ICON_ESG_SHIFT                     16
  990. #define wimp_ICON_ESG                           0x1F0000u
  991. #define wimp_ICON_SELECTED                      0x200000u
  992. #define wimp_ICON_SHADED                        0x400000u
  993. #define wimp_ICON_DELETED                       0x800000u
  994. #define wimp_ICON_FG_COLOUR_SHIFT               24
  995. #define wimp_ICON_FG_COLOUR                     0xF000000u
  996. #define wimp_ICON_BG_COLOUR_SHIFT               28
  997. #define wimp_ICON_BG_COLOUR                     0xF0000000u
  998. #define wimp_ICON_FONT_HANDLE_SHIFT             24
  999. #define wimp_ICON_FONT_HANDLE                   0xFF000000u
  1000. #define wimp_BUTTON_NEVER                       0
  1001. #define wimp_BUTTON_ALWAYS                      1
  1002. #define wimp_BUTTON_REPEAT                      2
  1003. #define wimp_BUTTON_CLICK                       3
  1004. #define wimp_BUTTON_RELEASE                     4
  1005. #define wimp_BUTTON_DOUBLE_CLICK                5
  1006. #define wimp_BUTTON_CLICK_DRAG                  6
  1007. #define wimp_BUTTON_RELEASE_DRAG                7
  1008. #define wimp_BUTTON_DOUBLE_DRAG                 8
  1009. #define wimp_BUTTON_MENU_ICON                   9
  1010. #define wimp_BUTTON_DOUBLE_CLICK_DRAG           10
  1011. #define wimp_BUTTON_RADIO                       11
  1012. #define wimp_BUTTON_WRITE_CLICK_DRAG            14
  1013. #define wimp_BUTTON_WRITABLE                    15
  1014. #define wimp_MENU_TICKED                        0x1u
  1015. #define wimp_MENU_SEPARATE                      0x2u
  1016. #define wimp_MENU_WRITABLE                      0x4u
  1017. #define wimp_MENU_GIVE_WARNING                  0x8u
  1018. #define wimp_MENU_SUB_MENU_WHEN_SHADED          0x10u
  1019. #define wimp_MENU_LAST                          0x80u
  1020. #define wimp_MENU_TITLE_INDIRECTED              0x100u
  1021. #define wimp_CLOSE_MENU                         ((wimp_menu *) -1)
  1022. #define wimp_NO_SUB_MENU                        ((wimp_menu *) -1)
  1023. #define wimp_DEFER_SUB_MENU                     ((wimp_menu *) 1)
  1024. #define wimp_NO_FONTS                           ((font_f *) -1)
  1025. #define wimp_CLICK_ADJUST                       0x1u
  1026. #define wimp_DOUBLE_ADJUST                      0x1u
  1027. #define wimp_CLICK_MENU                         0x2u
  1028. #define wimp_CLICK_SELECT                       0x4u
  1029. #define wimp_DOUBLE_SELECT                      0x4u
  1030. #define wimp_DRAG_ADJUST                        0x10u
  1031. #define wimp_DRAG_SELECT                        0x40u
  1032. #define wimp_SINGLE_ADJUST                      0x100u
  1033. #define wimp_SINGLE_SELECT                      0x400u
  1034. #define wimp_MENU_ITEM_HEIGHT                   44
  1035. #define wimp_MENU_ITEM_GAP                      0
  1036. #define wimp_MENU_ITEM_SEPARATION               24
  1037. #define wimp_DRAG_SYSTEM_POSITION               1
  1038. #define wimp_DRAG_SYSTEM_SIZE                   2
  1039. #define wimp_DRAG_SYSTEM_HSCROLL                3
  1040. #define wimp_DRAG_SYSTEM_VSCROLL                4
  1041. #define wimp_DRAG_USER_FIXED                    5
  1042. #define wimp_DRAG_USER_RUBBER                   6
  1043. #define wimp_DRAG_USER_POINT                    7
  1044. #define wimp_DRAG_ASM_FIXED                     8
  1045. #define wimp_DRAG_ASM_RUBBER                    9
  1046. #define wimp_DRAG_ASM_FIXED_INDEFINITE          10
  1047. #define wimp_DRAG_ASM_RUBBER_INDEFINITE         11
  1048. #define wimp_DRAG_SYSTEM_SCROLL_BOTH            12
  1049. #define wimp_KEY_BACKSPACE                      8
  1050. #define wimp_KEY_RETURN                         13
  1051. #define wimp_KEY_ESCAPE                         27
  1052. #define wimp_KEY_HOME                           30
  1053. #define wimp_KEY_DELETE                         127
  1054. #define wimp_KEY_SHIFT                          16
  1055. #define wimp_KEY_CONTROL                        32
  1056. #define wimp_KEY_PRINT                          384
  1057. #define wimp_KEY_F1                             385
  1058. #define wimp_KEY_F2                             386
  1059. #define wimp_KEY_F3                             387
  1060. #define wimp_KEY_F4                             388
  1061. #define wimp_KEY_F5                             389
  1062. #define wimp_KEY_F6                             390
  1063. #define wimp_KEY_F7                             391
  1064. #define wimp_KEY_F8                             392
  1065. #define wimp_KEY_F9                             393
  1066. #define wimp_KEY_TAB                            394
  1067. #define wimp_KEY_COPY                           395
  1068. #define wimp_KEY_LEFT                           396
  1069. #define wimp_KEY_RIGHT                          397
  1070. #define wimp_KEY_F10                            458
  1071. #define wimp_KEY_F11                            459
  1072. #define wimp_KEY_F12                            460
  1073. #define wimp_KEY_INSERT                         461
  1074. #define wimp_KEY_DOWN                           398
  1075. #define wimp_KEY_UP                             399
  1076. #define wimp_KEY_PAGE_DOWN                      414
  1077. #define wimp_KEY_PAGE_UP                        415
  1078. #define message_QUIT                            0x0u
  1079. #define message_DATA_SAVE                       0x1u
  1080. #define message_DATA_SAVE_ACK                   0x2u
  1081. #define message_DATA_LOAD                       0x3u
  1082. #define message_DATA_LOAD_ACK                   0x4u
  1083. #define message_DATA_OPEN                       0x5u
  1084. #define message_RAM_FETCH                       0x6u
  1085. #define message_RAM_TRANSMIT                    0x7u
  1086. #define message_PREQUIT                         0x8u
  1087. #define message_PALETTE_CHANGE                  0x9u
  1088. #define message_SAVE_DESKTOP                    0xAu
  1089. #define message_DEVICE_CLAIM                    0xBu
  1090. #define message_DEVICE_IN_USE                   0xCu
  1091. #define message_DATA_SAVED                      0xDu
  1092. #define message_SHUTDOWN                        0xEu
  1093. #define message_CLAIM_ENTITY                    0xFu
  1094. #define message_DATA_REQUEST                    0x10u
  1095. #define message_DRAGGING                        0x11u
  1096. #define message_DRAG_CLAIM                      0x12u
  1097. #define message_MENU_WARNING                    0x400C0u
  1098. #define message_MODE_CHANGE                     0x400C1u
  1099. #define message_TASK_INITIALISE                 0x400C2u
  1100. #define message_TASK_CLOSE_DOWN                 0x400C3u
  1101. #define message_SLOT_SIZE                       0x400C4u
  1102. #define message_SET_SLOT                        0x400C5u
  1103. #define message_TASK_NAME_RQ                    0x400C6u
  1104. #define message_TASK_NAME_IS                    0x400C7u
  1105. #define message_TASK_STARTED                    0x400C8u
  1106. #define message_MENUS_DELETED                   0x400C9u
  1107. #define message_ICONISE                         0x400CAu
  1108. #define message_WINDOW_CLOSED                   0x400CBu
  1109. #define message_WINDOW_INFO                     0x400CCu
  1110. #define message_SWAP                            0x400CDu
  1111. #define message_TOOLS_CHANGED                   0x400CEu
  1112. #define message_FONT_CHANGED                    0x400CFu
  1113. #define wimp_ERROR_BOX_OK_ICON                  0x1u
  1114. #define wimp_ERROR_BOX_CANCEL_ICON              0x2u
  1115. #define wimp_ERROR_BOX_HIGHLIGHT_CANCEL         0x4u
  1116. #define wimp_ERROR_BOX_NO_PROMPT                0x8u
  1117. #define wimp_ERROR_BOX_SHORT_TITLE              0x10u
  1118. #define wimp_ERROR_BOX_LEAVE_OPEN               0x20u
  1119. #define wimp_ERROR_BOX_CLOSE                    0x40u
  1120. #define wimp_ERROR_BOX_NO_BEEP                  0x80u
  1121. #define wimp_ERROR_BOX_GIVEN_CATEGORY           0x100u
  1122. #define wimp_ERROR_BOX_CATEGORY                 0xE00u
  1123. #define wimp_ERROR_BOX_CATEGORY_SHIFT           9
  1124. #define wimp_ERROR_BOX_CATEGORY_INFO            0x1u
  1125. #define wimp_ERROR_BOX_CATEGORY_ERROR           0x2u
  1126. #define wimp_ERROR_BOX_CATEGORY_PROGRAM         0x3u
  1127. #define wimp_ERROR_BOX_CATEGORY_QUESTION        0x4u
  1128. #define wimp_ERROR_BOX_SELECTED_NOTHING         0
  1129. #define wimp_ERROR_BOX_SELECTED_OK              1
  1130. #define wimp_ERROR_BOX_SELECTED_CANCEL          2
  1131. #define wimp_COLOUR_WHITE                       ((wimp_colour) 0)
  1132. #define wimp_COLOUR_VERY_LIGHT_GREY             ((wimp_colour) 1)
  1133. #define wimp_COLOUR_LIGHT_GREY                  ((wimp_colour) 2)
  1134. #define wimp_COLOUR_MID_LIGHT_GREY              ((wimp_colour) 3)
  1135. #define wimp_COLOUR_MID_DARK_GREY               ((wimp_colour) 4)
  1136. #define wimp_COLOUR_DARK_GREY                   ((wimp_colour) 5)
  1137. #define wimp_COLOUR_VERY_DARK_GREY              ((wimp_colour) 6)
  1138. #define wimp_COLOUR_BLACK                       ((wimp_colour) 7)
  1139. #define wimp_COLOUR_DARK_BLUE                   ((wimp_colour) 8)
  1140. #define wimp_COLOUR_YELLOW                      ((wimp_colour) 9)
  1141. #define wimp_COLOUR_LIGHT_GREEN                 ((wimp_colour) 10)
  1142. #define wimp_COLOUR_RED                         ((wimp_colour) 11)
  1143. #define wimp_COLOUR_CREAM                       ((wimp_colour) 12)
  1144. #define wimp_COLOUR_DARK_GREEN                  ((wimp_colour) 13)
  1145. #define wimp_COLOUR_ORANGE                      ((wimp_colour) 14)
  1146. #define wimp_COLOUR_LIGHT_BLUE                  ((wimp_colour) 15)
  1147. #define wimp_COLOUR_TRANSPARENT                 ((wimp_colour) -1)
  1148. #define error_WIMP_NO_CLAIM                     0x280u
  1149. #define error_WIMP_BAD_OP                       0x281u
  1150. #define error_WIMP_RECT_FULL                    0x282u
  1151. #define error_WIMP_TOO_MANY                     0x283u
  1152. #define error_WIMP_TOO_BIG                      0x284u
  1153. #define error_WIMP_DIV_BY0                      0x285u
  1154. #define error_WIMP_GET_RECT                     0x286u
  1155. #define error_WIMP_FOCUS                        0x287u
  1156. #define error_WIMP_BAD_HANDLE                   0x288u
  1157. #define error_WIMP_TOO_MENUS                    0x289u
  1158. #define error_WIMP_BAD_EXTENT                   0x28Au
  1159. #define error_WIMP_BAD_POINTER                  0x28Bu
  1160. #define error_WIMP_NO_TEMPLATE_FILE             0x28Cu
  1161. #define error_WIMP_BAD_TEMPLATE                 0x28Du
  1162. #define error_WIMP_BAD_FONTS                    0x28Eu
  1163. #define error_WIMP_BAD_SYNTAX                   0x28Fu
  1164. #define error_WIMP_NO_TASKS                     0x290u
  1165. #define error_WIMP_NO_TEMPLATE                  0x291u
  1166. #define error_WIMP_NOT_PRESENT                  0x292u
  1167. #define error_WIMP_IN_USE                       0x293u
  1168. #define error_WIMP_BAD_PAL_FILE                 0x294u
  1169. #define error_WIMP_BAD_VERSION                  0x295u
  1170. #define error_WIMP_BAD_MESSAGE_SIZE             0x296u
  1171. #define error_WIMP_BAD_REASON_CODE              0x297u
  1172. #define error_WIMP_BAD_TASK_HANDLE              0x298u
  1173. #define error_WIMP_CANT_TASK                    0x299u
  1174. #define error_WIMP_BAD_SUB_MENU                 0x29Au
  1175. #define error_WIMP_OWNER_WINDOW                 0x29Bu
  1176. #define error_WIMP_BAD_MODE                     0x29Cu
  1177. #define error_WIMP_BAD_TRANSFER                 0x29Du
  1178. #define error_WIMP_BAD_SYS_INFO                 0x29Eu
  1179. #define error_WIMP_BAD_PTR_IN_R1                0x29Fu
  1180. #define error_WIMP_BAD_ESCAPE_STATE             0x2A0u
  1181. #define error_WIMP_BAD_ICON_HANDLE              0x2A1u
  1182. #define error_WIMP_BAD_R3                       0x2A2u
  1183. #define error_WIMP_NO_DOT_IN_FILENAME           0x2A3u
  1184. #define error_WIMP_TEMPLATE_EOF                 0x2A4u
  1185. #define error_WIMP_BAD_SLOT                     0x2A5u
  1186. #define error_WIMP_BAD_CONF_FONT                0x2A6u
  1187. #define error_WIMP_NO_SPRITES                   0x2A7u
  1188. #define error_WIMP_BAD_PAL_FILE2                0x2A8u
  1189. #define error_WIMP_BAD_SPRITES                  0x2A9u
  1190. #define wimp_PRIORITY_TASK_MANAGER              0x60000000u
  1191. #define wimp_PRIORITY_PALETTE_UTILITY           0x20000000u
  1192. #define wimp_PRIORITY_ADFS_FILER_HARD_DISCS     0x70000000u
  1193. #define wimp_PRIORITY_ADFS_FILER_FLOPPY_DISCS   0x60000000u
  1194. #define wimp_PRIORITY_RESOURCE_FILER            0x50000000u
  1195. #define wimp_PRIORITY_RAMFS_FILER               0x40000000u
  1196. #define wimp_PRIORITY_NFS_FILER                 0x30000000u
  1197. #define wimp_PRIORITY_NET_FILER                 0x20000000u
  1198. #define wimp_PRIORITY_PRINTERS                  0xF000000u
  1199. #define wimp_PRIORITY_TINY_DIRS                 0xC0000000u
  1200. #define wimp_DEFAULT_PALETTE                    ((os_palette *) -1)
  1201. #define wimp_PALETTE                            ((os_palette *) 0)
  1202. #define wimptextop_RJUSTIFY                     0x40000000u
  1203. #define wimptextop_GIVEN_BASELINE               0x80000000u
  1204.  
  1205. /*************************
  1206.  * Function declarations *
  1207.  *************************/
  1208.  
  1209. #ifdef __cplusplus
  1210.    extern "C" {
  1211. #endif
  1212.  
  1213. /*************************************************************
  1214.  * NOTE: The following functions provide direct access to    *
  1215.  *       the SWI's noted in the function description.        *
  1216.  *       Please read the relevant PRM section for more       *
  1217.  *       information on their input/output parameters.       *
  1218.  *************************************************************/
  1219.  
  1220. /* ------------------------------------------------------------------------
  1221.  * Function:      wimp_initialise()
  1222.  *
  1223.  * Description:   Registers a task with the Wimp
  1224.  *
  1225.  * Input:         version - value of R0 on entry
  1226.  *                name - value of R2 on entry
  1227.  *                messages - value of R3 on entry
  1228.  *
  1229.  * Output:        version_out - value of R0 on exit
  1230.  *                task_out - value of R1 on exit (X version only)
  1231.  *
  1232.  * Returns:       R1 (non-X version only)
  1233.  *
  1234.  * Other notes:   Calls SWI 0x400C0 with R1 = 0x4B534154.
  1235.  */
  1236.  
  1237. extern os_error *xwimp_initialise (int version,
  1238.       char *name,
  1239.       wimp_message_list *messages,
  1240.       int *version_out,
  1241.       wimp_t *task_out);
  1242. extern wimp_t wimp_initialise (int version,
  1243.       char *name,
  1244.       wimp_message_list *messages,
  1245.       int *version_out);
  1246.  
  1247. /* ------------------------------------------------------------------------
  1248.  * Function:      wimp_create_window()
  1249.  *
  1250.  * Description:   Tells the Wimp what the characteristics of a window are
  1251.  *
  1252.  * Input:         window - value of R1 on entry
  1253.  *
  1254.  * Output:        w - value of R0 on exit (X version only)
  1255.  *
  1256.  * Returns:       R0 (non-X version only)
  1257.  *
  1258.  * Other notes:   Calls SWI 0x400C1.
  1259.  */
  1260.  
  1261. extern os_error *xwimp_create_window (wimp_window *window,
  1262.       wimp_w *w);
  1263. extern wimp_w wimp_create_window (wimp_window *window);
  1264.  
  1265. /* ------------------------------------------------------------------------
  1266.  * Function:      wimp_create_icon()
  1267.  *
  1268.  * Description:   Tells the Wimp what the characteristics of an icon are
  1269.  *
  1270.  * Input:         icon - value of R1 on entry
  1271.  *
  1272.  * Output:        i - value of R0 on exit (X version only)
  1273.  *
  1274.  * Returns:       R0 (non-X version only)
  1275.  *
  1276.  * Other notes:   Calls SWI 0x400C2.
  1277.  */
  1278.  
  1279. extern os_error *xwimp_create_icon (wimp_icon_create *icon,
  1280.       wimp_i *i);
  1281. extern wimp_i wimp_create_icon (wimp_icon_create *icon);
  1282.  
  1283. /* ------------------------------------------------------------------------
  1284.  * Function:      wimp_create_icon_relative()
  1285.  *
  1286.  * Description:   Tells the Wimp what the characteristics of an iconbar
  1287.  *                icon with a fixed relative position are
  1288.  *
  1289.  * Input:         neighbour - value of R0 on entry
  1290.  *                icon - value of R1 on entry
  1291.  *
  1292.  * Output:        i - value of R0 on exit (X version only)
  1293.  *
  1294.  * Returns:       R0 (non-X version only)
  1295.  *
  1296.  * Other notes:   Calls SWI 0x400C2.
  1297.  */
  1298.  
  1299. extern os_error *xwimp_create_icon_relative (wimp_i neighbour,
  1300.       wimp_icon_create *icon,
  1301.       wimp_i *i);
  1302. extern wimp_i wimp_create_icon_relative (wimp_i neighbour,
  1303.       wimp_icon_create *icon);
  1304.  
  1305. /* ------------------------------------------------------------------------
  1306.  * Function:      wimp_create_icon_prioritised()
  1307.  *
  1308.  * Description:   Tells the Wimp what the characteristics of an iconbar
  1309.  *                icon with a fixed priority are
  1310.  *
  1311.  * Input:         priority - value of R0 on entry
  1312.  *                icon - value of R1 on entry
  1313.  *
  1314.  * Output:        i - value of R0 on exit (X version only)
  1315.  *
  1316.  * Returns:       R0 (non-X version only)
  1317.  *
  1318.  * Other notes:   Calls SWI 0x400C2.
  1319.  */
  1320.  
  1321. extern os_error *xwimp_create_icon_prioritised (int priority,
  1322.       wimp_icon_create *icon,
  1323.       wimp_i *i);
  1324. extern wimp_i wimp_create_icon_prioritised (int priority,
  1325.       wimp_icon_create *icon);
  1326.  
  1327. /* ------------------------------------------------------------------------
  1328.  * Function:      wimp_delete_window()
  1329.  *
  1330.  * Description:   Closes a specified window if it is still open, and then
  1331.  *                removes its definition
  1332.  *
  1333.  * Input:         w - component 0
  1334.  *
  1335.  * Other notes:   Calls SWI 0x400C3.
  1336.  */
  1337.  
  1338. extern os_error *xwimp_delete_window (wimp_w w);
  1339. extern void wimp_delete_window (wimp_w w);
  1340.  
  1341. /* ------------------------------------------------------------------------
  1342.  * Function:      wimp_delete_icon()
  1343.  *
  1344.  * Description:   Removes the definition of a specified icon
  1345.  *
  1346.  * Input:         w - component 0
  1347.  *                i - component 1
  1348.  *
  1349.  * Other notes:   Calls SWI 0x400C4.
  1350.  */
  1351.  
  1352. extern os_error *xwimp_delete_icon (wimp_w w,
  1353.       wimp_i i);
  1354. extern void wimp_delete_icon (wimp_w w,
  1355.       wimp_i i);
  1356.  
  1357. /* ------------------------------------------------------------------------
  1358.  * Function:      wimp_open_window()
  1359.  *
  1360.  * Description:   Updates the list of active windows (ones that are to be
  1361.  *                displayed)
  1362.  *
  1363.  * Input:         open - value of R1 on entry
  1364.  *
  1365.  * Other notes:   Calls SWI 0x400C5.
  1366.  */
  1367.  
  1368. extern os_error *xwimp_open_window (wimp_open *open);
  1369. extern void wimp_open_window (wimp_open *open);
  1370.  
  1371. /* ------------------------------------------------------------------------
  1372.  * Function:      wimp_close_window()
  1373.  *
  1374.  * Description:   Removes the specified window from the active list
  1375.  *
  1376.  * Input:         w - component 0
  1377.  *
  1378.  * Other notes:   Calls SWI 0x400C6.
  1379.  */
  1380.  
  1381. extern os_error *xwimp_close_window (wimp_w w);
  1382. extern void wimp_close_window (wimp_w w);
  1383.  
  1384. /* ------------------------------------------------------------------------
  1385.  * Function:      wimp_poll()
  1386.  *
  1387.  * Description:   Polls the Wimp to see whether certain events have
  1388.  *                occurred
  1389.  *
  1390.  * Input:         mask - value of R0 on entry
  1391.  *                block - value of R1 on entry
  1392.  *                pollword - value of R3 on entry
  1393.  *
  1394.  * Output:        event - value of R0 on exit (X version only)
  1395.  *
  1396.  * Returns:       R0 (non-X version only)
  1397.  *
  1398.  * Other notes:   Calls SWI 0x400C7.
  1399.  */
  1400.  
  1401. extern os_error *xwimp_poll (bits mask,
  1402.       wimp_block *block,
  1403.       int *pollword,
  1404.       int *event);
  1405. extern int wimp_poll (bits mask,
  1406.       wimp_block *block,
  1407.       int *pollword);
  1408.  
  1409. /* ------------------------------------------------------------------------
  1410.  * Function:      wimp_redraw_window()
  1411.  *
  1412.  * Description:   Starts a redraw of the parts of a window that are not up
  1413.  *                to date
  1414.  *
  1415.  * Input:         redraw - value of R1 on entry
  1416.  *
  1417.  * Output:        more - value of R0 on exit (X version only)
  1418.  *
  1419.  * Returns:       R0 (non-X version only)
  1420.  *
  1421.  * Other notes:   Calls SWI 0x400C8.
  1422.  */
  1423.  
  1424. extern os_error *xwimp_redraw_window (wimp_draw *redraw,
  1425.       bool *more);
  1426. extern bool wimp_redraw_window (wimp_draw *redraw);
  1427.  
  1428. /* ------------------------------------------------------------------------
  1429.  * Function:      wimp_update_window()
  1430.  *
  1431.  * Description:   Starts a redraw of the parts of a window that are up to
  1432.  *                date
  1433.  *
  1434.  * Input:         update - value of R1 on entry
  1435.  *
  1436.  * Output:        more - value of R0 on exit (X version only)
  1437.  *
  1438.  * Returns:       R0 (non-X version only)
  1439.  *
  1440.  * Other notes:   Calls SWI 0x400C9.
  1441.  */
  1442.  
  1443. extern os_error *xwimp_update_window (wimp_draw *update,
  1444.       bool *more);
  1445. extern bool wimp_update_window (wimp_draw *update);
  1446.  
  1447. /* ------------------------------------------------------------------------
  1448.  * Function:      wimp_get_rectangle()
  1449.  *
  1450.  * Description:   Returns the details of the next rectangle of the work
  1451.  *                area to be drawn
  1452.  *
  1453.  * Input:         draw - value of R1 on entry
  1454.  *
  1455.  * Output:        more - value of R0 on exit (X version only)
  1456.  *
  1457.  * Returns:       R0 (non-X version only)
  1458.  *
  1459.  * Other notes:   Calls SWI 0x400CA.
  1460.  */
  1461.  
  1462. extern os_error *xwimp_get_rectangle (wimp_draw *draw,
  1463.       bool *more);
  1464. extern bool wimp_get_rectangle (wimp_draw *draw);
  1465.  
  1466. /* ------------------------------------------------------------------------
  1467.  * Function:      wimp_get_window_state()
  1468.  *
  1469.  * Description:   Returns a summary of the given window's state
  1470.  *
  1471.  * Input:         state - value of R1 on entry
  1472.  *
  1473.  * Other notes:   Calls SWI 0x400CB.
  1474.  */
  1475.  
  1476. extern os_error *xwimp_get_window_state (wimp_window_state *state);
  1477. extern void wimp_get_window_state (wimp_window_state *state);
  1478.  
  1479. /* ------------------------------------------------------------------------
  1480.  * Function:      wimp_get_window_info()
  1481.  *
  1482.  * Description:   Returns complete details of the given window's state
  1483.  *
  1484.  * Input:         info - value of R1 on entry
  1485.  *
  1486.  * Other notes:   Calls SWI 0x400CC.
  1487.  */
  1488.  
  1489. extern os_error *xwimp_get_window_info (wimp_window_info *info);
  1490. extern void wimp_get_window_info (wimp_window_info *info);
  1491.  
  1492. /* ------------------------------------------------------------------------
  1493.  * Function:      wimp_get_window_info_header_only()
  1494.  *
  1495.  * Description:   Returns complete details of the given window's state,
  1496.  *                excluding icons
  1497.  *
  1498.  * Input:         info - value of R1 on entry
  1499.  *
  1500.  * Other notes:   Calls SWI 0x400CC with R1 |= 0x1.
  1501.  */
  1502.  
  1503. extern os_error *xwimp_get_window_info_header_only (wimp_window_info *info);
  1504. extern void wimp_get_window_info_header_only (wimp_window_info *info);
  1505.  
  1506. /* ------------------------------------------------------------------------
  1507.  * Function:      wimp_set_icon_state()
  1508.  *
  1509.  * Description:   Sets a given icon's state held in its flags word
  1510.  *
  1511.  * Input:         w - component 0
  1512.  *                i - component 1
  1513.  *                eor_bits - component 2
  1514.  *                clear_bits - component 3
  1515.  *
  1516.  * Other notes:   Calls SWI 0x400CD.
  1517.  */
  1518.  
  1519. extern os_error *xwimp_set_icon_state (wimp_w w,
  1520.       wimp_i i,
  1521.       bits eor_bits,
  1522.       bits clear_bits);
  1523. extern void wimp_set_icon_state (wimp_w w,
  1524.       wimp_i i,
  1525.       bits eor_bits,
  1526.       bits clear_bits);
  1527.  
  1528. /* ------------------------------------------------------------------------
  1529.  * Function:      wimp_get_icon_state()
  1530.  *
  1531.  * Description:   Returns a given icon's state held in its flags word
  1532.  *
  1533.  * Input:         icon_state - value of R1 on entry
  1534.  *
  1535.  * Other notes:   Calls SWI 0x400CE.
  1536.  */
  1537.  
  1538. extern os_error *xwimp_get_icon_state (wimp_icon_state *icon_state);
  1539. extern void wimp_get_icon_state (wimp_icon_state *icon_state);
  1540.  
  1541. /* ------------------------------------------------------------------------
  1542.  * Function:      wimp_get_pointer_info()
  1543.  *
  1544.  * Description:   Returns the position of the pointer and the state of the
  1545.  *                mouse buttons
  1546.  *
  1547.  * Input:         pointer - value of R1 on entry
  1548.  *
  1549.  * Other notes:   Calls SWI 0x400CF.
  1550.  */
  1551.  
  1552. extern os_error *xwimp_get_pointer_info (wimp_pointer *pointer);
  1553. extern void wimp_get_pointer_info (wimp_pointer *pointer);
  1554.  
  1555. /* ------------------------------------------------------------------------
  1556.  * Function:      wimp_drag_box()
  1557.  *
  1558.  * Description:   Initiates a dragging operation
  1559.  *
  1560.  * Input:         drag - value of R1 on entry
  1561.  *
  1562.  * Other notes:   Calls SWI 0x400D0.
  1563.  */
  1564.  
  1565. extern os_error *xwimp_drag_box (wimp_drag *drag);
  1566. extern void wimp_drag_box (wimp_drag *drag);
  1567.  
  1568. /* ------------------------------------------------------------------------
  1569.  * Function:      wimp_force_redraw()
  1570.  *
  1571.  * Description:   Forces an area of a window or the screen to be redrawn
  1572.  *                later
  1573.  *
  1574.  * Input:         w - value of R0 on entry
  1575.  *                x0 - value of R1 on entry
  1576.  *                y0 - value of R2 on entry
  1577.  *                x1 - value of R3 on entry
  1578.  *                y1 - value of R4 on entry
  1579.  *
  1580.  * Other notes:   Calls SWI 0x400D1.
  1581.  */
  1582.  
  1583. extern os_error *xwimp_force_redraw (wimp_w w,
  1584.       int x0,
  1585.       int y0,
  1586.       int x1,
  1587.       int y1);
  1588. extern void wimp_force_redraw (wimp_w w,
  1589.       int x0,
  1590.       int y0,
  1591.       int x1,
  1592.       int y1);
  1593.  
  1594. /* ------------------------------------------------------------------------
  1595.  * Function:      wimp_set_caret_position()
  1596.  *
  1597.  * Description:   Sets up the data for a new caret position, and redraws it
  1598.  *                there
  1599.  *
  1600.  * Input:         w - value of R0 on entry
  1601.  *                i - value of R1 on entry
  1602.  *                x - value of R2 on entry
  1603.  *                y - value of R3 on entry
  1604.  *                height - value of R4 on entry
  1605.  *                index - value of R5 on entry
  1606.  *
  1607.  * Other notes:   Calls SWI 0x400D2.
  1608.  */
  1609.  
  1610. extern os_error *xwimp_set_caret_position (wimp_w w,
  1611.       wimp_i i,
  1612.       int x,
  1613.       int y,
  1614.       int height,
  1615.       int index);
  1616. extern void wimp_set_caret_position (wimp_w w,
  1617.       wimp_i i,
  1618.       int x,
  1619.       int y,
  1620.       int height,
  1621.       int index);
  1622.  
  1623. /* ------------------------------------------------------------------------
  1624.  * Function:      wimp_get_caret_position()
  1625.  *
  1626.  * Description:   Returns details of the caret's state
  1627.  *
  1628.  * Input:         caret - value of R1 on entry
  1629.  *
  1630.  * Other notes:   Calls SWI 0x400D3.
  1631.  */
  1632.  
  1633. extern os_error *xwimp_get_caret_position (wimp_caret *caret);
  1634. extern void wimp_get_caret_position (wimp_caret *caret);
  1635.  
  1636. /* ------------------------------------------------------------------------
  1637.  * Function:      wimp_create_menu()
  1638.  *
  1639.  * Description:   Creates a menu structure
  1640.  *
  1641.  * Input:         menu - value of R1 on entry
  1642.  *                x - value of R2 on entry
  1643.  *                y - value of R3 on entry
  1644.  *
  1645.  * Other notes:   Calls SWI 0x400D4.
  1646.  */
  1647.  
  1648. extern os_error *xwimp_create_menu (wimp_menu *menu,
  1649.       int x,
  1650.       int y);
  1651. extern void wimp_create_menu (wimp_menu *menu,
  1652.       int x,
  1653.       int y);
  1654.  
  1655. /* ------------------------------------------------------------------------
  1656.  * Function:      wimp_decode_menu()
  1657.  *
  1658.  * Description:   Converts a numerical list of menu selections to a string
  1659.  *                containing their text
  1660.  *
  1661.  * Input:         menu - value of R1 on entry
  1662.  *                selection - value of R2 on entry
  1663.  *                decode - value of R3 on entry
  1664.  *
  1665.  * Other notes:   Calls SWI 0x400D5.
  1666.  */
  1667.  
  1668. extern os_error *xwimp_decode_menu (wimp_menu *menu,
  1669.       wimp_selection *selection,
  1670.       char *decode);
  1671. extern void wimp_decode_menu (wimp_menu *menu,
  1672.       wimp_selection *selection,
  1673.       char *decode);
  1674.  
  1675. /* ------------------------------------------------------------------------
  1676.  * Function:      wimp_which_icon()
  1677.  *
  1678.  * Description:   Searches for icons that match a given flags word
  1679.  *
  1680.  * Input:         w - value of R0 on entry
  1681.  *                which - value of R1 on entry
  1682.  *                mask - value of R2 on entry
  1683.  *                match - value of R3 on entry
  1684.  *
  1685.  * Other notes:   Calls SWI 0x400D6.
  1686.  */
  1687.  
  1688. extern os_error *xwimp_which_icon (wimp_w w,
  1689.       wimp_i *which,
  1690.       bits mask,
  1691.       bits match);
  1692. extern void wimp_which_icon (wimp_w w,
  1693.       wimp_i *which,
  1694.       bits mask,
  1695.       bits match);
  1696.  
  1697. /* ------------------------------------------------------------------------
  1698.  * Function:      wimp_set_extent()
  1699.  *
  1700.  * Description:   Sets the work area extent of a given window
  1701.  *
  1702.  * Input:         w - value of R0 on entry
  1703.  *                box - value of R1 on entry
  1704.  *
  1705.  * Other notes:   Calls SWI 0x400D7.
  1706.  */
  1707.  
  1708. extern os_error *xwimp_set_extent (wimp_w w,
  1709.       os_box *box);
  1710. extern void wimp_set_extent (wimp_w w,
  1711.       os_box *box);
  1712.  
  1713. /* ------------------------------------------------------------------------
  1714.  * Function:      wimp_set_pointer_shape()
  1715.  *
  1716.  * Description:   Sets the shape and active point of the pointer (prefer
  1717.  *                WimpSpriteOp_SetPointerShape
  1718.  *
  1719.  * Input:         shape_no - value of R0 on entry
  1720.  *                shape_data - value of R1 on entry
  1721.  *                width - value of R2 on entry
  1722.  *                height - value of R3 on entry
  1723.  *                xactive - value of R4 on entry
  1724.  *                yactive - value of R5 on entry
  1725.  *
  1726.  * Other notes:   Calls SWI 0x400D8.
  1727.  */
  1728.  
  1729. extern os_error *xwimp_set_pointer_shape (int shape_no,
  1730.       byte *shape_data,
  1731.       int width,
  1732.       int height,
  1733.       int xactive,
  1734.       int yactive);
  1735. extern void wimp_set_pointer_shape (int shape_no,
  1736.       byte *shape_data,
  1737.       int width,
  1738.       int height,
  1739.       int xactive,
  1740.       int yactive);
  1741.  
  1742. /* ------------------------------------------------------------------------
  1743.  * Function:      wimp_open_template()
  1744.  *
  1745.  * Description:   Opens a specified template file
  1746.  *
  1747.  * Input:         file_name - value of R1 on entry
  1748.  *
  1749.  * Other notes:   Calls SWI 0x400D9.
  1750.  */
  1751.  
  1752. extern os_error *xwimp_open_template (char *file_name);
  1753. extern void wimp_open_template (char *file_name);
  1754.  
  1755. /* ------------------------------------------------------------------------
  1756.  * Function:      wimp_close_template()
  1757.  *
  1758.  * Description:   Closes the currently open template file
  1759.  *
  1760.  * Other notes:   Calls SWI 0x400DA.
  1761.  */
  1762.  
  1763. extern os_error *xwimp_close_template (void);
  1764. extern void wimp_close_template (void);
  1765.  
  1766. /* ------------------------------------------------------------------------
  1767.  * Function:      wimp_load_template()
  1768.  *
  1769.  * Description:   Loads a template
  1770.  *
  1771.  * Input:         window - value of R1 on entry
  1772.  *                data - value of R2 on entry
  1773.  *                end - value of R3 on entry
  1774.  *                font_ref - value of R4 on entry
  1775.  *                name - value of R5 on entry
  1776.  *                context - value of R6 on entry
  1777.  *
  1778.  * Output:        used - value of R1 on exit
  1779.  *                data_used - value of R2 on exit
  1780.  *                context_out - value of R6 on exit (X version only)
  1781.  *
  1782.  * Returns:       R6 (non-X version only)
  1783.  *
  1784.  * Other notes:   Calls SWI 0x400DB.
  1785.  */
  1786.  
  1787. extern os_error *xwimp_load_template (wimp_window *window,
  1788.       char *data,
  1789.       char *end,
  1790.       font_f *font_ref,
  1791.       char *name,
  1792.       int context,
  1793.       int *used,
  1794.       int *data_used,
  1795.       int *context_out);
  1796. extern int wimp_load_template (wimp_window *window,
  1797.       char *data,
  1798.       char *end,
  1799.       font_f *font_ref,
  1800.       char *name,
  1801.       int context,
  1802.       int *used,
  1803.       int *data_used);
  1804.  
  1805. /* ------------------------------------------------------------------------
  1806.  * Function:      wimp_process_key()
  1807.  *
  1808.  * Description:   Creates or passes on key presses
  1809.  *
  1810.  * Input:         c - value of R0 on entry
  1811.  *
  1812.  * Other notes:   Calls SWI 0x400DC.
  1813.  */
  1814.  
  1815. extern os_error *xwimp_process_key (int c);
  1816. extern void wimp_process_key (int c);
  1817.  
  1818. /* ------------------------------------------------------------------------
  1819.  * Function:      wimp_close_down()
  1820.  *
  1821.  * Description:   Informs the Wimp that a task is about to terminate
  1822.  *
  1823.  * Input:         t - value of R0 on entry
  1824.  *
  1825.  * Other notes:   Calls SWI 0x400DD with R1 = 0x4B534154.
  1826.  */
  1827.  
  1828. extern os_error *xwimp_close_down (wimp_t t);
  1829. extern void wimp_close_down (wimp_t t);
  1830.  
  1831. /* ------------------------------------------------------------------------
  1832.  * Function:      wimp_start_task()
  1833.  *
  1834.  * Description:   Starts a 'child' task from within another program
  1835.  *
  1836.  * Input:         command - value of R0 on entry
  1837.  *
  1838.  * Output:        t - value of R0 on exit (X version only)
  1839.  *
  1840.  * Returns:       R0 (non-X version only)
  1841.  *
  1842.  * Other notes:   Calls SWI 0x400DE.
  1843.  */
  1844.  
  1845. extern os_error *xwimp_start_task (char *command,
  1846.       wimp_t *t);
  1847. extern wimp_t wimp_start_task (char *command);
  1848.  
  1849. /* ------------------------------------------------------------------------
  1850.  * Function:      wimp_report_error()
  1851.  *
  1852.  * Description:   Reports an error
  1853.  *
  1854.  * Input:         error - value of R0 on entry
  1855.  *                flags - value of R1 on entry
  1856.  *                name - value of R2 on entry
  1857.  *
  1858.  * Output:        click - value of R1 on exit (X version only)
  1859.  *
  1860.  * Returns:       R1 (non-X version only)
  1861.  *
  1862.  * Other notes:   Calls SWI 0x400DF.
  1863.  */
  1864.  
  1865. extern os_error *xwimp_report_error (os_error *error,
  1866.       bits flags,
  1867.       char *name,
  1868.       bits *click);
  1869. extern bits wimp_report_error (os_error *error,
  1870.       bits flags,
  1871.       char *name);
  1872.  
  1873. /* ------------------------------------------------------------------------
  1874.  * Function:      wimp_report_error_by_category()
  1875.  *
  1876.  * Description:   Reports an error of a given category
  1877.  *
  1878.  * Input:         error - value of R0 on entry
  1879.  *                flags - value of R1 on entry
  1880.  *                name - value of R2 on entry
  1881.  *                sprite_name - value of R3 on entry
  1882.  *                area - value of R4 on entry
  1883.  *                buttons - value of R5 on entry
  1884.  *
  1885.  * Output:        click - value of R1 on exit (X version only)
  1886.  *
  1887.  * Returns:       R1 (non-X version only)
  1888.  *
  1889.  * Other notes:   Calls SWI 0x400DF with R1 |= 0x100.
  1890.  */
  1891.  
  1892. extern os_error *xwimp_report_error_by_category (os_error *error,
  1893.       bits flags,
  1894.       char *name,
  1895.       char *sprite_name,
  1896.       osspriteop_area *area,
  1897.       char *buttons,
  1898.       bits *click);
  1899. extern bits wimp_report_error_by_category (os_error *error,
  1900.       bits flags,
  1901.       char *name,
  1902.       char *sprite_name,
  1903.       osspriteop_area *area,
  1904.       char *buttons);
  1905.  
  1906. /* ------------------------------------------------------------------------
  1907.  * Function:      wimp_get_window_outline()
  1908.  *
  1909.  * Description:   Gets the bounding box for a window
  1910.  *
  1911.  * Input:         outline - value of R1 on entry
  1912.  *
  1913.  * Other notes:   Calls SWI 0x400E0.
  1914.  */
  1915.  
  1916. extern os_error *xwimp_get_window_outline (wimp_outline *outline);
  1917. extern void wimp_get_window_outline (wimp_outline *outline);
  1918.  
  1919. /* ------------------------------------------------------------------------
  1920.  * Function:      wimp_poll_idle()
  1921.  *
  1922.  * Description:   Polls the Wimp, sleeping unless certain events have
  1923.  *                occurred
  1924.  *
  1925.  * Input:         mask - value of R0 on entry
  1926.  *                block - value of R1 on entry
  1927.  *                t - value of R2 on entry
  1928.  *                pollword - value of R3 on entry
  1929.  *
  1930.  * Output:        event - value of R0 on exit (X version only)
  1931.  *
  1932.  * Returns:       R0 (non-X version only)
  1933.  *
  1934.  * Other notes:   Calls SWI 0x400E1.
  1935.  */
  1936.  
  1937. extern os_error *xwimp_poll_idle (bits mask,
  1938.       wimp_block *block,
  1939.       os_t t,
  1940.       int *pollword,
  1941.       int *event);
  1942. extern int wimp_poll_idle (bits mask,
  1943.       wimp_block *block,
  1944.       os_t t,
  1945.       int *pollword);
  1946.  
  1947. /* ------------------------------------------------------------------------
  1948.  * Function:      wimp_plot_icon()
  1949.  *
  1950.  * Description:   Plots an icon in a window during a window redraw or
  1951.  *                update loop
  1952.  *
  1953.  * Input:         icon - value of R1 on entry
  1954.  *
  1955.  * Other notes:   Calls SWI 0x400E2.
  1956.  */
  1957.  
  1958. extern os_error *xwimp_plot_icon (wimp_icon *icon);
  1959. extern void wimp_plot_icon (wimp_icon *icon);
  1960.  
  1961. /* ------------------------------------------------------------------------
  1962.  * Function:      wimp_set_mode()
  1963.  *
  1964.  * Description:   Changes the display mode used by the Wimp
  1965.  *
  1966.  * Input:         mode - value of R0 on entry
  1967.  *
  1968.  * Other notes:   Calls SWI 0x400E3.
  1969.  */
  1970.  
  1971. extern os_error *xwimp_set_mode (os_mode mode);
  1972. extern void wimp_set_mode (os_mode mode);
  1973.  
  1974. /* ------------------------------------------------------------------------
  1975.  * Function:      wimp_set_palette()
  1976.  *
  1977.  * Description:   Sets the palette
  1978.  *
  1979.  * Input:         palette - value of R1 on entry
  1980.  *
  1981.  * Other notes:   Calls SWI 0x400E4.
  1982.  */
  1983.  
  1984. extern os_error *xwimp_set_palette (os_palette *palette);
  1985. extern void wimp_set_palette (os_palette *palette);
  1986.  
  1987. /* ------------------------------------------------------------------------
  1988.  * Function:      wimp_read_palette()
  1989.  *
  1990.  * Description:   Reads the palette
  1991.  *
  1992.  * Input:         palette - value of R1 on entry
  1993.  *
  1994.  * Other notes:   Calls SWI 0x400E5 with R2 = 0x0.
  1995.  */
  1996.  
  1997. extern os_error *xwimp_read_palette (os_palette *palette);
  1998. extern void wimp_read_palette (os_palette *palette);
  1999.  
  2000. /* ------------------------------------------------------------------------
  2001.  * Function:      wimp_read_true_palette()
  2002.  *
  2003.  * Description:   Reads the palette, returning true colour values
  2004.  *
  2005.  * Input:         palette - value of R1 on entry
  2006.  *
  2007.  * Other notes:   Calls SWI 0x400E5 with R2 = 0x45555254.
  2008.  */
  2009.  
  2010. extern os_error *xwimp_read_true_palette (os_palette *palette);
  2011. extern void wimp_read_true_palette (os_palette *palette);
  2012.  
  2013. /* ------------------------------------------------------------------------
  2014.  * Function:      wimp_set_colour()
  2015.  *
  2016.  * Description:   Sets the current graphics foreground or background colour
  2017.  *                and action
  2018.  *
  2019.  * Input:         colour - value of R0 on entry
  2020.  *
  2021.  * Other notes:   Calls SWI 0x400E6.
  2022.  */
  2023.  
  2024. extern os_error *xwimp_set_colour (int colour);
  2025. extern void wimp_set_colour (int colour);
  2026.  
  2027. /* ------------------------------------------------------------------------
  2028.  * Function:      wimp_send_message()
  2029.  *
  2030.  * Description:   Sends a message to a task, or broadcasts to all tasks
  2031.  *
  2032.  * Input:         event - value of R0 on entry
  2033.  *                message - value of R1 on entry
  2034.  *                to - value of R2 on entry
  2035.  *
  2036.  * Other notes:   Calls SWI 0x400E7.
  2037.  */
  2038.  
  2039. extern os_error *xwimp_send_message (int event,
  2040.       wimp_message *message,
  2041.       wimp_t to);
  2042. extern void wimp_send_message (int event,
  2043.       wimp_message *message,
  2044.       wimp_t to);
  2045.  
  2046. /* ------------------------------------------------------------------------
  2047.  * Function:      wimp_send_message_to_window()
  2048.  *
  2049.  * Description:   Sends a message to the task that created a window
  2050.  *
  2051.  * Input:         event - value of R0 on entry
  2052.  *                message - value of R1 on entry
  2053.  *                to_w - value of R2 on entry
  2054.  *                to_i - value of R3 on entry
  2055.  *
  2056.  * Output:        to_t - value of R2 on exit (X version only)
  2057.  *
  2058.  * Returns:       R2 (non-X version only)
  2059.  *
  2060.  * Other notes:   Calls SWI 0x400E7.
  2061.  */
  2062.  
  2063. extern os_error *xwimp_send_message_to_window (int event,
  2064.       wimp_message *message,
  2065.       wimp_w to_w,
  2066.       wimp_i to_i,
  2067.       wimp_t *to_t);
  2068. extern wimp_t wimp_send_message_to_window (int event,
  2069.       wimp_message *message,
  2070.       wimp_w to_w,
  2071.       wimp_i to_i);
  2072.  
  2073. /* ------------------------------------------------------------------------
  2074.  * Function:      wimp_create_sub_menu()
  2075.  *
  2076.  * Description:   Creates a submenu
  2077.  *
  2078.  * Input:         sub_menu - value of R1 on entry
  2079.  *                x - value of R2 on entry
  2080.  *                y - value of R3 on entry
  2081.  *
  2082.  * Other notes:   Calls SWI 0x400E8.
  2083.  */
  2084.  
  2085. extern os_error *xwimp_create_sub_menu (wimp_menu *sub_menu,
  2086.       int x,
  2087.       int y);
  2088. extern void wimp_create_sub_menu (wimp_menu *sub_menu,
  2089.       int x,
  2090.       int y);
  2091.  
  2092. /* ------------------------------------------------------------------------
  2093.  * Function:      wimp_base_of_sprites()
  2094.  *
  2095.  * Description:   Finds the addresses of the ROM and RAM parts of the
  2096.  *                Wimp's sprite pool
  2097.  *
  2098.  * Output:        rom - value of R0 on exit
  2099.  *                ram - value of R1 on exit
  2100.  *
  2101.  * Other notes:   Calls SWI 0x400EA.
  2102.  */
  2103.  
  2104. extern os_error *xwimp_base_of_sprites (osspriteop_area **rom,
  2105.       osspriteop_area **ram);
  2106. extern void wimp_base_of_sprites (osspriteop_area **rom,
  2107.       osspriteop_area **ram);
  2108.  
  2109. /* ------------------------------------------------------------------------
  2110.  * Function:      wimp_block_copy()
  2111.  *
  2112.  * Description:   Copies a block of work area space to another position
  2113.  *
  2114.  * Input:         w - value of R0 on entry
  2115.  *                x0 - value of R1 on entry
  2116.  *                y0 - value of R2 on entry
  2117.  *                x1 - value of R3 on entry
  2118.  *                y1 - value of R4 on entry
  2119.  *                X0 - value of R5 on entry
  2120.  *                Y0 - value of R6 on entry
  2121.  *
  2122.  * Other notes:   Calls SWI 0x400EB.
  2123.  */
  2124.  
  2125. extern os_error *xwimp_block_copy (wimp_w w,
  2126.       int x0,
  2127.       int y0,
  2128.       int x1,
  2129.       int y1,
  2130.       int X0,
  2131.       int Y0);
  2132. extern void wimp_block_copy (wimp_w w,
  2133.       int x0,
  2134.       int y0,
  2135.       int x1,
  2136.       int y1,
  2137.       int X0,
  2138.       int Y0);
  2139.  
  2140. /* ------------------------------------------------------------------------
  2141.  * Function:      wimp_slot_size()
  2142.  *
  2143.  * Description:   Reads or sets the size of the current slot, the next
  2144.  *                slot, and the Wimp free pool
  2145.  *
  2146.  * Input:         new_curr_slot - value of R0 on entry
  2147.  *                new_next_slot - value of R1 on entry
  2148.  *
  2149.  * Output:        curr_slot - value of R0 on exit
  2150.  *                next_slot - value of R1 on exit
  2151.  *                free_slot - value of R2 on exit
  2152.  *
  2153.  * Other notes:   Calls SWI 0x400EC.
  2154.  */
  2155.  
  2156. extern os_error *xwimp_slot_size (int new_curr_slot,
  2157.       int new_next_slot,
  2158.       int *curr_slot,
  2159.       int *next_slot,
  2160.       int *free_slot);
  2161. extern void wimp_slot_size (int new_curr_slot,
  2162.       int new_next_slot,
  2163.       int *curr_slot,
  2164.       int *next_slot,
  2165.       int *free_slot);
  2166.  
  2167. /* ------------------------------------------------------------------------
  2168.  * Function:      wimp_read_pix_trans()
  2169.  *
  2170.  * Description:   Reads pixel translation table for a given sprite
  2171.  *
  2172.  * Input:         flags - value of R0 on entry
  2173.  *                area - value of R1 on entry
  2174.  *                id - value of R2 on entry
  2175.  *                factors - value of R6 on entry
  2176.  *                trans_tab - value of R7 on entry
  2177.  *
  2178.  * Other notes:   Calls SWI 0x400ED.
  2179.  */
  2180.  
  2181. extern os_error *xwimp_read_pix_trans (bits flags,
  2182.       osspriteop_area *area,
  2183.       osspriteop_id id,
  2184.       os_factors *factors,
  2185.       osspriteop_trans_tab *trans_tab);
  2186. extern void wimp_read_pix_trans (bits flags,
  2187.       osspriteop_area *area,
  2188.       osspriteop_id id,
  2189.       os_factors *factors,
  2190.       osspriteop_trans_tab *trans_tab);
  2191.  
  2192. /* ------------------------------------------------------------------------
  2193.  * Function:      wimpclaimfreememory_alloc()
  2194.  *
  2195.  * Description:   Claims the whole of the Wimp's free memory pool for the
  2196.  *                calling task
  2197.  *
  2198.  * Input:         size - value of R1 on entry
  2199.  *
  2200.  * Output:        size_out - value of R1 on exit
  2201.  *                blk - value of R2 on exit (X version only)
  2202.  *
  2203.  * Returns:       R2 (non-X version only)
  2204.  *
  2205.  * Other notes:   Calls SWI 0x400EE with R0 = 0x1.
  2206.  */
  2207.  
  2208. extern os_error *xwimpclaimfreememory_alloc (int size,
  2209.       int *size_out,
  2210.       void **blk);
  2211. extern void *wimpclaimfreememory_alloc (int size,
  2212.       int *size_out);
  2213.  
  2214. /* ------------------------------------------------------------------------
  2215.  * Function:      wimpclaimfreememory_free()
  2216.  *
  2217.  * Description:   Releases the Wimp's free memory pool
  2218.  *
  2219.  * Other notes:   Calls SWI 0x400EE with R0 = 0x0.
  2220.  */
  2221.  
  2222. extern os_error *xwimpclaimfreememory_free (void);
  2223. extern void wimpclaimfreememory_free (void);
  2224.  
  2225. /* ------------------------------------------------------------------------
  2226.  * Function:      wimp_command_window()
  2227.  *
  2228.  * Description:   Opens a text window in which normal VDU 4-type text can
  2229.  *                be displayed
  2230.  *
  2231.  * Input:         op - value of R0 on entry
  2232.  *
  2233.  * Other notes:   Calls SWI 0x400EF.
  2234.  */
  2235.  
  2236. extern os_error *xwimp_command_window (char *op);
  2237. extern void wimp_command_window (char *op);
  2238.  
  2239. /* ------------------------------------------------------------------------
  2240.  * Function:      wimp_text_colour()
  2241.  *
  2242.  * Description:   Sets the text foreground or background colour
  2243.  *
  2244.  * Input:         colour - value of R0 on entry
  2245.  *
  2246.  * Other notes:   Calls SWI 0x400F0.
  2247.  */
  2248.  
  2249. extern os_error *xwimp_text_colour (wimp_colour colour);
  2250. extern void wimp_text_colour (wimp_colour colour);
  2251.  
  2252. /* ------------------------------------------------------------------------
  2253.  * Function:      wimp_transfer_block()
  2254.  *
  2255.  * Description:   Copies a block of memory from one task's address space to
  2256.  *                another's
  2257.  *
  2258.  * Input:         from_t - value of R0 on entry
  2259.  *                from - value of R1 on entry
  2260.  *                to_t - value of R2 on entry
  2261.  *                to - value of R3 on entry
  2262.  *                len - value of R4 on entry
  2263.  *
  2264.  * Other notes:   Calls SWI 0x400F1.
  2265.  */
  2266.  
  2267. extern os_error *xwimp_transfer_block (wimp_t from_t,
  2268.       byte *from,
  2269.       wimp_t to_t,
  2270.       byte *to,
  2271.       int len);
  2272. extern void wimp_transfer_block (wimp_t from_t,
  2273.       byte *from,
  2274.       wimp_t to_t,
  2275.       byte *to,
  2276.       int len);
  2277.  
  2278. /* ------------------------------------------------------------------------
  2279.  * Function:      wimp_set_font_colours()
  2280.  *
  2281.  * Description:   Sets the anti-aliases font colours from the two (standard
  2282.  *                Wimp) colours specified
  2283.  *
  2284.  * Input:         fg - value of R1 on entry
  2285.  *                bg - value of R2 on entry
  2286.  *
  2287.  * Other notes:   Calls SWI 0x400F3.
  2288.  */
  2289.  
  2290. extern os_error *xwimp_set_font_colours (wimp_colour fg,
  2291.       wimp_colour bg);
  2292. extern void wimp_set_font_colours (wimp_colour fg,
  2293.       wimp_colour bg);
  2294.  
  2295. /* ------------------------------------------------------------------------
  2296.  * Function:      wimp_get_menu_state()
  2297.  *
  2298.  * Description:   Gets the state of a menu, showing which item is selected
  2299.  *
  2300.  * Input:         flags - value of R0 on entry
  2301.  *                selection - value of R1 on entry
  2302.  *                w - value of R2 on entry
  2303.  *                i - value of R3 on entry
  2304.  *
  2305.  * Other notes:   Calls SWI 0x400F4.
  2306.  */
  2307.  
  2308. extern os_error *xwimp_get_menu_state (bits flags,
  2309.       wimp_selection *selection,
  2310.       wimp_w w,
  2311.       wimp_i i);
  2312. extern void wimp_get_menu_state (bits flags,
  2313.       wimp_selection *selection,
  2314.       wimp_w w,
  2315.       wimp_i i);
  2316.  
  2317. /* ------------------------------------------------------------------------
  2318.  * Function:      wimp_register_filter()
  2319.  *
  2320.  * Description:   Used by the Filter Manager to register or deregister a
  2321.  *                filter with the Wimp
  2322.  *
  2323.  * Input:         type - value of R0 on entry
  2324.  *                filter_code - value of R1 on entry
  2325.  *                handle - value of R2 on entry
  2326.  *
  2327.  * Other notes:   Calls SWI 0x400F5.
  2328.  */
  2329.  
  2330. extern os_error *xwimp_register_filter (bits type,
  2331.       void *filter_code,
  2332.       byte *handle);
  2333. extern void wimp_register_filter (bits type,
  2334.       void *filter_code,
  2335.       byte *handle);
  2336.  
  2337. /* ------------------------------------------------------------------------
  2338.  * Function:      wimp_add_messages()
  2339.  *
  2340.  * Description:   Adds messages to the list of those known by a certain
  2341.  *                task
  2342.  *
  2343.  * Input:         messages - value of R0 on entry
  2344.  *
  2345.  * Other notes:   Calls SWI 0x400F6.
  2346.  */
  2347.  
  2348. extern os_error *xwimp_add_messages (wimp_message_list *messages);
  2349. extern void wimp_add_messages (wimp_message_list *messages);
  2350.  
  2351. /* ------------------------------------------------------------------------
  2352.  * Function:      wimp_remove_messages()
  2353.  *
  2354.  * Description:   Removes messages from the list of those known by a
  2355.  *                certain task
  2356.  *
  2357.  * Input:         messages - value of R0 on entry
  2358.  *
  2359.  * Other notes:   Calls SWI 0x400F7.
  2360.  */
  2361.  
  2362. extern os_error *xwimp_remove_messages (wimp_message_list *messages);
  2363. extern void wimp_remove_messages (wimp_message_list *messages);
  2364.  
  2365. /* ------------------------------------------------------------------------
  2366.  * Function:      wimp_set_colour_mapping()
  2367.  *
  2368.  * Description:   Changes the mapping between Wimp colours and physical
  2369.  *                colours
  2370.  *
  2371.  * Input:         palette - value of R1 on entry
  2372.  *                map2 - value of R2 on entry
  2373.  *                map4 - value of R3 on entry
  2374.  *                map16 - value of R4 on entry
  2375.  *
  2376.  * Other notes:   Calls SWI 0x400F8 with R5 = 0x0, R6 = 0x0, R7 = 0x0.
  2377.  */
  2378.  
  2379. extern os_error *xwimp_set_colour_mapping (os_palette *palette,
  2380.       byte *map2,
  2381.       byte *map4,
  2382.       byte *map16);
  2383. extern void wimp_set_colour_mapping (os_palette *palette,
  2384.       byte *map2,
  2385.       byte *map4,
  2386.       byte *map16);
  2387.  
  2388. /* ------------------------------------------------------------------------
  2389.  * Function:      wimptextop_set_colour()
  2390.  *
  2391.  * Description:   Sets the colour to use for text plotting with
  2392.  *                WimpTextOp_Paint
  2393.  *
  2394.  * Input:         fg - value of R1 on entry
  2395.  *                bg - value of R2 on entry
  2396.  *
  2397.  * Other notes:   Calls SWI 0x400F9 with R0 = 0x0.
  2398.  */
  2399.  
  2400. extern os_error *xwimptextop_set_colour (os_colour fg,
  2401.       os_colour bg);
  2402. extern void wimptextop_set_colour (os_colour fg,
  2403.       os_colour bg);
  2404.  
  2405. /* ------------------------------------------------------------------------
  2406.  * Function:      wimptextop_string_width()
  2407.  *
  2408.  * Description:   Gets the width of a string for the current desktop font
  2409.  *
  2410.  * Input:         s - value of R1 on entry
  2411.  *                len - value of R2 on entry
  2412.  *
  2413.  * Output:        width - value of R0 on exit (X version only)
  2414.  *
  2415.  * Returns:       R0 (non-X version only)
  2416.  *
  2417.  * Other notes:   Calls SWI 0x400F9 with R0 = 0x1.
  2418.  */
  2419.  
  2420. extern os_error *xwimptextop_string_width (char *s,
  2421.       int len,
  2422.       int *width);
  2423. extern int wimptextop_string_width (char *s,
  2424.       int len);
  2425.  
  2426. /* ------------------------------------------------------------------------
  2427.  * Function:      wimptextop_paint()
  2428.  *
  2429.  * Description:   Plots text on the screen using the current desktop font
  2430.  *
  2431.  * Input:         flags - value of R0 on entry
  2432.  *                s - value of R1 on entry
  2433.  *                x0 - value of R4 on entry
  2434.  *                y0 - value of R5 on entry
  2435.  *
  2436.  * Other notes:   Calls SWI 0x400F9 with R0 |= 0x2, R2 = 0xFFFFFFFF, R3 = 0xFFFFFFFF.
  2437.  */
  2438.  
  2439. extern os_error *xwimptextop_paint (bits flags,
  2440.       char *s,
  2441.       int x0,
  2442.       int y0);
  2443. extern void wimptextop_paint (bits flags,
  2444.       char *s,
  2445.       int x0,
  2446.       int y0);
  2447.  
  2448. /* ------------------------------------------------------------------------
  2449.  * Function:      wimp_set_watchdog_state()
  2450.  *
  2451.  * Description:   Sets the state of the Wimp's watchdog
  2452.  *
  2453.  * Input:         enable - value of R0 on entry
  2454.  *                code_word - value of R1 on entry
  2455.  *
  2456.  * Other notes:   Calls SWI 0x400FA.
  2457.  */
  2458.  
  2459. extern os_error *xwimp_set_watchdog_state (bool enable,
  2460.       int code_word);
  2461. extern void wimp_set_watchdog_state (bool enable,
  2462.       int code_word);
  2463.  
  2464. /* ------------------------------------------------------------------------
  2465.  * Function:      wimp_resize_icon()
  2466.  *
  2467.  * Description:   Changes the bounding box of an icon
  2468.  *
  2469.  * Input:         w - value of R0 on entry
  2470.  *                i - value of R1 on entry
  2471.  *                x0 - value of R2 on entry
  2472.  *                y0 - value of R3 on entry
  2473.  *                x1 - value of R4 on entry
  2474.  *                y1 - value of R5 on entry
  2475.  *
  2476.  * Other notes:   Calls SWI 0x400FC.
  2477.  */
  2478.  
  2479. extern os_error *xwimp_resize_icon (wimp_w w,
  2480.       wimp_i i,
  2481.       int x0,
  2482.       int y0,
  2483.       int x1,
  2484.       int y1);
  2485. extern void wimp_resize_icon (wimp_w w,
  2486.       wimp_i i,
  2487.       int x0,
  2488.       int y0,
  2489.       int x1,
  2490.       int y1);
  2491.  
  2492. /* ------------------------------------------------------------------------
  2493.  * Function:      service_memory()
  2494.  *
  2495.  * Description:   Memory controller about to be remapped
  2496.  *
  2497.  * Input:         change - value of R0 on entry
  2498.  *                cao - value of R2 on entry
  2499.  *
  2500.  * Other notes:   Calls SWI 0x30 with R1 = 0x11.
  2501.  */
  2502.  
  2503. extern os_error *xservice_memory (int change,
  2504.       byte *cao);
  2505. extern void service_memory (int change,
  2506.       byte *cao);
  2507.  
  2508. /* ------------------------------------------------------------------------
  2509.  * Function:      service_start_wimp()
  2510.  *
  2511.  * Description:   Start up any resident module tasks using Wimp_StartTask
  2512.  *
  2513.  * Other notes:   Calls SWI 0x30 with R1 = 0x49.
  2514.  */
  2515.  
  2516. extern os_error *xservice_start_wimp (void);
  2517. extern void service_start_wimp (void);
  2518.  
  2519. /* ------------------------------------------------------------------------
  2520.  * Function:      service_started_wimp()
  2521.  *
  2522.  * Description:   Request to task modules to set task_handle variable to 0
  2523.  *
  2524.  * Other notes:   Calls SWI 0x30 with R1 = 0x4A.
  2525.  */
  2526.  
  2527. extern os_error *xservice_started_wimp (void);
  2528. extern void service_started_wimp (void);
  2529.  
  2530. /* ------------------------------------------------------------------------
  2531.  * Function:      service_mouse_trap()
  2532.  *
  2533.  * Description:   The Wimp has detected a significant mouse movement
  2534.  *
  2535.  * Other notes:   Calls SWI 0x30 with R1 = 0x52.
  2536.  */
  2537.  
  2538. extern os_error *xservice_mouse_trap (void);
  2539. extern void service_mouse_trap (void);
  2540.  
  2541. /* ------------------------------------------------------------------------
  2542.  * Function:      service_wimp_close_down()
  2543.  *
  2544.  * Description:   Notification the the Wimp is about to close down a task
  2545.  *
  2546.  * Other notes:   Calls SWI 0x30 with R1 = 0x53.
  2547.  */
  2548.  
  2549. extern os_error *xservice_wimp_close_down (void);
  2550. extern void service_wimp_close_down (void);
  2551.  
  2552. /* ------------------------------------------------------------------------
  2553.  * Function:      service_wimp_report_error()
  2554.  *
  2555.  * Description:   Request to suspend trapping of VDU output so an error can
  2556.  *                be displayed
  2557.  *
  2558.  * Input:         opening - value of R0 on entry
  2559.  *
  2560.  * Other notes:   Calls SWI 0x30 with R1 = 0x57.
  2561.  */
  2562.  
  2563. extern os_error *xservice_wimp_report_error (bool opening);
  2564. extern void service_wimp_report_error (bool opening);
  2565.  
  2566. /* ------------------------------------------------------------------------
  2567.  * Function:      service_wimp_save_desktop()
  2568.  *
  2569.  * Description:   Save some state to a desktop boot file
  2570.  *
  2571.  * Input:         flags - value of R0 on entry
  2572.  *                file - value of R2 on entry
  2573.  *
  2574.  * Output:        error - value of R0 on exit
  2575.  *                unclaimed - value of R1 on exit (X version only)
  2576.  *
  2577.  * Returns:       R1 (non-X version only)
  2578.  *
  2579.  * Other notes:   Calls SWI 0x30 with R1 = 0x5C.
  2580.  */
  2581.  
  2582. extern os_error *xservice_wimp_save_desktop (bits flags,
  2583.       os_f file,
  2584.       os_error **error,
  2585.       bool *unclaimed);
  2586. extern bool service_wimp_save_desktop (bits flags,
  2587.       os_f file,
  2588.       os_error **error);
  2589.  
  2590. /* ------------------------------------------------------------------------
  2591.  * Function:      service_wimp_palette()
  2592.  *
  2593.  * Description:   Palette change
  2594.  *
  2595.  * Other notes:   Calls SWI 0x30 with R1 = 0x5D.
  2596.  */
  2597.  
  2598. extern os_error *xservice_wimp_palette (void);
  2599. extern void service_wimp_palette (void);
  2600.  
  2601. /* ------------------------------------------------------------------------
  2602.  * Function:      service_desktop_welcome()
  2603.  *
  2604.  * Description:   Desktop starting
  2605.  *
  2606.  * Other notes:   Calls SWI 0x30 with R1 = 0x7C.
  2607.  */
  2608.  
  2609. extern os_error *xservice_desktop_welcome (void);
  2610. extern void service_desktop_welcome (void);
  2611.  
  2612. /* ------------------------------------------------------------------------
  2613.  * Function:      service_shut_down()
  2614.  *
  2615.  * Description:   Task Manager shutting down
  2616.  *
  2617.  * Other notes:   Calls SWI 0x30 with R1 = 0x7E.
  2618.  */
  2619.  
  2620. extern os_error *xservice_shut_down (void);
  2621. extern void service_shut_down (void);
  2622.  
  2623. /* ------------------------------------------------------------------------
  2624.  * Function:      service_shut_down_complete()
  2625.  *
  2626.  * Description:   Shutdown complete
  2627.  *
  2628.  * Other notes:   Calls SWI 0x30 with R1 = 0x80.
  2629.  */
  2630.  
  2631. extern os_error *xservice_shut_down_complete (void);
  2632. extern void service_shut_down_complete (void);
  2633.  
  2634. /* ------------------------------------------------------------------------
  2635.  * Function:      service_wimp_sprites_moved()
  2636.  *
  2637.  * Description:   Wimp sprite pools have moved
  2638.  *
  2639.  * Other notes:   Calls SWI 0x30 with R1 = 0x85.
  2640.  */
  2641.  
  2642. extern os_error *xservice_wimp_sprites_moved (void);
  2643. extern void service_wimp_sprites_moved (void);
  2644.  
  2645. /* ------------------------------------------------------------------------
  2646.  * Function:      service_wimp_register_filters()
  2647.  *
  2648.  * Description:   Allows the Filter Manager to install filters with the
  2649.  *                Wimp
  2650.  *
  2651.  * Other notes:   Calls SWI 0x30 with R1 = 0x86.
  2652.  */
  2653.  
  2654. extern os_error *xservice_wimp_register_filters (void);
  2655. extern void service_wimp_register_filters (void);
  2656.  
  2657. /* ------------------------------------------------------------------------
  2658.  * Function:      service_error_starting()
  2659.  *
  2660.  * Description:   Issued immediately after Wimp_ReportError is called
  2661.  *
  2662.  * Input:         error - value of R2 on entry
  2663.  *                flags - value of R3 on entry
  2664.  *                name - value of R4 on entry
  2665.  *                sprite_name - value of R5 on entry
  2666.  *                area - value of R6 on entry
  2667.  *                buttons - value of R7 on entry
  2668.  *
  2669.  * Output:        error_out - value of R2 on exit
  2670.  *                flags_out - value of R3 on exit
  2671.  *                name_out - value of R4 on exit
  2672.  *                sprite_name_out - value of R5 on exit
  2673.  *                area_out - value of R6 on exit
  2674.  *                buttons_out - value of R7 on exit
  2675.  *
  2676.  * Other notes:   Calls SWI 0x30 with R1 = 0x400C0.
  2677.  */
  2678.  
  2679. extern os_error *xservice_error_starting (os_error *error,
  2680.       bits flags,
  2681.       char *name,
  2682.       char *sprite_name,
  2683.       osspriteop_area *area,
  2684.       char *buttons,
  2685.       os_error **error_out,
  2686.       bits *flags_out,
  2687.       char **name_out,
  2688.       char **sprite_name_out,
  2689.       osspriteop_area **area_out,
  2690.       char **buttons_out);
  2691. extern void service_error_starting (os_error *error,
  2692.       bits flags,
  2693.       char *name,
  2694.       char *sprite_name,
  2695.       osspriteop_area *area,
  2696.       char *buttons,
  2697.       os_error **error_out,
  2698.       bits *flags_out,
  2699.       char **name_out,
  2700.       char **sprite_name_out,
  2701.       osspriteop_area **area_out,
  2702.       char **buttons_out);
  2703.  
  2704. /* ------------------------------------------------------------------------
  2705.  * Function:      service_error_button_pressed()
  2706.  *
  2707.  * Description:   Issued when any button on the error report is pressed
  2708.  *
  2709.  * Input:         button - value of R2 on entry
  2710.  *                button_list - value of R3 on entry
  2711.  *
  2712.  * Output:        redisplay - value of R0 on exit
  2713.  *                unclaimed - value of R1 on exit (X version only)
  2714.  *                button_out - value of R2 on exit
  2715.  *
  2716.  * Returns:       R1 (non-X version only)
  2717.  *
  2718.  * Other notes:   Calls SWI 0x30 with R0 = 0x0, R1 = 0x400C1.
  2719.  */
  2720.  
  2721. extern os_error *xservice_error_button_pressed (int button,
  2722.       char *button_list,
  2723.       bool *redisplay,
  2724.       bool *unclaimed,
  2725.       int *button_out);
  2726. extern bool service_error_button_pressed (int button,
  2727.       char *button_list,
  2728.       bool *redisplay,
  2729.       int *button_out);
  2730.  
  2731. /* ------------------------------------------------------------------------
  2732.  * Function:      service_error_ending()
  2733.  *
  2734.  * Description:   Issued immediately before an error report closes
  2735.  *
  2736.  * Input:         button - value of R2 on entry
  2737.  *
  2738.  * Output:        unclaimed - value of R1 on exit (X version only)
  2739.  *                button_out - value of R2 on exit
  2740.  *
  2741.  * Returns:       R1 (non-X version only)
  2742.  *
  2743.  * Other notes:   Calls SWI 0x30 with R1 = 0x400C2.
  2744.  */
  2745.  
  2746. extern os_error *xservice_error_ending (int button,
  2747.       bool *unclaimed,
  2748.       int *button_out);
  2749. extern bool service_error_ending (int button,
  2750.       int *button_out);
  2751.  
  2752. #ifdef __cplusplus
  2753.    }
  2754. #endif
  2755.  
  2756. #endif
  2757.