home *** CD-ROM | disk | FTP | other *** search
-
- Wimp a FORTRAN subroutine library for Wimp handling 30 Jan 1992
-
- ************************************************************************
-
- C O P Y R I G H T N O T I C E
-
- Copyright D.J & K.M. Crennell,
- P.O. Box 64, Didcot, Oxon, OX11 0TH.
-
- This software is in the Public Domain and may not be sold or included in
- any program that will be sold, without written permission from the authors.
- The authors must be given credit in any publications using this software.
-
- The software may be copied and distributed as long as no changes are made
- and this copyright notice is included. Please send any suggested
- improvements to the authors.
-
- In no circumstances shall the authors be liable for any damage, loss of
- profits, or any indirect or consequential loss arising out of the use of
- this software or inability to use this software, even if they have been
- advised of the possibility of such loss.
-
- The authors do their best to ensure that this library is distributed virus
- free.
- ************************************************************************
-
- The source of this library is assembler, and is not included.
- The library is %.lib.Wimp
-
- **** Note the calling sequence to WMPI has changed on 26 Jan 1992 ****
-
- This writeup is a description of the routines available; it does not
- show you how to write a Wimp program. For such a tutorial, try one of
- the many Archimedes oriented magazines which have series of articles on
- "programming the wimp". These are usually in the Basic language, but
- the ideas are immediately applicable to Fortran using this wimp
- library.
-
- Notes:
- 1) This library has a set of routines corresponding exactly to the Wimp
- SWIs, and also some utilities to simplify their use.
- 2) All subroutine names begin WMP (unless the routine is a utility).
- 3) the remaining characters are the capital letters of the corresponding
- SWI. They are listed alphabetically except that the utilities are
- listed at the end.
- 4) All arguments are of type INTEGER*4 except for a few CHARACTER
- variables which are shown in lower case. In the descriptions CHARACTER
- variables are enclosed in quotes. You may assume that they are input to
- the routine unless otherwise stated.
- 5) Errors in the Wimp Library and normal fortran runtime errors are
- displayed in the standard wimp error window. Clicking on 'Cancel' stops
- the job; clicking on 'OK' returns control to the program at the point
- where WMPP (Wimp_Poll) was called for the first time.
- For this reason it is important that the polling loop is all in the
- same routine which also calls WMPCD (Wimp_CloseDown). Subroutines may
- be called from within the polling loop.
- E.g.
- ....
- 10 CALL WMPP(1,IBLOC,IREASN)
- IF (IREASN.EQ.3) CALL WMPCW(IBLOC(1))
- IF (IREASN.EQ.6) CALL BUTTON
- etc.
- ....
- IF(.NOT.QUIT) GO TO 10
- CALL WMPCD
- ....
-
- 6) Terminating a program with END or STOP will call WMPCD (Wimp_CloseDown)
- implicitly, though it is not good practice to leave out the explicit
- call. Terminating with STOP 'text' will do the same, but then display a
- standard text window showing STOP: 'text' and the usual request to
- press space or click the mouse to continue.
- 7) Communication with the WIMP is usually through the array IBLOC which
- will often require individual bytes to be set up. The length of IBLOC
- is specified in the writeup whenever it is used.
- 8) The first line for each description contains the subroutine name, with
- arguments, the exact spelling of the SWI and the page reference in
- Vol III of the PRM.
- 9) A Fortran utility, SAVEBX, for creating and using Drag Boxes is
- included in the test file TWimp. It has 2 entry points, SAVEMN, to
- create the menu window with its sprite, and SAVEBX to make the file and
- save it to your chosen directory. See the comments in TWimp for further
- details.
- 10) Standard OS units are always used for the graphics coordinates.
-
-
- ******************* S W I R o u t i n e s *********************
-
- WMPBC(IWHAND,IX,IY,MX,MY,JX,JY) ; SWI Wimp_BlockCopy 1273
- Copies the rectangular area within the window with handle IWHAND.
- IX,IY is the lower left corner of the area to be copied
- MX,MY is the upper right
- JX,JY is the lower left corner of the area to which it is copied.
- The coordinates are relative to the window's work area.
-
- WMPBOS(IROM,IRMA) ; SWI Wimp_BaseOfSprites 1272
- Returns the addresses of the two areas which make up the Wimp Sprite
- pool.
- IROM is the address of the ROM based sprites
- IRMA is the address of the RAM based sprites
- It is possible to use these in Fortran! E.g.
- DIMENSION KB(1)
- CALL WMPBOS(IROM,IRMA)
- C get the index to IROM in array KB
- J=(IROM-LOC(KB))/4+1
- C print the first two words of the Sprite block
- PRINT *,'Size ',KB(J),', # sprites ',KB(J+1)
-
- WMPCD ; SWI Wimp_CloseDown 1241
- This closes down the wimp task at the end of the job.
-
- WMPCFM ; SWI Wimp_ClaimFreeMemory 1279
- Unfortunately the memory can only be accessed in "Supervisor mode"
- (SVC) and so can not be used by fortran programs. These run in "User mode"
- only. Hence this routine is not provided in the library.
-
- WMPCI(IBLOC,IHANDL) ; SWI Wimp_CreateIcon 1180
- Creates an icon in a window from the information you supply in IBLOC;
- this is 36 bytes (9 words) long. The first word contains the window handle
- where the icon is to go, or -2 for left end of the icon bar, -1 for the
- right. The remaining 8 words are called the 'icon block' and contain
- information on the dimensions of the icon, its colours, its text and flags.
- IHANDL is the returned icon handle (unique within a window).
-
- WMPCLW(IHANDL) ; SWI Wimp_CloseWindow 1191
- Closes the window IHANDL
-
- WMPCM(MBLOC,IX,IY) ; SWI Wimp_CreateMenu 1226
- Displays a menu tree from:
- MBLOC: an array containing the menu; this is 7 words long plus 6 words for
- each menu entry. MBLOC can be made most easily using the WMPMNU
- utility below. If the first or only word of MBLOC is -1, all active
- menus will be closed.
- IX,IY: is the top left corner (in screen coordinates) of where you want to
- put the menu.
-
- WMPCOW(IOPER) ; SWI Wimp_CommandWindow 1280
- Opens a text window for normal VDU 4 type printing.
- IOPER = LOCC(...) pointer to a null terminated CHARACTER string to be
- used as a title for the window
- = 1 print wimp error reports textually;
- = 0 close text window with 'Press SPACE or click mouse...' comment;
- =-1 close text window immediately.
-
- WMPCRW(IBLOC,IHANDL) ; SWI Wimp_CreateWindow 1174
- Creates a wimp window from the information in IBLOC; this is usually
- 88 bytes (22 words) long and contains all the information on the dimensions
- of the window, its colours, its title and flags. It does not actually
- display the window, just sets it up.
- IHANDL is the returned handle for the window.
-
- WMPCSM(ISUBM,IX,IY) ; SWI Wimp_CreateSubMenu 1270
- This allows a sub-menu to be created in other ways than the usual one of
- moving to the right over a menu arrow. (See also PRM 1253 on the menu
- warning message).
- ISUBM is the address of the array containing the submenu information.
- (Note, this is not the array itself, but a pointer to it).
- IX,IY are the coordinates of the top left of the menu.
- These 3 arguments are normally those returned in words 6, 7 & 8 of the
- WimpPoll block when issuing the message (type ?I0400C0) that the pointer is
- moving over the menu arrow.
-
- WMPCT ; SWI Wimp_CloseTemplate 1237
- Closes currently open template file (if any).
-
- WMPDB(IBLOC) ; SWI Wimp_DragBox 1216
- Initiates a dragging operation. IBLOC is 14 words long.
- IBLOC(1) usually contains the window handle, but if it is set negative,
- then the drag is cancelled. E.g. CALL WMPDB(-1)
- IBLOC(2) contains the drag type (1 to 11) and controls what is needed in
- the other words, see PRM 1216.
-
- WMPDI(IBLOC) ; SWI Wimp_DeleteIcon 1189
- Deletes an icon definition.
- IBLOC(1) : the window handle (-1 or -2 for icon bar)
- IBLOC(2) : the icon handle
-
- WMPDM(MBLOC,LIST,string,LEN) ; SWI Wimp_DecodeMenu 1231
- Textually describes the entries of a selected menu tree.
- MBLOC : the top level menu
- LIST : the array of selections as returned by WimpPoll reason 9.
- It returns:
- string: the information as a CHARACTER variable with the entries separated
- by '.' ('string' must be defined sufficiently large)
- LEN : the length of string
-
- WMPDW(IWHAND) ; SWI Wimp_DeleteWindow 1188
- Closes the window with handle IWHAND, and removes its definition and all
- the icons belonging to it.
-
- WMPFR(IHANDL,IX,IY,MX,MY) ; SWI Wimp_ForceRedraw 1221
- Marks a rectangle as invalid so that the wimp will ask for it to be
- redrawn.
- IHANDL: the window handle, or -1 will force the whole screen to be redrawn.
- IX,IY : the bottom left corner
- MY,MY : the top right corner, (in window work area coordinates)
-
-
- WMPGCP(IBLOC) ; SWI Wimp_GetCaretPosition 1225
- Returns details of the caret's state in IBLOC(1) to IBLOC(6).
-
- WMPGIS(IBLOC) ; SWI Wimp_GetIconState 1213
- This returns the 'icon block' (see WMPCI) of an icon
- IBLOC(1) : the window handle
- IBLOC(2) : the icon handle (they are not changed by WMPGIS)
- It returns the icon block in IBLOC(3) to IBLOC(10), hence IBLOC is 10
- words long,
-
- WMPGPI(IBLOC) ; SWI Wimp_GetPointerInfo 1214
- Returns the following mouse information in IBLOC (5 words long)
- 1. Mouse X
- 2. Mouse Y
- 3. Which buttons are pressed
- 4. Window handle (=-1 for background, =-2 for Icon bar)
- 5. Icon handle (if negative it refers to one of the control icons around the
- periphery of the window; see PRM 1215)
-
- WMPGR(IBLOC,MORE) ; SWI Wimp_GetRectangle 1208
- Used when the Wimp needs help drawing a part of a window. It has the
- same arguments as WMPRW.
- IBLOC(1) : the window handle
- It returns
- IBLOC(2) to IBLOC(11) defining the area to be redrawn
- MORE : =0 for no more to draw, <>0 requesting filling of the area
-
- WMPGWI(IBLOC) ; SWI Wimp_GetWindowInfo 1210
- Gets the whole window block including any icons which have been included
- in it. Set DIMENSION IBLOC(0:N) where N = 22 + 8 * (Number of icons)
- IBLOC(0) : Window handle
- It returns:
- IBLOC( 1) to IBLOC(22) standard window information (defined in PRM p1174)
- IBLOC(23) to IBLOC(30) first icon block (defined in PRM p1180)
- and similar blocks for other icons
-
- WMPGWO(IBLOC) ; SWI Wimp_GetWindowOutline 1245
- Determines the bounding box of a window. DIMENSION IBLOC(5)
- IBLOC(1) : the window handle
- It returns
- IBLOC(2),IBLOC(3) : the bottom left corner of the window
- IBLOC(4),IBLOC(5) : the top right corner of the window
- both in screen coordinates
-
- WMPGWS(IBLOC) ; SWI Wimp_GetWindowState 1209
- Finds the current state of a window. DIMENSION IBLOC(9)
- IBLOC(1) : the window handle
- It returns
- IBLOC(2) to IBLOC(9) describing the window state. The first 8 words of
- IBLOC are then exactly in the format required to open the window using
- WMPOW(IBLOC).
-
- WMPI(title,ITHAND) ; SWI Wimp_Initialise 1173
- Starts the Wimp task and turns on the pointer
- title : CHARACTER string (the name used in the Application Task display)
- It returns:
- ITHAND : the task handle
-
- WMPLT(IWB,ICONS,L,IFONT,name,IP) ; SWI Wimp_LoadTemplate 1238
- Loads a window definition from the template file which has been opened
- with WMPOT.
- name : (CHARACTER*12), the window name to search for. It may have
- 'wildcards' and will be updated to the actual name found. It must therefore
- be a variable, and not be text between quotes. If it has less than 12
- significant characters, it should be null terminated, BUT the character
- variable MUST be 12 long because WMPLT always returns 12 characters of the
- new name.
- IP : the position in the file to start the search. Set this to 0
- initially to start at the beginning. It will be updated to point to the next
- entry after the one found, or will remain 0 if none are found.
- IFONT: = -1 if no font reference information is required
- or an array of 64 words, all initialised to zero, for font
- reference information
- It returns:
- IWB : an array giving the window definition. It must be 22 words long, + 8
- for each icon.
- ICONS: an array of length L for the indirected icons. The subroutine
- updates L to be the length of the unused space in ICONS after the icon text
- has been loaded. It should be long enough to contain the text of all the
- indirected icons in the window.
- IFONT: is a 64 word font reference array.
-
- WMPOT(name) ; SWI Wimp_OpenTemplate 1236
- Open the template file
- name : (CHARACTER) the file path name
-
- WMPOW(IBLOC) ; SWI Wimp_OpenWindow 1190
- Makes a window 'active' (displayed).
- IBLOC : 8 word array describing the state of the window which are best set
- up using WMPGWS. The first word is the window handle, and the rest describe
- the current dimensions.
-
- WMPP(MASK,IBLOC,IRSN) ; SWI Wimp_Poll 1192
- Steers the whole wimp operation after the creation of windows, icons and
- menus; it should be called at the start of an infinite loop.
- MASK : set of bits which can stop the Wimp polling for some of the possible
- 'reasons'.
- It returns:
- IRSN : the reason why it requires some help (e.g. drawing stuff in a
- window)
- IBLOC: an array of parameters for the task which needs doing. The longest
- arrays returned can be messages containing an indefinite length path name
- which starts in word 12. If you are not doing any data transfer message
- protocols, (file drags etc.), then an array of 10 words is sufficient.
-
- WMPPK(KEY) ; SWI Wimp_ProcessKey 1240
- Passes the ASCII character KEY to the Wimp. This should be done if the
- task receives a Key_Press signal (8) in its WimpPoll, and does not want to
- process the key press itself.
-
- WMPPLI(IBLOC) ; SWI Wimp_PlotIcon 1248
- Plots an icon in a window during a redraw or update.
- IBLOC is an 8 word array containing the usual icon spatial information,
- flags and data (see PRM 1180 et seq.).
-
- WMPPOI(MASK,IBLOC,IRSN,ITIME) ; SWI Wimp_PollIdle 1246
- This is the same as WMPP, except that it does not return until ITIME
- centiseconds have passed for a null event. This is useful if you want to
- update some information infrequently without wasting Wimp time.
-
- WMPRE(IERR,errtxt,IFLAG,name,IREPT) ; SWI Wimp_ReportError 1243
- This produces the familiar red triangle warning window.
- IERR : is your error number;
- errtxt: is your error description (CHARACTER <232 bytes);
- IFLAG : is a 7-bit word which controls what icons are displayed. Set bit
- 0(1) to turn on the OK(Cancel) boxes. The rest of the bits are
- explained in detail on page 1244 of the PRM;
- name : is a title for the application (CHARACTER <20 bytes)
- IREPT : is returned: 0 if no click, 1 if 'OK' selected, and 2 if 'Cancel'.
-
- WMPRP(IRED,IGREEN,IBLUE) ; SWI Wimp_ReadPalette 1251
- Gets the Wimp palette colours.
- It returns:
- IRED : an array of 20 words giving the red part of the palette. The colours
- have values between 0 and 255; normally only multiples of 16 are used.
- IGREEN : a similar array of green colours
- IBLUE : a similar array of blue colours
- The first 16 words of each array are the normal wimp colour definitions (see
- WMPSC). The last four contain the border colour and the three pointer
- colours.
-
- WMPRPT(ISTYP,ISB,name,ISCALE,ITRANS) ; SWI Wimp_ReadPixTrans 1277
- Reads the pixel translation table for a sprite.
- ISTYP tells where the sprite is:
- =-1: sprite is in system area, 'name' must be defined
- =0 : sprite is in wimp area, 'name' must be defined
- or it can be a user sprite array
- ISB tells where the sprite is stored (only for user sprites)
- =0 : sprite is defined by 'name'
- >0 : byte displacement of the sprite in the user sprite array
- ('name' is ignored)
- name : CHARACTER name of the sprite
- (ignored if ISB>0, but should be set to ' ')
- It returns:
- ISCALE (array length 4) the scale factors:
- (1), (2) = x,y multiplication factors
- (3), (4) = x,y division factors
- ITRANS (array of maximum size 4) the colour translations as up to 16 bytes.
- (Note that sprites can not have 256 colours).
-
- WMPRSI(ITEM,IVAL) ; SWI Wimp_ReadSysInfo 1284
- Gets Wimp system information
- ITEM : =0 get the number of active tasks. No other items of information
- have yet been defined by Acorn.
- It returns:
- IVAL : value of the information required (the number of active tasks).
-
- WMPRW(IBLOC,MORE) ; SWI Wimp_RedrawWindow 1204
- When WMPP returns reason code 1 (redraw window), call WMPRW first to
- find out what has to be done.
- IBLOC(1) : the window handle
- It returns
- IBLOC(2) to IBLOC(11) : information about the window, and which area is to
- be drawn. (A graphics window will have been set for the area, so you can
- draw your whole screen and it will do no harm.)
- MORE : = 0 if there is no more to draw
- : <>0 requests that the area defined by IBLOC be filled.
- Having filled in the required area, find if there is any more to be filled
- by CALLing WMPGR with the same arguments; MORE =0 when there
- are none left and the redrawing is complete.
-
- WMPSC(IACT,ICOL,IBAK) ; SWI Wimp_SetColour 1252
- Sets the colour for drawing in a normal window. It uses the standard
- Wimp colours.
- IACT : the GCOL action (must be between 0 and 7) (PRM p247)
- ICOL : the colour (must be between 0 and 15)
- IBAK : 0 to define the foreground and 1 the background colour
- The GCOL actions are:
- 0: plot with the colour 1: OR the colour with the screen
- 2: AND the colour with the screen 3: EOR the colour with the screen
- 4: invert the current colour 5: no change to the screen
- 6: AND the screen with the complement of the colour
- 7: OR the screen with the complement of the colour
- The standard Wimp colours (PRM 1147) are:
- 0: White - through grey scale to - 7: Black
- 8: Dark Blue 9: Yellow 10: Green 11: Red
- 12: Cream 13: Army green 14: Orange 15: Light Blue
-
- In 256 colour modes use standard graphics subroutine
- GCOLT(IACT,ICOL,ITNT64), but don't play with VDU19.
-
- WMPSCP(IWHAND,IIHAND,IX,IY,IH,INDEX) ; SWI Wimp_SetCaretPosition 1223
- Moves or removes the caret.
- IWHAND: window handle (-1 turns off caret)
- IIHAND: icon handle (-1 if none)
- (IX,IY): offset of caret (relative to work area origin)
- IH: height of caret (-1 means calculate IX,IY,IH from handles and INDEX)
- INDEX: position in string (-1 means calculate IH & INDEX from handles, IX &
- IY)
-
- WMPSE(IWHAND,IBLOC) ; SWI Wimp_SetExtent 1233
- Resets the work area of window
- IWHAND : window handle
- IBLOC is an array of dimension 4
- IBLOC(1),IBLOC(2) are the coordinates of the bottom left corner
- IBLOC(3),IBLOC(4) are the coordinates of the top right corner
- usually these will be (0, -ysize, xsize, 0)
-
- WMPSFC(ICFOR,ICBAC) ; SWI Wimp_SetFontColours 1285
- Set the anti-aliased font colours
- ICFOR : foreground logical colour
- ICBAC : background logical colour
- The edges of the characters will be shaded with the range of logical colours
- from the background to the foreground.
-
- WMPSIS(IBLOC) ; SWI Wimp_SetIconState 1211
- Changes an icon's flags (PRM 1181).
- The parameters are entered in an array IBLOC of dimension 4.
- IBLOC(1) : window handle (-1 or -2 for icon bar)
- IBLOC(2) : icon handle
- IBLOC(3) : EOR word
- IBLOC(4) : clear word
- The bits in the icon flags word are changed in the following way:
- firstly, all bits in the flag word corresponding to the bits in the
- 'clear word' you supply are cleared; then all bits in the flag word
- corresponding to the bits in the 'EOR word' you supply have their state
- changed.
-
- WMPSMD(MODE) ; SWI Wimp_SetMode 1249
- Sets the Wimp mode to MODE
-
- WMPSMG(IREASN,IBLOC,IHAND,IIHAND) ; SWI Wimp_SendMessage 1253
- Sends a message to another wimp user
- IREASN : the purpose of the message (see PRM 1253)
- IBLOC : an array of information being sent; the longest messages are about
- filenames, when the full filename starts in IBLOC(12)
- IHAND defines where the message is to be sent and may be:
- a) a task handle
- b) a window handle
- c) 0 to send the message to all tasks
- d) -2 for the icon bar, when IIHAND must contain the icon handle
- (otherwise IIHAND is ignored)
-
- WMPSO(ITYP,name,IPAR) ; SWI Wimp_SpriteOp 1271
- Does SpriteOps on Wimp sprites (see PRM 393 et seq. for OS_SpriteOp
- definitions).
- ITYP is the SpriteOp type (currently allowed in the range 14 to 59);
- name is the CHARACTER name of the sprite, it is not updated;
- IPAR is an array of 5 words used as registers 3 to 7 which are the
- arguments used in the SpriteOp. You may find it less confusing to DIMENSION
- IPAR(3:7) when the index of IPAR is the same as the register number.
-
- WMPSP(IRED,IGREEN,IBLUE) ; SWI Wimp_SetPalette 1250
- Sets the Wimp palette colours.
- IRED : an array of 20 words giving the red part of the palette. The colours
- have values between 0 and 255, and on the screen, only multiples of 16 are
- significant.
- IGREEN : a similar array of green colours
- IBLUE : a similar array of blue colours
- The first 16 words of each array are the normal wimp colour definitions (see
- WMPSC). The last four contain the border colour and the three pointer
- colours.
-
- WMPSPS(NSHAPE,IBPTR,IW,IH,IX,IY) ; SWI Wimp_SetPointerShape 1234
- Redefines the mouse pointer shape.
- NSHAPE : shape number (=0: pointer off, =1: default arrow, =2: alternative)
- IBPTR : address of the array of pixels describing the pointer
- (E.g. LOC(IBPIX) where the array IBPIX contains the pixels ),
- or -1 for no change in pointer shape.
- IW,IH : width and height of the pointer in pixels
- IX,IY : offset in pixels of the active point to the top left of pointer
-
- WMPSS(NSCS,NSNS,ISCS,ISNS,ISFP) ; SWI Wimp_SlotSize 1275
- Used to change the current or next Wimp slot size (in bytes)
- NSCS : new size required for current slot (-1 to read size only)
- NSNS : new size required for next slot (-1 to read size only)
- It returns:
- ISCS : the (new) current slot size
- ISNS : the (new) next slot size size
- ISFP : the (new) size of the free pool
-
- WMPST(commnd) ; SWI Wimp_StartTask 1242
- commnd is a CHARACTER string containing a command which will cause a
- Wimp program to be executed, e.g. 'BASIC -quit MyProg' will run the Basic
- program "MyProg"
-
- WMPTB(IHS,KSB,IHD,KDB,L) ; SWI Wimp_TransferBlock 1283
- This transfers the contents of a block of memory from one task to
- another.
- IHS : the task handle of the sending task
- KSB : the byte address of the block to be sent
- IHD : the task handle of the destination task
- KDB : the byte address for receiving the block
- L : the length of the block in bytes
- Note that the KSB and KDB are byte addresses and not arrays or CHARACTER
- variables, so you may need to use LOC or LOCC to define them.
-
- WMPTC(ICOL) ; SWI Wimp_TextColour 1282
- Sets text colour for VDU 4 type output in special text windows (see
- WMPCOW). ICOL should be in the range 0 to 15 for foreground colours, and
- have 128 added for background colours.
-
- WMPUW(IBLOC,MORE) ; SWI Wimp_UpdateWindow 1206
- Similar to WMPRW, but can be called anytime to update any part of the
- window you like. Supply the window handle and the area to be updated in
- IBLOC : the window handle and the area to be updated (11 words)
- It returns:
- IBLOC : the area requested by the wimp } see WMPRW
- MORE : whether more updating is required } .. ..
-
- WMPWI(IWHAND,IBLOC,MASK,IBITS) ; SWI Wimp_WhichIcon 1232
- This finds which icons in a window have flags with certain bits set
- IWHAND : the window handle
- MASK : mask determining which bits in the icon flags are to be tested
- IBITS : the bit pattern (within the mask) to be satisfied by the icon
- flags
- It returns which icons satisfy these requirements as:
- IBLOC : an array of icon handles terminated with -1
- Hence IBLOC should have a dimension greater than the number of icons in the
- window.
-
- ******************* U T I L I T I E S *********************
-
- FUNCTION IWMPCI(IWHAND,IX,IY,IW,IH,IFLAG,text,valid)
- This function simplifies calling Wimp_CreateIcon and returns the icon
- handle.
- IWHAND is the handle of the window to contain the icon.
- (IX,IY) is the position of the bottom left corner of the icon in the window
- reference frame with origin at the top left. Hence IX should be >0 and IY
- should be <0.
- (IW,IH) is the width and height of the icon. For text, IW is ~20 + 16 x
- number of letters in the icon and IH is usually +48.
- IFLAG contains the icon flags which determine the colours, centering,
- borders, selection group etc. (See PRM page 1181.) Bit 8 will always be set
- because the names are always addressed indirectly. As an example, try
- IFLAG=?I0800B13D which gives a blue text sprite which responds to being
- clicked over. Bits 0 of IFLAG is set for a text icon and bit 1 for a sprite
- icon. Both can be set at the same time.
- 'text' is a CHARACTER variable with a dummy last character; it must not be
- a text string enclosed in quotes because the last character will be
- overwritten with a null. It contains the text of a 'text icon' if
- bit zero of IFLAG is set, or the sprite name if it is a 'sprite only' icon
- (bit 1 of IFLAG set, and bit 0 unset). N.B. for writeable text icons, the
- length of the character variable you give defines the maximum length of the
- icon.
- 'valid' is a CHARACTER variable with a dummy last character; it must not be
- a text string enclosed in quotes because the last character will be
- overwritten with a null character. It is the 'validation string' for a text
- icon, or the sprite name for a sprite + text icon; see PRM 1184.
-
- FUNCTION IWMPCW(IX,IY,IW,ID,MAXW,MAXD,title,IWF)
- This function simplifies calling Wimp_CreateWindow and returns the
- window handle.
- (IX,IY) is the top left hand corner of the window in screen coordinates
- (IW,ID) is the width and depth of the displayed window
- (MAXW,MAXD) is maximum size of window (if < IW,ID then IW,ID will be used).
- Note, the depths are measured downwards and are positive, whereas the IY
- is measured upwards from (0,0) at the bottom left of the screen.
- 'title' (CHARACTER variable) is the title text. Note, 'title' must be a
- CHARACTER variable (not a literal enclosed in quotes) because IWMPCW will
- overwrite the last character with a null control code. So put a spare
- character on the end!
- IWF window flags. These control how the window looks, (see PRM page 1175),
- e.g. for a normal window into which you want to write or draw things try
- ?IFF00000F, and if the window only contains icons which the wimp will draw,
- use ?IFF00001F.
-
- SUBROUTINE WMPMNU(MBLOC,title,list,N)
- Create a menu block in MBLOC from CHARACTER*12 'title' and 'list' of N
- menu entries. This block should then be used in WMPCM to open a menu window.
- Fancy effects like menu trees or underlined entries have to be done by
- correcting the MBLOC entries before opening the menu, (PRM 1226). MBLOC must
- be of length 6*N+7. Here is a trivial example:
- PARAMETER (N=2)
- DIMENSION MBLOC(7+6*N)
- CHARACTER*12 TITLE,LIST(N)
- DATA TITLE/'Menu'/,LIST/'Example','Quit'/
- CALL WMPMNU(MBLOC,TITLE,LIST,N)
-
- SUBROUTINE WMPC2H(text,IHOLL)
- Transfers CHARACTER*(*) text to INTEGER IHOLL(*), terminating with a
- 'null'.
-
- SUBROUTINE WMPH2C(IHOLL,text,LENGTH)
- Transfers characters from INTEGER IHOLL(*) (control terminated) to
- CHARACTER*(*) text. Returns length of string in IHOLL in LENGTH. Control
- characters are in the range 0 - 31. Normally text(1:LENGTH) will contain the
- string and text(LENGTH+1:LENGTH+1) the control character. However if the
- length is too big for 'text', the excess characters will not be
- transferred.
- *** N.B. check LENGTH against the size of 'text' to make sure all has been
- transferred. ***
-
- SUBROUTINE WMPTXT(IX,IY,text)
- Prints text (CHARACTER variable) at graphics location IX,IY. This is
- like WOG in the graphics library, but should be used for printing in windows
- in the Wimp environment.
-