home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / clib / progs / timslib / TimsLib / c / Interface < prev    next >
Encoding:
Text File  |  1992-11-30  |  5.7 KB  |  269 lines

  1. /*
  2.  *
  3.  *       Title                  : interface.c
  4.  *       System                 : Risc-OS library
  5.  *       Version                : 2.00
  6.  *       Copyright              : © Software Interrupt
  7.  *       Date                   : 25nd September, 1990
  8.  *       Author                 : Simon Huntington
  9.  *       Updated                : Tim Browse, 12th July, 1992
  10.  *
  11.  *       Function               : Headers for Interface functions
  12.  *
  13.  */
  14.  
  15. /* DeskLib includes */
  16. #include "DeskLib.Error.h"
  17. #include "DeskLib.Wimp.h"
  18. #include "DeskLib.Event.h"
  19.  
  20. /* Risc OS Lib includes */
  21. #include "os.h"
  22.  
  23. #include "Interface.h"
  24.  
  25. /* 
  26.  *============================================================================
  27.  *
  28.  * Function to border an icon
  29.  *
  30.  *    Parameters :     mouse - mouse string containg icon, window, buttons
  31.  *
  32.  *    Returns :        An error is not successful
  33.  *  
  34.  *============================================================================
  35.  */
  36.  
  37. os_error *Interface_SlabButton (mouse_block *mouse)
  38. {
  39.   os_regset regs;
  40.   os_error  *error;
  41.  
  42.   regs.r[1] = (int) mouse;
  43.   error = os_swix (SWI_Interface_SlabButton, ®s);
  44.  
  45.   return error;
  46. }
  47.  
  48.  
  49.  
  50.  
  51.  
  52. /* 
  53.  *============================================================================
  54.  *
  55.  * Function to border a window
  56.  *
  57.  *    Parameters :     redraw_box - a redraw box as returned from wimp_EREDRAW
  58.  *                                  poll code
  59.  *
  60.  *    Returns :        An error is not successful
  61.  *  
  62.  *============================================================================
  63.  */
  64.  
  65. os_error *Interface_Render3dWindow (window_redrawblock redraw_box)
  66. {
  67.   os_regset regs;
  68.   os_error  *error;
  69.  
  70.   regs.r[1] = (int) &redraw_box;
  71.   error = os_swix (SWI_Interface_Render3dWindow, ®s);
  72.  
  73.   return error;
  74. }
  75.  
  76.  
  77.  
  78.  
  79.  
  80. /* 
  81.  *============================================================================
  82.  *
  83.  * Function to allow application to use Interface pointers
  84.  *
  85.  *    Parameters :     None
  86.  *
  87.  *    Returns :        An error is not successful
  88.  *  
  89.  *============================================================================
  90.  */
  91.  
  92. os_error *Interface_Initialise (void)
  93. {
  94.   os_regset regs;
  95.   os_error  *error;
  96.  
  97.   regs.r[0] = event_taskhandle;
  98.   error = os_swix (SWI_Interface_Initialise, ®s);
  99.  
  100.   return error;
  101. }
  102.  
  103.  
  104.  
  105.  
  106.  
  107. /* 
  108.  *============================================================================
  109.  *
  110.  * Function to stop the application using pointers and remove any workspace
  111.  * used by the application
  112.  *
  113.  *    Parameters :     None
  114.  *
  115.  *    Returns :        An error is not successful
  116.  *  
  117.  *============================================================================
  118.  */
  119.  
  120. os_error *Interface_Closedown(void)              
  121. {
  122.   os_regset regs;
  123.   os_error  *error;
  124.  
  125.   regs.r[0] = event_taskhandle;
  126.   error = os_swix (SWI_Interface_Closedown, ®s);
  127.  
  128.   return error;
  129. }
  130.  
  131.  
  132.  
  133.  
  134.  
  135. /* 
  136.  *============================================================================
  137.  *
  138.  * Function to set a workarea pointer
  139.  *
  140.  *    Parameters :     pointer - a pointer block as described at the start
  141.  *                               of this header
  142.  *
  143.  *    Returns :        An error is not successful
  144.  *  
  145.  *============================================================================
  146.  */
  147.  
  148. os_error *Interface_SetWorkareaPointer(wimp_pointer pointer)
  149. {
  150.   os_regset regs;
  151.   os_error  *error;
  152.  
  153.   regs.r[1] = (int) &pointer;
  154.   error = os_swix (SWI_Interface_SetWorkareaPointer, ®s);
  155.  
  156.   return error;
  157. }
  158.  
  159.  
  160.  
  161.  
  162.  
  163. /* 
  164.  *============================================================================
  165.  *
  166.  * Function to release a workarea pointer
  167.  *
  168.  *    Parameters :     pointer - a pointer block as described at the start
  169.  *                               of this header
  170.  *
  171.  *    Returns :        An error is not successful
  172.  *  
  173.  *============================================================================
  174.  */
  175.  
  176. os_error *Interface_RemoveWorkAreaPointer (wimp_pointer pointer)
  177. {
  178.   os_regset regs;
  179.   os_error  *error;
  180.  
  181.   regs.r[0] = event_taskhandle;
  182.   regs.r[1] = (int) &pointer;
  183.   error = os_swix (SWI_Interface_RemoveWorkareaPointer, ®s);
  184.  
  185.   return error;
  186. }                              
  187.  
  188.  
  189.  
  190.  
  191.  
  192. /* 
  193.  *============================================================================
  194.  *
  195.  * Function to swap pointers when over an icon or the appropriate workarea
  196.  *
  197.  *    Parameters :     poll - the wimp poll reason code
  198.  *
  199.  *    Returns :        An error is not successful
  200.  *  
  201.  *============================================================================
  202.  */
  203.  
  204. os_error *Interface_Poll(int poll)
  205. {
  206.   os_regset regs;
  207.   os_error  *error;
  208.  
  209.   regs.r[0] = (int) poll;
  210.   regs.r[2] = event_taskhandle;
  211.   error = os_swix (SWI_Interface_Poll, ®s);
  212.  
  213.   return error;
  214. }
  215.  
  216.  
  217.  
  218.  
  219.  
  220. /* 
  221.  *============================================================================
  222.  *
  223.  * Function to send help to the help application
  224.  *
  225.  *    Parameters :     message_block - the message block from the help 
  226.  *                                     application
  227.  *
  228.  *    Returns :        An error is not successful
  229.  *  
  230.  *============================================================================
  231.  */
  232.  
  233. os_error *Interface_SendHelp(message_header *message_block) 
  234. {
  235.   os_regset regs;
  236.   os_error  *error;
  237.           
  238.   regs.r[1] = (int) message_block;
  239.   error = os_swix (SWI_Interface_SendHelp, ®s);
  240.  
  241.   return error;
  242. }
  243.  
  244.  
  245.  
  246. /* 
  247.  *============================================================================
  248.  *
  249.  * Function to get the bounding box of an icon
  250.  *
  251.  *    Parameters :     icon - the icon data of the icon
  252.  *
  253.  *    Returns :        An error is not successful
  254.  *  
  255.  *============================================================================
  256.  */
  257.  
  258. os_error *Interface_BoundingBox(icon_block *icon) 
  259. {
  260.   os_regset regs;
  261.   os_error  *error;
  262.           
  263.   regs.r[1] = (int) icon;
  264.   error = os_swix (SWI_Interface_BoundingBox, ®s);
  265.  
  266.   return error;
  267. }
  268.  
  269.