home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / d / desklib / !DeskLib / h_doc / WimpSWIs < prev    next >
Encoding:
Text File  |  1997-01-22  |  12.4 KB  |  358 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    WimpSWIs.h
  12.     Author:  Copyright © 1992, 1993, 1994 John Winters, Jason Williams
  13.                                           Sergio Monesi, Julian Smith.
  14.     Version: 1.08 (09 Sep 1995)
  15.     Purpose: Prototypes for Wimp SWI calls defined in the Wimp library
  16.              (Basic SWI-level interface to the Wimp)
  17.     
  18.     Mods:    19 Mar 1995 - JS - Added macros to make calls to 
  19.                                 Desk_Wimp_Poll(Idle) actually call Straylight 
  20.                                 equivalents, when compilataion is for 
  21.                                 dynamic linking.
  22.              08 Jul 1995 - JS - Removed #include of kernel.h, and changed
  23.                                 Desk_Wimp_SpriteOp prototype, to make
  24.                                 DeskLib usable without Acorn headers
  25.  
  26.              13 Jul 1995 - SM - Added Desk_Wimp_StartTask3 and 
  27.                                 Desk_Wimp_GetWindowInfoNoIcons (for RISC OS 3.10 
  28.                                 or later).
  29.              
  30.              09 Sep 1995 - JS - Added Desk_Wimp_e* macros for each Wimp SWI. 
  31.                                 These call Desk_Error2_XHandle if the SWI returns 
  32.                                 an (Desk_os_error *).
  33.              10 Nov 1995 - JS - Added Desk_Wimp_E* macros for each Wimp SWI. 
  34.                                 These call Desk_Error2_Handle if the SWI returns
  35.                                 an (Desk_os_error *).
  36.              
  37. */
  38.  
  39.  
  40. #ifndef __Desk_WimpSWIs_h
  41. #define __Desk_WimpSWIs_h
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47.  
  48. #ifndef __Desk_Core_h
  49.     #include "Desk.Core.h"
  50. #endif
  51.  
  52. #ifndef __Desk_Wimp_h
  53.     #include "Desk.Wimp.h"
  54. #endif
  55.  
  56. #ifndef __Desk_Error2_h
  57.     #include "Desk.Error2.h"
  58. #endif
  59.  
  60.  
  61. /* Task handling: init, closedown, messages, transfers, etc. */
  62.  
  63. extern void    Desk_Wimp_Initialise(const unsigned int *version,
  64.                                  const char         *name,
  65.                                  Desk_task_handle  *task,
  66.                                  const int          *messages);
  67. extern void    Desk_Wimp_CloseDown(Desk_task_handle task);
  68.  
  69. extern void    Desk_Wimp_StartTask(const char *command);
  70.  
  71. extern void    Desk_Wimp_StartTask3(const char *command, Desk_task_handle *newtask);
  72.  /*  Desk_Wimp_StartTask3
  73.   *  RISC OS 3 version of Desk_Wimp_StartTask that returns the task handle of
  74.   *  the started task if it is still alive or 0 if it isn't
  75.   */
  76.  
  77. extern void    Desk_Wimp_SlotSize(int *currentslot, int *nextslot, int *freepool);
  78. extern void    Desk_Wimp_TransferBlock(Desk_task_handle  sourcetask,
  79.                                     void         *sourcebuffer,
  80.                                     Desk_task_handle  desttask,
  81.                                     void         *destbuffer,
  82.                                     unsigned int length);
  83.  
  84. extern void    Desk_Wimp_ReportError(const Desk_os_error *error, int flags, const char *name);
  85.  /*  Desk_Wimp_ReportError
  86.   *  Reports an error in the standard WIMP non-multitasking error box.
  87.   *  Avoid (by using your own multitasking error box) where possible!
  88.   *  See also Desk_Wimp_ReportErrorR
  89.   *  'flags' should be as in the Desk_error_flags union.
  90.   */
  91.  
  92. enum    {
  93.     Desk_wimp_reporterror_button_NONE    = 0,
  94.     Desk_wimp_reporterror_button_OK        = 1,
  95.     Desk_wimp_reporterror_button_CANCEL    = 2
  96.     };
  97.  
  98.  
  99. extern int Desk_Wimp_ReportErrorR(const Desk_os_error *error, int flags, const char *name);
  100.  /*  Desk_Wimp_ReportErrorR
  101.   *  Identical to Desk_Wimp_ReportError, except this version returns the flags
  102.   *  that are returned by the SWI. That is, the return code from this
  103.   *  function is 1 if OK was pressed or 2 if Cancel was pressed (see 
  104.   *  Desk_wimp_reporterror_button_NONE, Desk_wimp_reporterror_button_OK,
  105.   *  Desk_wimp_reporterror_button_CANCEL).
  106.   *  'flags' should be as in the Desk_error_flags union.
  107.   */
  108.  
  109. /*
  110. extern int Desk_Wimp_ReportErrorR350( 
  111.         const Desk_os_error    *error, 
  112.         int            flags, 
  113.         const char        *name, 
  114.         const char*        spritename, 
  115.         Desk_sprite_area    area, 
  116.         const char*        text
  117.         );
  118. */ /*  Identical to Desk_Wimp_ReportErrorR, except it supports
  119.   *  the new parameters in RO3.5
  120.   */
  121.  
  122.  
  123.  
  124.  
  125.  
  126. extern void    Desk_Wimp_SendMessage (Desk_event_type       eventtype,
  127.                                    Desk_message_block    *message,
  128.                                    Desk_message_destinee destinee,
  129.                                    Desk_icon_handle      icon);
  130.  
  131.  
  132. /* window handling */
  133.  
  134. extern void    Desk_Wimp_OpenTemplate(const char *name);
  135. extern void    Desk_Wimp_CloseTemplate(void);
  136. extern void    Desk_Wimp_LoadTemplate(Desk_template_block *wtemplate);
  137.  
  138. extern void    Desk_Wimp_CreateWindow(const Desk_window_block *block, Desk_window_handle *window);
  139. extern void    Desk_Wimp_OpenWindow(const Desk_window_openblock *block);
  140. extern void    Desk_Wimp_CloseWindow(Desk_window_handle window);
  141. extern void    Desk_Wimp_DeleteWindow(Desk_window_handle window);
  142.  
  143. extern void    Desk_Wimp_RedrawWindow(Desk_window_redrawblock *block, Desk_bool *more);
  144. extern void    Desk_Wimp_UpdateWindow(Desk_window_redrawblock *block, Desk_bool *more);
  145. extern void    Desk_Wimp_GetRectangle(Desk_window_redrawblock *block, Desk_bool *more);
  146.  
  147. extern void    Desk_Wimp_GetWindowState(Desk_window_handle window, Desk_window_state *state);
  148.  
  149. extern void    Desk_Wimp_GetWindowInfo(Desk_window_info *info);
  150. /*
  151.  *  NOTE that this call returns a Desk_window_info PLUS icon data following it.
  152.  *  It will therefore overwrite past the end of a normal Desk_window_info block.
  153.  *  Use Desk_Window_GetInfo in preference.
  154.  */
  155.  
  156. extern void    Desk_Wimp_GetWindowInfoNoIcons(Desk_window_info *info);
  157. /*
  158.  *  This call returns only the Desk_window_info, NOT the icons data. It only
  159.  *  works with RISC OS 3.10 or later
  160.  */
  161.  
  162. extern void    Desk_Wimp_GetWindowOutline(Desk_window_outline *outline);
  163. extern void    Desk_Wimp_SetExtent(Desk_window_handle window, Desk_wimp_box *newextent);
  164. extern void    Desk_Wimp_ForceRedraw(const Desk_window_redrawblock *block);
  165.  
  166.  
  167.  
  168. /* Icon handling */
  169.  
  170. extern void    Desk_Wimp_CreateIcon(const Desk_icon_createblock *block, Desk_icon_handle *icon);
  171. extern void    Desk_Wimp_DeleteIcon(Desk_window_handle window, Desk_icon_handle icon);
  172. extern void    Desk_Wimp_SetIconState(Desk_window_handle window,
  173.                                    Desk_icon_handle   icon,
  174.                                    int           value,
  175.                                    int           mask);
  176. extern void    Desk_Wimp_GetIconState(Desk_window_handle window,
  177.                                    Desk_icon_handle   icon,
  178.                                    Desk_icon_block    *iconinfo);
  179. extern void    Desk_Wimp_WhichIcon(Desk_window_handle    window,
  180.                                    Desk_icon_handle   *icons,
  181.                                    int           mask,
  182.                                    int           settings);
  183.  
  184. extern void    Desk_Wimp_PlotIcon(Desk_icon_block *fakeicon);
  185. /*
  186. Don't call this except in a redraw loop. If not in a redraw loop, use
  187. Desk_Wimp_PlotIcon2.
  188.  */
  189.  
  190. extern void    Desk_Wimp_PlotIcon2( Desk_icon_block *fakeicon, int xorigin, int yorigin);
  191. /*
  192. When not invoked in a redraw loop, Wimp_PlotIcon assumes origin at
  193. (r4,r5). This is undocumented AFAIK, even in PRMs 5a, but see PRMs
  194. 5a-516.
  195.  
  196. I think Wimp_Plot ignores the current graphics origin in favour of
  197. (r4,r5) when invoked outside a redraw loop, so you should include the
  198. graphics origin explicitly using this call when redrawing to a sprite
  199. for example.
  200.  
  201. If in a redraw loop, xorigin and yorigin are ignored by the underlying
  202. SWI Wimp_PlotIcon, so you'll save a few ns by using Desk_Wimp_PlotIcon.
  203.  */
  204.  
  205.  
  206.  
  207. /*  Poll handling */
  208. /*  DeskLib 2.04:
  209.  *  WimpSWIs.s.Poll has been updated to handle passing a WIMP pollword
  210.  *  under RISC OS 3. The new Poll functions have been named Poll3 and
  211.  *  PollIdle3 so that you can't accidentally link with the new forms
  212.  *  of the functions.
  213.  *  Poll and PollIdle are now macros that map Poll calls onto the new
  214.  *  Poll3 functions (passing a zero for the pollword). So long as you
  215.  *  only try to use pollwords under RISC OS 3 onwards, you should be fine!
  216.  *
  217.  *  If you wish to specifically use the pollword, then call the Poll3 functions
  218.  *  directly, using the new parameter.
  219.  */
  220.  
  221. #define Desk_Wimp_Poll(mask, evt) Desk_Wimp_Poll3(mask, evt, 0)
  222. #define Desk_Wimp_PollIdle(mask, evt, time) Desk_Wimp_PollIdle3(mask, evt, time, 0)
  223.  
  224. extern void    Desk_Wimp_Poll3(Desk_event_pollmask mask, Desk_event_pollblock *event,
  225.                             void *pollword);
  226. extern void    Desk_Wimp_PollIdle3(Desk_event_pollmask mask, Desk_event_pollblock *block,
  227.                                 int earliest, void *pollword);
  228.  
  229.  
  230.  
  231. /*
  232. Some macro stuff to make sure the SDLS Desk_Wimp_Poll veneers are 
  233. called if compilation is for a DLL.
  234. */
  235.  
  236.  
  237. #ifdef Desk__using_SDLS
  238.  
  239. extern Desk_event_type _dll_wimpPoll( 
  240.         Desk_event_pollmask    mask, 
  241.         Desk_event_data    *data, 
  242.         int        dummy, 
  243.         void        *pollword
  244.         );
  245. /*
  246. This SDLS function preserves the Straylight DLL handle in case a new
  247. application starts before Desk_Wimp_Poll returns.
  248. Only used if compilation is for a SDLS client application.
  249. */
  250.  
  251. extern Desk_event_type _dll_wimpPollIdle( 
  252.         Desk_event_pollmask    mask, 
  253.         Desk_event_data    *data, 
  254.         int        earliest, 
  255.         void        *pollword
  256.         );
  257. /*
  258. This SDLS function preserves the Straylight DLL handle in case a new
  259. application starts before Desk_Wimp_Poll returns.
  260. Only used if compilation is for a SDLS client application.
  261. */
  262.  
  263. extern void    Desk_Wimp_Poll3_DLL( Desk_event_pollmask mask, Desk_event_pollblock *event,
  264.                                  void *pollword);
  265. /*
  266. A DeskLib-style veneer onto the Straylight DLL handle-preserving function.
  267. Only used if compilation is for a SDLS client application.
  268. */
  269.  
  270. extern void    Desk_Wimp_PollIdle3_DLL( Desk_event_pollmask mask, Desk_event_pollblock *block,
  271.                                        int earliest, void *pollword);
  272. /*
  273. A DeskLib-style veneer onto the Straylight DLL handle-preserving function.
  274. Only used if compilation is for a SDLS client application.
  275. */
  276.  
  277. #define Desk_Wimp_Poll3 Desk_Wimp_Poll3_DLL
  278. #define Desk_Wimp_PollIdle3 Desk_Wimp_PollIdle3_DLL
  279.  
  280.  
  281. #endif
  282.  
  283.  
  284.  
  285.  
  286.  
  287. extern void    Desk_Wimp_SaveFPStateOnPoll(void);
  288. extern void    Desk_Wimp_CorruptFPStateOnPoll(void);
  289.  
  290.  
  291. /* Pointer/Mouse handling */
  292.  
  293. extern void    Desk_Wimp_GetPointerInfo(Desk_mouse_block *ptrinfo);
  294. extern void    Desk_Wimp_SetPointerShape(const Desk_pointer_shapeblock *shape);
  295.  
  296. extern void    Desk_Wimp_DragBox(Desk_drag_block *draginfo);
  297.  
  298.  
  299. /* Caret handling */
  300.  
  301. extern void    Desk_Wimp_SetCaretPosition(const Desk_caret_block *caret);
  302. extern void    Desk_Wimp_GetCaretPosition(const Desk_caret_block *caret);
  303.  
  304.  
  305. /* Menu handling */
  306.  
  307. extern void    Desk_Wimp_CreateMenu(Desk_menu_ptr menu, int xpos, int ypos);
  308. extern void    Desk_Wimp_CreateSubMenu(Desk_menu_ptr menu, int xpos, int ypos);
  309. extern void    Desk_Wimp_DecodeMenu(Desk_menu_ptr menu,
  310.                                  const int      *selections,
  311.                                  char     *result);
  312. /*
  313. Note that this makes a CR-terminated string.
  314. */
  315.  
  316.  
  317. /* Keyboard handling */
  318.  
  319. extern void    Desk_Wimp_ProcessKey(int character);
  320.  
  321.  
  322. /* Graphics/Screen handling */
  323.  
  324. extern void    Desk_Wimp_SetMode(int mode);
  325. extern void    Desk_Wimp_SetColour(int colour);
  326. extern void    Desk_Wimp_ReadPalette(Desk_palette_block *palette);
  327. extern void    Desk_Wimp_SetPalette(const Desk_palette_block *palette);
  328. extern void    Desk_Wimp_ReadPixTrans(int         areaindex,
  329.                                    void        *area,
  330.                                    void        *sprite,
  331.                                    Desk_scale_block *scaleblock,
  332.                                    char        *transblock);
  333. extern void    Desk_Wimp_SetFontColours(int foreground, int background);
  334.  
  335.  
  336. extern void    Desk_Wimp_SpriteOp( int r[10]);
  337. /*
  338. r = should be a pointer to an array of 10 ints
  339. This used to be:
  340. extern void    Desk_Wimp_SpriteOp(_kernel_swi_regs *registers);
  341. */
  342.  
  343. extern void    Desk_Wimp_BaseOfSprites(void **Desk_rom_base, void **Desk_ram_base);
  344.  
  345. extern void    Desk_Wimp_BlockCopy(Desk_window_handle window, const Desk_wimp_box *source,
  346.                                                       int x, int y);
  347.  
  348. extern void    Desk_Wimp_CommandWindow(int);
  349.  
  350.  
  351.  
  352. #ifdef __cplusplus
  353. }
  354. #endif
  355.  
  356.  
  357. #endif
  358.