home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / program / k / procfunc / !ProcFunc / Resources / InterDoc next >
Encoding:
Text File  |  1992-07-06  |  22.4 KB  |  615 lines

  1. interface manager vsn 2.00
  2. ----------------------------------------------
  3. (c) 1990-1992, software interrupt developments
  4.     simon huntington
  5.     all rights reserved
  6.     copyright belongs to software interrupt at all times.
  7.  
  8. you are free to use interface in any commercial products free of charge.  if
  9. you feel the need to send any money to me (thanks in advance).
  10.  
  11. --------------------------------------------------------------------------------
  12.  
  13. changes from version 1.32
  14.  
  15. this version has been fully re-written using the acorn aof assembler.
  16. border type has changed to z to avoid conflicts with risc-os 3
  17. Interface_Plot3dIcon has been changed so the first parameter is a window state block instead of a window handle
  18. names has changed to interface_...., old names are still supported
  19. better redraw code to correct problems with multi-sync modes where the icons were not alligned correctly.
  20. Interface_BoundingBox now returns the state of the button 
  21. new border types
  22.  
  23. *command to allow changes in the slabbing colours.
  24.  
  25. --------------------------------------------------------------------------------
  26. This manual and software is public domain.  It may be copied and distributed freely
  27. as long as:
  28.  
  29.        It is not separated from the documentation (except for commercial use)
  30.        The module is not tampered with
  31.        You do not claim that you have written the module
  32.        Do not use any of the code contained in this module in your own code
  33.  
  34. If you wish to use this in a commercial product please contact me so that I can make 
  35. sure you have the latest release, please send a disk.
  36.  
  37. In no circumstances shall the author be liable for any damage, loss of profits, time or 
  38. data or any indirect or consequential loss rising out of the use of this software or 
  39. inability to use this software.
  40.  
  41. Contacts:
  42.        Arcade BBS          (081 654 2212)                   
  43.  
  44.        All mail on the above Bulletin Bords should be mailed to JICK
  45.  
  46. **************** Introduction ***********************************************
  47.  
  48. Interface is a small module that allows application programmers to implement a 
  49. colourful and pleasant graphical user interface.  Interface provides many more 
  50. functions that allows you to change the pointer shape easily and to interface with the 
  51. !Help or !Spy application.
  52.  
  53. The Interface module provides functions to improve the friendliness and appearance 
  54. of the application. The application should still operate as stated in  the Acorn 
  55. guidelines in the Programmers Reference Manuals.
  56.  
  57. The module implements a number of SWIs which are described further in this 
  58. manual, these SWI calls can be called from any language.  Most of the functions 
  59. provided are specified in the icons validation string, and so no complex 
  60. programming is needed to make the application look good.
  61.  
  62. This guide tells you how to fully implement the features of Interface.  It is split into 
  63. the follow sections:
  64.  
  65.         The first section explains the validation strings options provided
  66.         by Interface.
  67.         The next section gives details of the SWI calls provided.
  68.         The remaining section covers hints and tips on programming.
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. **************** Technical details ***********************************************
  76.  
  77. An indirected text icon can have a validation string which is used to pass further 
  78. information to the WIMP, such as what border type the icon has and also what 
  79. pointer, if any should be displayed whilst over this icon.  The syntax of a validation 
  80. string is:
  81.  
  82.   validation string ::- command {;command}*
  83.   command           ::- (b | z) border-type {border-spec} | 
  84.                         r on/off-type {,icon-number}* |
  85.                         u on/off-type {,icon-number}* |
  86.                         p text-string {,x} {,y} |
  87.                         i text-string |
  88.                         k key-code
  89.   border-spec       ::- {,button-slabbing-mask} {,slabbing-time} {,colour}*
  90.  
  91. The parameters above are described under the relevant validation command.
  92. In simple terms, a validation string consists of a series of 'commands', each starting 
  93. with a single letter and seperated from the following command by a semi-colon.  
  94. {}* means zero or more of the thing inside the {}.  The following commands are 
  95. available with the Interface module.
  96.  
  97. These commands are provided in addition to the standard Wimp validation strings.  
  98. I suggest that you edit the !FormEd program to allow you to enter larger validation 
  99. strings, otherwise when entering a help command you will only be allowed a 
  100. maximum of 80 characters.
  101.  
  102. The (B)order command tells Interface which border to use when rendering an icon.  
  103. The border types available at present are :
  104.  
  105.         border type 0, this is a single border used mainly for headings and action icons.
  106.         The icon will slab inwards if the user clicks a button whilst the pointer is over 
  107.         the icon providing it is not setup to ignore mouse clicks.
  108.  
  109.         border type 1, this is a double border and should be used to group together 
  110.         icons that perform an operation.
  111.  
  112.         border type 2, this is a triple border and should be used on the default action         
  113.         button.  The icon will slab inwards when the user clicks a button whilst the 
  114.         pointer is over this icon providing it is not setup to ignore mouse clicks.
  115.  
  116.         border type 3, this is a wide inverted border and should be used on writable
  117.         icons.  This border type is usually used in-conjunction with the writable
  118.         pointer.
  119.         
  120.         border type 4, this is an inverted version of border type 0
  121.         
  122.         border type 5, this is a double wide border as used by acorn in ros 3
  123.         
  124.         border type 6, etched in border
  125.         
  126.         border type 7, similar to border type 0, thinner in mode 20
  127.  
  128. The second optional parameter is the button slabbing mask, this states whether the 
  129. icon should be slabbed until the button is released.  The values contained in this 
  130. parameter can be from 0 to 7.  The button slabbing mask can be calculated in the 
  131. following way:
  132.  
  133.         Value   Button          Meaning
  134.         1       Adjust  slab icon until adjust is released
  135.         2       Menu    slab icon until menu is released
  136.         4       Select  slab icon until select is released
  137.  
  138. The button slabbing mask can then be calculated by adding together the required 
  139. button values.  
  140.  
  141. The button slabbing time is the minimum time that the icon will be slabbed for, the 
  142. default time is for 15cs.  This value is a decimal number in centi-seconds.
  143. The colours are specified in the following order:
  144.  
  145.         {,border colour1} {,border colour2} {,slabbing out colour} 
  146.         {,slabbing in colour} {,inner channel colour}
  147.  
  148. These colours can be any valid WIMP colour in the range of 0 to 15, the default 
  149. selection is 4, 0, 1, 14, 12.
  150.  
  151. The (R)adio command specified in the validation string is used to set the state of 
  152. other radio button type icons.  The R command is followed by a decimal number in 
  153. the range 0 to 2, the action that these perform is:
  154.  
  155.         Radio type              Operation
  156.         0               this has the effect of switching off the specified icon(s).
  157.         1               this has the effect of switching on the specified icon(s).      
  158.         2               this has the effect of toggling the icons current state.
  159.  
  160. This command is then followed by the numbers of the icons you wish to alter, these 
  161. should be separated by commas.  This command may be specified more than once in 
  162. a validation string, for example to switch icons 1 & 2 off, 3 & 4 on and toggle the 
  163. state of icons 5 & 6 you could use the following validation string
  164.  
  165.         R0,1,2;R1,3,4;R2,5,6
  166.  
  167. The (U)nselectable command in the validation string has the effect of shading the 
  168. icon grey so that it cannot be selected by the user.  It is followed by a decimal 
  169. number in the range 0 to 2, the action that these is described above in the radio 
  170. command.
  171.  
  172. This command is then followed by the numbers of the icons you wish to alter, these 
  173. should be separated by commas.  This command may be specified more than once in 
  174. a validation string, for example to shade icons 1 & 2, un-shade 3 & 4 and toggle the 
  175. state of icons 5 & 6 you could use the following validation string
  176.  
  177.         U0,1,2;U1,3,4;U2,5,6
  178.  
  179. The (P)ointer command is used to define a pointer to be displayed when the pointer 
  180. is over that icon.  The first parameter is a sprite name to use for the pointer, this 
  181. should be no longer than 12 characters and should be present in the WIMP sprite 
  182. pool.  The optional parameters specify the x and y offsets to the active point in the 
  183. sprite, these should be specified in pixels.
  184.  
  185. The (I)nformation command is used to define a message to be sent to the interactive 
  186. help application when the pointer is over the icon.  If you wish to use a semi-colon 
  187. then you must place two next to each other.  The maximum length of the help 
  188. message is 235 characters.
  189.  
  190. The Interface module will change to the specified pointer when the mouse pointer is 
  191. over the icon/workarea, if no pointer is specified then the pointer will default to 
  192. shape one (the default arrow shape).  There are 5 pointer shapes designed in the 
  193. sprite file in the !Interface directory, these are:
  194.  
  195.         ptr_write - this pointer should be used on writable icons, the suggested active
  196.         point is at coordinates x = 4, y = 4.
  197.  
  198.         ptr_menu - this pointer is used where a menu can be activated by pressing the
  199.         menu button over the icon.  This stops the user having to search all over the
  200.         window to find where the menu is. The suggested active point is x = 6, y = 5.
  201.  
  202.         ptr_direct - this pointer is used where an object may be re-sized, the suggested
  203.         active point is at x = 13, y = 7.
  204.  
  205.         ptr_hand - this pointer is used where and icon may be dragged.  It is usually set
  206.         on the workarea, but it can be used on any icon (the save file icon looks great
  207.         when using it), its suggested active point is at x = 12, y = 8.
  208.  
  209.         ptr_cross - this pointer is used as a crosshair, it is the same as the one used in the
  210.         Draw application.  This icon gives the user a precise point when working with
  211.         line drawings, its suggested active point is at x = 13, y = 7.
  212.  
  213. You may also design your own pointers, which should be loaded into the WIMP 
  214. sprite pool.  There are a few points that you should note when designing pointers 
  215. these are :
  216.  
  217.         Pointer sprite names should have the form ptr_XXXXX, although this is not
  218.         compulsory it helps so that you do not get confused with pointers and normal
  219.         sprites.
  220.  
  221.         Do not use logical colour 2 in the pointer sprites, as this is unavailable in very
  222.         high resolution modes.
  223.  
  224. The pointers used should only be valid in your application, so you must not mask 
  225. out the Pointer_Leaving_Window in your application.  You should claim 
  226. Null_Reason_Code when passed to your application, otherwise the pointer will not 
  227. change when the pointer is over the icon/workarea, see the examples for more.
  228.  
  229. You should support the !Help application to help new users using your application, 
  230. this is why I implemented a feature in Interface to make this easier.  The following 
  231. was for some reason not published in the Programmers Reference Manuals, but was 
  232. in the pre-release disc version of the manuals.
  233.  
  234. For an application to use interactive help, two WIMP messages are employed.  One 
  235. is used by the Help to request help, and the other is used by the application to return 
  236. the help message.
  237.  
  238. To request help, the Help application sends a message of the following form:
  239.  
  240. block   +16     &502 - indicates request for help
  241.                 +20     mouse x co-ordinate
  242.                 +24     mouse y co-ordinate
  243.                 +28     mouse button state
  244.                 +32     window handle               (-1 if not over a window)
  245.                 +36     icon handle                 (-1 if not over an icon)
  246.  
  247. The WIMP system will pass this message automatically to the task in charge of the 
  248. appropriate window/icon.  If the application receiving the message wishes to produce 
  249. some help, it should respond with the following message:
  250.  
  251. block   +16     &503
  252.                 +20     help message terminated by 0
  253.  
  254. This message can be sent to the Help application by using Wimp_SendHelp, which 
  255. is provided by the Interface module (SWI &81687).
  256.  
  257. The help text may  contain any printable character codes.  If the sequence |M is 
  258. encountered then this will be treated as a line break and subsequent text will be 
  259. printed on the next line in the window.  If the text is too long for one line then it will 
  260. be split at a word boundary (space character).
  261.  
  262. The text should consist of  simple complete English sentences, each starting on a 
  263. new line and ending with a full stop.  The sentences should usually be simple 
  264. imperatives or information such as:
  265.  
  266.         Click SELECT to set the alarm.
  267.  
  268.         You are in Select mode.
  269.  
  270.         Click ADJUST to change to path edit mode.
  271.  
  272.         This is the icon for Edit.
  273.  
  274. In general you need not mention menu entries, except when specific ones interact 
  275. with pointer operations.  As a general rule present information of interest to the 
  276. beginner near the top, and expert tips or information lower down.
  277.  
  278. You must use the terminology defined.  For mouse operations you must use initial 
  279. capitals (for example Click).  The mouse buttons must be in capitals (for example 
  280. SELECT), as must key names (for example ESC, RETURN, SHIFT, CONTROL, A, B, F1, 
  281. COPY).  miss out speedups and shortcuts - just provide enough to help a beginner 
  282. without drowning them with information.
  283.  
  284. Provide interactive help thoroughly - include the icon bar, and the workarea of all 
  285. your windows.  If no actions are possible in a window, just
  286.  
  287.         This window shows....
  288.  
  289. if better than nothing.
  290.  
  291. You should assume a user knows:
  292.  
  293.         what a MENU key is
  294.         how to navigate menu trees and choose entries
  295.         what the icon bar is
  296.         how to move/size/toggle/close windows, and so on
  297.         what 'dragging an icon' means
  298.         what 'filling in a field' (writable icon) means
  299.  
  300. The keycode command should be placed in the icon that is activated by the 
  301. keycode.  It should be a decimal integer specifying the key.  The up/down
  302. arrows, tab etc.. are dealt with.
  303.  
  304.  
  305. **************************** The SWI Calls *********************************
  306.  
  307. Wimp_BorderIcon (Interface_SlabButton) (SWI &81680)
  308.  
  309. R1 = pointer to block
  310. R1 preserved
  311.  
  312. Interrupts are not defined
  313. Fast interrupts are enabled
  314.  
  315. Processor is in SVC mode
  316.  
  317. SWI is not re-entrant
  318.  
  319. The block contains the following on entry:
  320.  
  321.         R1+0    mouse x (screen coordinates - not window relative)
  322.         R1+4    mouse y
  323.         R1+8    buttons (depending on icon button type)
  324.         R1+12   window handle
  325.         R1+16   icon handle  
  326.  
  327. This call is used to update an icons border.  It is typically called as a result of a 
  328. Mouse_Click event, if the icon has a border type of 0 or 2 then the icon will slab 
  329. inwards.  The format of the validation string is described n the previous section.
  330.  
  331. The application should the perform the task and then force the icon to normal status 
  332. by calling Wimp_BorderIcon (SWI &81680) with R1+8 set to 0.
  333.  
  334. The code to border icons and windows is outlined in the section Programming 
  335. Interface. 
  336.  
  337. Note that the mouse coordinates specified in R1+0 and R1+4 are not used by the 
  338. SWI and are only present to make the block compatible with a Mouse_Click event 
  339. block.
  340.  
  341. Wimp_BorderWindow (SWI &81681)
  342.  
  343. None
  344.  
  345.  
  346.  
  347.  
  348.  
  349. Wimp_BorderWindow (Interface_Render3dWindow) (SWI &81681)
  350.  
  351. R1 = pointer to block
  352. R1 preserved
  353.  
  354. Interrupts are not defined
  355. Fast interrupts are enabled
  356.  
  357. Processor is in SVC mode
  358.  
  359. SWI is not re-entrant
  360.  
  361. The block contains the following on entry:
  362.  
  363.         R1+0    window handle
  364.         R1+4    visible area minimum x coordinate
  365.         R1+8    visible area minimum y coordinate
  366.         R1+12   visible area maximum x coordinate
  367.         R1+16   visible area maximum y coordinate
  368.         R1+20   scroll x offset relative to work area origin
  369.         R1+24   scroll y offset relative to work area origin
  370.         R1+28   current graphics window minimum x coordinate
  371.         R1+32   current graphics window minimum y coordinate
  372.         R1+36   current graphics window maximum x coordinate
  373.         R1+40   current graphics window maximum y coordinate
  374.  
  375. This call is used to redraw the borders of icons in the window that are not up-to-date,  
  376. this SWI is typically called during the redraw loop of a window.  The SWI will 
  377. update the window, drawing borders around any icons which have the b command 
  378. specified in the validation string and are within the specified graphics window.
  379.  
  380. The code to border icons and windows is outlined in the section Programming 
  381. Interface. 
  382.  
  383. Wimp_BorderIcon (SWI &81680)
  384.  
  385. None 
  386.  
  387.  
  388.  
  389.  
  390. Wimp_ClaimInterface (Interface_Initialise) (SWI &81682)
  391.  
  392. R0 = task handle
  393. R0 preserved
  394.  
  395. Interrupts are not defined
  396. Fast interrupts are enabled
  397.  
  398. Processor is in SVC mode
  399.  
  400. SWI is not re-entrant
  401.  
  402. This SWI allows your application to use pointers via the Interface module.  This 
  403. SWI should be called at the beginning of your program.  If you don't use 
  404. Wimp_ClaimInterface then your pointers will not be displayed.
  405.  
  406. Wimp_ReleaseInterface (SWI &81683)
  407.  
  408. None
  409.  
  410.  
  411.  
  412.  
  413. Wimp_ReleaseInterface (Interface_CloseDown) (SWI &81683)
  414.  
  415. R0 = task handle
  416. R0 preserved
  417.  
  418. Interrupts are not defined
  419. Fast interrupts are enabled
  420.  
  421. Processor is in SVC mode
  422.  
  423. SWI is not re-entrant
  424.  
  425. This SWI stops your application from using pointers.  When this SWI is called 
  426. Interface Manager will erase any workarea pointers assigned to your application and 
  427. free the memory.  This should be called in your exit handler, also if an error occurs 
  428. you should also call this SWI to stop other applications from gaining your pointers.
  429.  
  430. Wimp_ClaimInterface (SWI &81682)
  431.  
  432. None
  433.  
  434.  
  435.  
  436.  
  437. Wimp_SetWorkareaPointer (Interface_SetWorkareaPointer) (SWI &81684)
  438.  
  439. R1 = pointer to block
  440. R1 preserved
  441.  
  442. Interrupt status is undefined
  443. Fast interrupts are enabled
  444.  
  445. Processor is in SVC mode
  446.  
  447. SWI is not re-entrant
  448.  
  449. The block contains the following on entry:
  450.  
  451.         R1+0    window handle
  452.         R1+4    minimum x coordinate of bounding box
  453.         R1+8    minimum y coordinate of bounding box
  454.         R1+12   maximum x coordinate of bounding box
  455.         R1+16   maximum y coordinate of bounding box
  456.         R1+20   24 bytes of pointer data
  457.  
  458. This specifies the pointer for an area of the window.
  459. The bounding box coordinates are given relative to the window's work area origin.  
  460. R1+4 to R1+16 can be set to -1 to specify the whole of the window's work area.
  461. The pointer data at +20 to +44 contains the sprite name and any x, y offset, see 
  462. validation strings for more information.
  463.  
  464. Wimp_RemoveWorkareaPointer (SWI &81685)
  465. Wimp_PollPointer (SWI &81686)
  466.  
  467. None
  468.  
  469.  
  470.  
  471.  
  472.  
  473. Wimp_RemoveWorkareaPointer (Interface_RemoveWorkareaPointer) (SWI &81685)
  474.  
  475. R0 = task handle
  476. R1 = pointer to block
  477.  
  478. R0 preserved
  479. R1 preserved
  480.  
  481. Interrupt status is undefined
  482. Fast interrupts are enabled
  483.  
  484. Processor is in SVC mode
  485.  
  486. SWI is not re-entrant
  487.  
  488. The block contains the following on entry:
  489.  
  490.         R1+0    window handle
  491.         R1+4    minimum x coordinate of bounding box
  492.         R1+8    minimum y coordinate of bounding box
  493.         R1+12   maximum x coordinate of bounding box
  494.         R1+16   maximum y coordinate of bounding box
  495.  
  496. This call removes a previously installed pointer from the list of active pointer areas 
  497. for the specified window.  When a window is deleted you should remove any 
  498. pointers that were related to the window, otherwise these pointers may become 
  499. active on any window which gains the same window handle in the future. 
  500.  
  501. The bounding box coordinates are given relative to the window's work area origin.  
  502. R1+4 to R1+16 can be set to -1 to specify the whole of the window's work area.  
  503. R1+4 to R1+16 may be set to 0 to remove all work area pointers assigned to the 
  504. window.
  505.  
  506. Wimp_SetWorkareaPointer (SWI &81684)
  507. Wimp_PollPointer (SWI &81686)
  508.  
  509. None
  510.  
  511.  
  512.  
  513.  
  514.  
  515. Wimp_PollPointer (Interface_Poll) (SWI &81686)
  516.  
  517. R0 = Wimp_Poll reason code
  518. R2 = task handle
  519.  
  520. R0 preserved
  521. R@ preserved
  522.  
  523. Interrupt status is undefined
  524. Fast interrupts are enabled
  525.  
  526. Processor is in SVC mode
  527.  
  528. SWI not re-entrant
  529.  
  530. This call checks to see if the pointer is up-to-date.  If the pointer is not up-to-date it 
  531. will change to the pointer specified in the icons validation string.  If the pointer is 
  532. not over an icon then  the pointer will change according to the position on the 
  533. window background.
  534.  
  535. Note that wimp_poll reason codes 0 and 4 should not be masked out, otherwise the 
  536. pointer will be out-of-date and will not function correctly.
  537.  
  538. Wimp_SetWorkareaPointer (SWI &81684)
  539. Wimp_RemoveWorkareaPointer (SWI &81685)
  540.  
  541. None
  542.  
  543.  
  544.  
  545.  
  546.  
  547. Wimp_SendInformation (Interface_SendHelp) (SWI &81687)
  548.  
  549. R1 = message block as returned from help application
  550. R1 preserved
  551.  
  552. Interrupt status is undefined
  553. Fast interrupts are enabled
  554.  
  555. Processor is in SVC mode
  556.  
  557. SWI not re-entrant
  558.  
  559. This call returns a help text message to the interactive help application.  It should be 
  560. called when a message with the number &502 is received and the pointer is over an 
  561. icon.  If there is a message in the icons validation string that the pointer is currently 
  562. over then this will be sent to the help application.  It is up to the applications 
  563. programmer to take care of the help message when the pointer is over the icon on the 
  564. icon bar or is over the window workarea. 
  565.  
  566. None
  567.  
  568. None
  569.  
  570.  
  571. Wimp_PreProcessKey (Interface_PreProcessKey) (SWI &81688)
  572.  
  573. R0 = event type
  574. R1 = event block
  575. R2 = task handle
  576.  
  577. R0 = updated to new event type
  578. R1 = updated event block
  579. R2 = 0 if event was not dealt intercepted
  580.  
  581. This call pre-processes the up, down, tab, shift-tab keys and any specified in a specific icons
  582. validation string using the command k<keycode>.  The SWI will move icon, if neccessary or activate
  583. a button.  This call sould be called after the wimp_poll command, it will match the key to an icon
  584. and if neccessary modify your wimp poll block and event type.
  585.  
  586.  
  587. Wimp_BorderPlotIcon (Interface_Plot3dIcon) (SWI &81689)
  588.  
  589. R0 = window state (either from wimp_update/redraw or from a wimp_getwindowstate)
  590. R1 = icon block as for Wimp_PlotIcon
  591.  
  592. This call plots a border on a window like Wimp_PlotIcon.  The icon block passed in R1
  593. should contain a block as described for Wimp_PlotIcon in the PRMs.
  594.  
  595. Wimp_BorderBoundingBox (Interface_BoundingBox) (SWI &8168A)
  596.  
  597. R1 = icon block as for Wimp_PlotIcon
  598.  
  599. R1 = updates icon block
  600.           
  601.           offset
  602.           0         min x
  603.           4         min y
  604.           8         max x
  605.           12        max y
  606.           16        border width
  607.           20        button slab state (1 = out, 0 = in)
  608.  
  609. This call returns information about the icon block passed to it.  If you wish to
  610. get the size of an icons box use Wimp_GetIconState and then pass the icon block 
  611. returned to this function.
  612.  
  613.  
  614.  
  615.