misc
FNwimp_initialise(name$,wimpmem%,iconmem%,ver%)
This function registers your application with the Task
Manager and reserves some memory.
name$ = the name of your application eg. 'Draw'.
wimpmem% = number of bytes to reserve for icon data or
menu entries.
iconmem% = number of bytes to reserve for indirected
text. eg. window titles or long menu entries.
ver% = minimum version of RISC OS that the application
is allowed to run on multiplied by 100.

polling
PROCwimp_poll
This function is the main loop of your application. When
it has finished, your application has quitted. If
something happens to your application eg. an icon has
been clicked on, then the relevent function will be
called from the loop.

polling
PROCwimp_pollidle(seconds%)
If NULL=TRUE then PROCuser_null will be called every
seconds% seconds instead of every time control is passed
to the application and no event has occured.

polling
PROCwimp_singlepoll
The same as PROCwimp_poll, execpt that it is called once
and not in a loop. If something happens then the
relevent action will still be taken before returning.
Useful for making loops multitask, eg: raytracing,
printing, calculating, loading in data, etc.
Note: if calling in PROCuser_null, make sure NULL=FALSE
before this call (can set to TRUE afterwards) otherwise
recursion will occur.

polling
PROCwimp_singlepollidle(seconds%)
The same as PROCwimp_pollidle, except that it is called
once and not in a loop. If something happens then the
relevent action will be taken before returning. If
NULL=TRUE then PROCuser_null will be called after
seconds% seconds.
Useful for incorporating delays into multitasking loops.
Note: if calling in PROCuser_null, make sure NULL=FALSE
before this call (can set to TRUE afterwards) otherwise
recursion will occur.

user
PROCuser_redraw(window%,minx%,miny%,maxx%,maxy%,printing%,page%)
When this function is called, the Wimp wants you to
update the specified box on the screen. The box is in
the work area of the window whose handle is window% or
if printing then its in paper coordinates where the
origin is at the bottom left of the paper.
printing% = TRUE if currently printing, FALSE otherwise.
page% = number of page currently being printed if
printing%=TRUE.
minx%,miny% = bottom left co-ordinates of box in screen
coordinates.
maxx%,maxy% = top right co-ordinates of box in screen
coordinates.

user
PROCuser_mouseclick(window%,icon%,button%,workx%,worky%)
IF an icon has been clicked on in one of your windows
then this function is called.
window% = handle of window containing icon.
icon% = number of the icon clicked on.
button% = which mouse button was pressed. Eg. 4 for
Select, 1 for Adjust.
workx%,worky% = work area coordinates of window window%
that pointer was at when the mouse button was clicked.

user
FNuser_menu(window%,icon%)
IF the specified window (and icon) has a menu which you
want to appear when Menu is pressed over it, then this
function should return the handle of the menu.
window% = handle of window.
icon% = number of icon.

user
PROCuser_openwindow(window%,x%,y%,stack%)
IF this function is called, then the window whose handle
is window% has been opened with the top left of the
window at x%,y% on the screen.
stack% = window handle to open behind, or -1 for top of
window stack, or -2 for bottom.

user
PROCuser_closewindow(window%)
IF this function is called, then the window whose handle
is window% has just been closed.

windows
PROCwimp_openwindow(window%,centre%,stack%)
Opens a window on the screen.
window% = handle of window to open.
If centre% = 0 opens window where it was last left on
the screen, or if it hasn't been opened before, then
where it is positioned in the template file.
If centre% = 1 opens the window centred on the screen
(mode independant).
If centre% = 2 opens the window centred on the pointer.
stack% = window handle to open behind, or -1 for top of
window stack, -2 for bottom, or -3 for current stack
position.

windows
PROCwimp_openwindowat(window%,x%,y%,stack%)
Opens a window on the screen so the top left of the
window is at co-ordinates x%,y%.
window% = handle of window to open.
stack% = window handle to open behind, or -1 for top of
window stack, -2 for bottom or -3 for current stack
position.

windows
PROCwimp_closewindow(window%)
Closes a window (removes it from the screen).
window% = handle of window to close.

messages
PROCwimp_initmessages(path$)
Reserves blocks of memory and sets up Messages file for
use.
path$ = full pathname of messages file to use.

messages
FNwimp_reinitmessages(path$)
Forgets about the current messages file and changes to a
new one. The new file must be the same size or smaller
than the old one. Returns a 1 for success, 0 for
failiure.
path$ = full pathname of messages file to use.

messages
FNwimp_messlook0(token$)
Returns the string in the messages file for the token
token$.

messages
FNwimp_messlook1(token$,a$)
Returns the string in the messages file for the token
token$. Any '%0's in the string are replaced with a$
before returning.

messages
FNwimp_messlook2(token$,a$,b$)
Returns the string in the messages file for the token
token$. Any '%0's and '%1's are replaced with a$ and b$
respectively before returning.

icons
FNwimp_iconbar(sprite$,text$,pos%)
Places an icon on the iconbar.
sprite$ = name of sprite to put on iconbar.
text$ = text to put underneath the icon eg. like the
floppy drive icon. If text$ = "" then no text will be
used, and the icon will be positioned correctly.
pos% = controls the position of the icon. If pos% = 1
then the icon will appear on the right. If pos% = 0 then
it will appear on the left.
Returns window handle.

menus
PROCwimp_menupopup(menu%,pos%,x%,y%)
Brings up the menu whose handle is menu% at the
co-ordinates x%,y%. If pos%=1 then the menu will be
positioned as for an iconbar menu, if pos%=2 then the
menu will be centred, if pos%=0 then the coordinates
x%,y% are used. Can be used to open windows that close
when the mouse is clicked elsewhere.

icons
FNwimp_geticontext(window%,icon%)
Returns a string containing the text from the icon.
window% = handle of window containing icon.
icon% = icon number.

icons
PROCwimp_puticontext(window%,icon%,text$)
If the icon is indirected then the text in the icon is
replaced with text$. If the icon is indirected then an
error is caused.
window% = handle of window containing icon.
icon% = number of icon.

user
FNuser_keypress(window%,icon%,key)
IF a key is pressed while one of your windows has the
input focus, or a hotkey is pressed, then this function
is called. If you don't use the key then return a 0. If
you do then return a 1.
window% = handle of window with input focus.
icon% = number of icon with caret.
key = key code. For most keys it is an ASCII number.
For special keys see the PRM.

user
PROCuser_menuselection(menu%,item%)
This function is called when the user has chosen a menu
item from one of your menus.
menu% = handle of menu.
item% = item number (top item is 1).

menus
FNwimp_createmenu(menu$,size%)
Creates a menu structure from the string menu$. The menu
handle is returned.
For more information on menu$ see the manual.
IF size%>number of items then the menu is dynamic, ie.
the items can be increased up to size%.

misc
PROCwimp_error(title$,error$,button%,prefix%)
Reports an error using a standard error box.
title$ = title of error window.
error$ = error message.
IF button%=1 then will have an 'OK' button.
IF button%=2 then will have a 'CANCEL' button.
prefix% = prefix flag. If = 0 then the title is title$.
If = 1 then the title is prefixed by 'Error from '. If =
2 then the title is prefixed by 'Message from '.

misc
FNwimp_errorchoice(title$,error$,prefix%)
Reports an error using a standard error box.
It has both 'OK' and 'CANCEL' buttons.
title$ = title of error window.
error$ = error message.
IF prefix% = 0 then the title is title$. If prefix% = 1
then the title is prefixed by 'Error from '. If prefix%
= 2 then the title is prefixed by 'Message from '.
Returns TRUE if 'OK' pressed. FALSE if 'CANCEL' pressed.

menus
FNwimp_menusize(menu%)
Returns the number of entries in the menu.
menu% = handle of menu.

menus
PROCwimp_menutick(menu%,item%)
If the item doesn't have a tick next to it then this
function places one. If the item does have a tick then
it is removed.
menu% = handle of menu.
item% = item number (top item is 1).

menus
PROCwimp_menudisable(menu%,item%)
Greys out the menu item so it is un-selectable.
menu% = handle of menu.
item% = item number (top item is 1).

menus
PROCwimp_menuenable(menu%,item%)
Un-greys out the menu item so it is selectable.
menu% = handle of menu.
item% = item number (top item is 1).

icons
PROCwimp_puticonbartext(text$)
If the iconbar icon has text underneath it then it is
replaced by text$.

icons
PROCwimp_iconbarsprite(sprite$)
Changes the sprite used for the iconbar icon to sprite$.

menus
PROCwimp_menudottedline(menu%,item%)
Adds a dotted line to the menu below the item.
menu% = handle of menu.
item% = number of item (top item is 1).

menus
PROCwimp_menuclose
Closes the currently active menu.

sprites
FNwimp_loadsprites(path$,ptr%)
Loads a spritefile into a block of memory at ptr%.
Returns a new value of ptr% to load the next in.
path$ = full pathname to sprite file.

windows
FNwimp_loadwindow(path$,window$,sprite%)
Loads in a window from a templates file and returns a
handle for the window.
path$ = full pathname to templates file.
window$ = name of window in templates file.
sprite% = sprite flag. If = 0 then use sprites from wimp
area (RMA). Otherwise sprite% is a handle to a sprite
area.

icons
PROCwimp_putcaret(window%,icon%)
Puts the caret in the icon.
window% = handle of window containing icon.
icon% = number of icon.

icons
PROCwimp_losecaret
Removes the caret from the icon it is in.

windows
PROCwimp_putwindowtitle(window%,title$)
Changes the window title to title$
window% = handle of window.

windows
FNwimp_getwindowtitle(window%)
Returns a string containing the window title.
window% = handle of window.

misc
FNwimp_getleafname(path$)
Returns a string containing the leafname from the
pathname.
path$ = pathname.

user
FNuser_savedata(path$,window%)
When the user is required to save data, this function is
called.
Return a 1 if some data was saved, 2 if an error
occurred or return a 0 for no data saved and no error.
path$ = full pathname of file to save data to.
window% = handle of save window icon was dragged from.

user
FNuser_loaddata(path$,window%,icon%,filetype$,workx%,worky%)
You load data here. Return a 1 of data was loaded.
path$ = full pathname of source file.
window% = handle of window file was dragged on to.
icon% = number of icon file was dragged on to.
filetype$ = filetype of file to be loaded. Eg. "FFF".
workx%, worky% = work area coordinates the icon was
dropped at. -1,-1 if file was loaded with a
double-click.

user
FNuser_savefiletype(window%)
You return the filetype for the save windows. eg.
='FFF'. For windows that aren't save windows, return an
empty string eg. =''.
window% = handle of window%

user
FNuser_help(window%,icon%)
Return a string to be used for interactive help for the
window (and icon).
window% = handle of window (containing icon).
icon% = number of icon.                     

icons
PROCwimp_iconenable(window%,icon%)
Un-greys out icon so it can be selected.
window% = handle of window containing icon.
icon% = number of icon.

icons
PROCwimp_icondisable(window%,icon%)
Greys out icon so it cannot be selected.
window% = handle of window containing icon.
icon% = number of icon.

icons
PROCwimp_iconselect(window%,icon%,state%)
Selects (inverts) and un-selects icon.
window% = handle of window containing icon.
icon% = number of icon.
If state% = 0 icon is un-selected. If state% = 1 icon
is selected.

windows
PROCwimp_banner(window%,delay%)
Opens window in the centre of the screen for specified
delay before closing it.
window% = handle of window to open.
delay% = number of seconds to keep window on screen.

pointer
PROCwimp_pointer(pointer%,area%,pointer$)
Changes mouse pointer between the deafult (number 1) and
the user defined pointer (number 2).
If pointer% = 0 default pointer is used. If pointer% = 1
user defined pointer is used.
If area% = 0 wimp sprite pool is used otherwise area% is
a handle to a sprite area.
pointer$ = sprite name of pointer.

user
PROCuser_enteringwindow(window%)
This function is called when the pointer enters a
window.
window% = handle of window.

user
PROCuser_leavingwindow(window%)
This function is called when the pointer leaves a
window.
window% = handle of window.

menus
FNwimp_getmenutitle(menu%)
Returns a string containing the title of the menu.
menu% = handle of menu.

menus
PROCwimp_putmenutitle(menu%,title$)
Changes the title of the menu.
If the title>11 characters then it is truncated.
menu% = handle of menu.
title$ = new title.

misc
PROCwimp_starttask(command$)
Sends command$ to the CLI. Omit '*'.

menus
PROCwimp_putmenutext(menu%,item%,text$)
Replaces menu items text with text$.
menu% = handle of menu.
item% = number of item (Top item is 1).

menus
PROCwimp_menuwrite(menu%,item%,length%)
Makes the menu item writeable.
menu% = handle of menu.
item% = number of item (top item is 1).
length% = maximum length of text allowed to be entered.

menus
FNwimp_getmenutext(menu%,item%)
Returns a string containing the text of the menu item.
menu% = handle of menu.
item% = number of item (top item is 1).

windows
FNwimp_getwindowsize(window%,side%)
Returns the dimension required.
If side% = 0 returns width. If side% = 1 returns height.

user
FNuser_pane(window%)
IF the window has a pane attached to it, then this
function should return the window handle of the pane. If
the window doesn't have a pane attached, then it should
return a -1.
window% = handle of window.

misc
FNwimp_libversion
Returns the version number of the library x 100. Eg. if
the version of the library is 1.03 then 103 will be
returned.

misc
FNwimp_sysvariable(sysvar$)
Returns a string for the system variable sysvar$.
Note '<' and '>' are not required in sysvar$.

user
PROCuser_null
This is called continuously. So if you are writing
something like a clock, you would monitor the time here
and change any windows as required.
IF you want to use this function then set NULL=TRUE.

menus
PROCwimp_putmenuitem(menu%,item%,item$)
If the menu is dynamic then item$ will be put into menu
item item%. Any items below will be shuffled down. If
item% is bigger than the current number of items+1, then
it will be added to the bottom.
menu% = handle of menu.

menus
PROCwimp_removemenuitem(menu%,item%)
Removes the item from the menu. Any items below are
shuffled up. If there is only one item on the menu, then
it cannot be removed.
menu% = handle of menu. item% = number of item to
remove.

menus
PROCwimp_recreatemenu(menu%,menu$)
Rebuilds the menu using the string menu$. More items can
be included than the first time as long as you don't go
over the pre-defined limit.
menu% = handle of menu to rebuild.

menus
FNwimp_createmenuarray(array$(),size%)
Creates a menu from the array supplied. Each item of the
menu is in a seperate element of the array. eg:
array$(3)='Info'. The first element is the menu title,
and the last must be 'END'.
array$() = array to get items from.
size% = maximum number of elements to allocate room for
(doesn't have to be the current number).
Returns a handle to the menu.

menus
PROCwimp_recreatemenuarray(menu%,array$())
Rebuilds the menu using the items in the array. The
first array item (array$(0)) is the menu title, and the
last has to be 'END'.
Things like ticks and dotted lines are reset.
menu% = handle of menu to rebuild
array$() = array to get items from.

misc
PROCwimp_bar(window%,icon%,length%,dir%)
Adjusts the length of a bar.
window% = handle of window containing the bar.
icon% = icon number of the bar.
length% = length of the bar.
If dir% = 0 then the bar moves horizontally
keeping the height constant.
If dir% = 1 then the bar moves vertically
keeping the width constant.

user
PROCuser_menuopen(menu%,icon%)
Called just before menu is opened.
menu% = handle of menu jut about to open.
icon% = icon which pointer is over.

icons
PROCwimp_colouricontext(window%,icon%,colour%)
Sets colour of text in icon to colour%.
window% = handle of window containing icon.
icon% = number of icon.
colour% = colour in range 0-15.

drawfiles
PROCwimp_initdfiles
Initialises various blocks of memory ready to use with
drawfiles.

drawfiles
FNwimp_measurefile(path$)
Returns the size in bytes needed to store the drawfile.
Always use this as opposed to any other form of
measurement.
path$ = full pathname of drawfile.

sprites
FNwimp_measurefile(path$)
Returns the size in bytes needed to store the spritefile.
Always use this as opposed to any other form of
measurement.
path$ = full pathname of spritefile.

drawfiles
FNwimp_loaddfile(path$,ptr%)
Loads a drawfile into a block of memory at ptr%.
Returns a new value of ptr% to load the next in.
path$ = full pathname of drawfile.

drawfiles
PROCwimp_savedfile(path$,dfile%)
Saves a drawfile into a file.
dfile% = handle of drawfile to save.
path$ = full pathname to save to.

drawfiles
PROCwimp_render(dfile%,bx%,by%,xl%,yl%,xh%,yh%)
Renders a drawfile at bx%,by% using the clipping
rectangle xl%,yl%,xh%,yh%. All coordinates are in OS
units.
dfile% = handle of drawfile to render.
bx%,by% = coordinates of where to put bottom left corner
of drawfile.
xl%,yl% = coordinates of bottom left corner of clipping
rectangle in screen coordinates.
xh%,yh% = coordinates of top right corner of clipping
rectangle in screen coordinates.

misc
PROCwimp_increaseslot(bytes%)
Increases size of wimslot by bytes% bytes. If not
enough available RAM then creates an error.

user
PROCuser_saveicon(window%,RETURN drag%,RETURN write%,RETURN ok%)
This function allows the three save window icons (the
one to drag, the writeable icon for the
filename/pathname, the OK button) to have their icon
numbers set, if you want to override the defaults.
Defaults:
  drag% - 0   write% - 1   ok% - 2
window% = handle of save window.

windows
PROCwimp_resizewindow(whan%,width%,height%)
Resizes the window to the specified width and height
which are in OS co-ordinates. The work area and the
visible area are both set to the values.

drawfiles
FNwimp_getdfilesize(dfile%,side%)
Returns the dimension required.
If side% = 0 returns width. If side% = 1 returns height.

drawfiles
PROCwimp_renderwindow(w%,dfile%,tx%,ty%,xl%,yl%,xh%,yh%)
Renders a drawfile in a window. The window must have its
auto-redraw flag unset.
w% = handle of window.
dfile% = handle of drawfile to render.
tx%,ty% = work area coordinates of where to put bottom
left corner of drawfile.
xl%,yl% = coordinates of bottom left corner of clipping
rectangle in screen coordinates.
xh%,yh% = coordinates of top right corner of clipping
rectangle in screen coordinates.

user
FNuser_sliderback(window%,icon%)
In order to let DrWimp know that an icon is a slider,
return the slider back icon number.
window% = handle of window with slider in.
icon% = icon number of slider.

user
FNuser_slider(window%,icon%)
In order to let DrWimp know that an icon is a slider,
return the slider icon number.
window% = handle of window with slider in.
icon% = icon number of slider back icon.

user
PROCuser_slidervalue(window%,slider%,pcent%)
When a slider is being dragged or has just finished
being dragged, the percentage of the slider is passed to
this function.
window% = handle of window with slider in.
icon% = icon number of slider.
pcent% = percentage of slider.

icons
FNwimp_getsliderpcent(window%,icon%)
Returns the percentage of the slider. If the icon is not
a slider then 0 is returned.
The number returned is a floating point number in the
range 0-100.
window% = handle of window with slider in.
icon% = icon number of slider.

icons
PROCwimp_putsliderpcent(window%,icon%,pcent)
Sets the percentage of the slider. If the icon is not a
slider then this is ignored.
window% = handle of window with slider in.
icon% = icon number of slider.
pcent = percentage to set.
Can be integer or floating point number, but must have
the range 0-100.

icons
FNwimp_geticonsize(window%,icon%,side%)
Returns the dimension required.
If side% = 0 returns width. If side% = 1 returns height.

misc
FNwimp_worktoscreen(window%,coord%,side%)
Converts the x or y work area coordinate coord% to a
screen x or y coordinate. 
window% = handle of window whos work area coordinate is
being converted.
coord% = coordinate (x or y).
If side% = 0 then coord% is a x coordinate, and an x
coordinate is returned.
If side% = 1 then coord% is a y coordinate, and a y
coordinate is returned.

misc
FNwimp_screentowork(window%,coord%,side%)
Converts the x or y screen coordinate coord% to a
work area x or y coordinate. 
window% = handle of window whos work area coordinate is
being converted into.
coord% = coordinate (x or y).
If side% = 0 then coord% is a x coordinate, and an x
coordinate is returned.
If side% = 1 then coord% is a y coordinate, and a y
coordinate is returned.

misc
PROCwimp_setcolour(red%,green%,blue)
Sets the current GCOL colour to the nearest possible for
the current mode.
red% = amount of red in range 0-255.
green% = amount of green in range 0-255.
blue% = amount of blue in range 0-255.

text
PROCwimp_plottext(t$,f$,s%,x%,y%,fr%,fg%,fb%,br%,bg%,bb%)
Plots text using a font.
t$ = string to plot.
f$ = name of font period spaced eg: "Trinity.Medium"
s% = point size of font.
x%,y% = screen coordinates to plot the text at.
fr%,fg%,fb% = foreground colour red, green and blue
amounts in range 0-255.
br%,bg%,bb% = background colour red, green and blue
amounts in range 0-255.

misc
FNwimp_createblock(items%,length%)
Creates a block for storing strings in. Returns a handle
to the block.
items% = maximum number of strings to store.
length% = maximum possible length of each string.

misc
PROCwimp_putinblock(block%,string$,pos%)
Stores a string in a block which has been created using
FNwimp_createblock.
block% = handle of block.
string$ = string to store.
pos% = position to store string in (ranging from 1 to
maximum as passed to FNwimp_createblock).

misc
FNwimp_getfromblock(block%,pos%)
Returns a string stored in a block.
block% = handle of block.
pos% = position of string in block (ranging from 1 to
maximum as passed to FNwimp_createblock).

icons
FNwimp_geticonstate(window%,icon%)
Returns a 1 if the icon is selected and a 0 if it is
unselected. Useful for reading the state of radio and
option icons.
window% = handle of window containing icon.
icon% = number of icon.

menus
PROCwimp_attachsubmenu(menu%,item%,submenu%)
Attaches a submenu to a menu item.
menu% = handle of menu.
item% = item number (top item is 1).
submenu% = handle of submenu or window handle.

user
PROCuser_modechange
Called when the mode is changed.

misc
FNwimp_getscreensize(side%)
Returns the dimension of the screen required.
If side% = 0 returns width. If side% = 1 returns height.

text
PROCwimp_deskplottext(t$,c%,x%,y%,fr%,fg%,fb%,br%,bg%,bb%)
Plots text using the current desktop font (always the
System Font on pre-RISC OS 3.50).
t$ = string to plot.
If c%=1 then text is horizontally centred around x%.
If c%=0 then left side of text is placed at x%.
x%,y% = coordinates to plot the text at.
fr%,fg%,fb% = foreground colour red, green and blue
amounts in range 0-255.
br%,bg%,bb% = background colour red, green and blue
amounts in range 0-255.

text
PROCwimp_deskplotwindowtext(window%,t$,c%,x%,y%,fr%,fg%,fb%,br%,bg%,bb%,minx%,miny%,maxx%,maxy%)
Plots text using the current desktop font (always the
System Font on pre-RISC OS 3.50) in a window.
window% = handle of window to plot in.
t$ = string to plot.
If c%=1 then text is horizontally centred around x%.
If c%=0 then left side of text is placed at x%.
x%,y% = coordinates to plot the text at.
fr%,fg%,fb% = foreground colour red, green and blue
amounts in range 0-255.
br%,bg%,bb% = background colour red, green and blue
amounts in range 0-255.
minx%,miny% = coordinates of bottom left corner of
clipping rectangle in screen coordinates.
maxx%,maxy% = coordinates of top right corner of
clipping rectangle in screen coordinates.

user
FNuser_menuhelp(menu%,item%)
Return a string to be used for interactive help for the
menu item.
menu% = handle of menu.
item% = number of item (starting from 1 at the top).

misc
FNwimp_roundfloat(float)
Rounds the floating point number up or down and returns
the integer.

windows
PROCwimp_redrawwindow(whan%)
Causes the window whose handle is whan% to be redrawn.

icons
PROCwimp_iconbit(window%,icon%,bit%,state%)
Ensures a specific bit of an icon is set to the
specified state.
window% = handle of window contaning icon.
icon% = number of icon.
bit% = number of bit to change.
state% = state to set bit to. Can be 0 or 1.

sprites
PROCwimp_rendersprite(sprite$,sprite%,bx%,by%,minx%,miny%,maxx%,maxy%,xscale,yscale)
Renders a sprite on the screen at the specified
coordinates, using the clipping rectangle.
sprite$ = name of sprite to plot.
sprite% = handle of sprite area containing sprite.
bx%,by% = screen coordinates to put bottom left corner
of sprite at.
minx%,miny% = coordinates of bottom left corner of
clipping rectangle in screen coordinates.
maxx%,maxy% = coordinates of top right corner of
clipping rectangle in screen coordinates.
xscale,yscale = x and y scaling factors (can be floating point).

sprites
PROCwimp_renderwindowsprite(window%,sprite$,sprite%,bx%,by%,minx%,miny%,maxx%,maxy%,xscale,yscale)
Renders a sprite in a window. The window must have its auto-redraw flag unset.
window% = handle of window to render sprite in.
sprite$ = name of sprite to render.
sprite% = handle of sprite area containing sprite.
bx%,by% = work area coordinates of where to put bottom left of sprite.
minx%,miny% = coordinates of bottom left corner of
clipping rectangle in screen coordinates.
maxx%,maxy% = coordinates of top right corner of
clipping rectangle in screen coordinates.
Clipping rectangle is the same as that passed to PROCuser_redraw.
xscale,yscale = x and y scaling factors (can be floating point).

sprites
FNwimp_getspritesize(sprite$,sprite%,side%)
Returns the width or height in OS units of a sprite.
sprite$ = name of sprite.
sprite% = handle of sprite area containing sprite.
If side%=0 then returns width of sprite.
If side%=1 then returns height of sprite.

text
PROCwimp_plotwindowtext(window%,t$,f$,s%,x%,y%,fr%,fg%,fb%,br%,bg%,bb%,minx%,miny%,maxx%,maxy%)
Plots some text in a window.
window% = handle of window to plot in. t$ = string to
plot. f$ = name of font to use, period seperated, eg:
"Trinity.Medium". s% = point size of font. x%,y% = work
area coordinates to plot text at. fr%,fg%,fb% =
foreground colour red, green and blue components
respectively, in the range 0-255. br%,bg%,bb% =
background colour red, green and blue components in the
range 0-255 minx%,miny% = coordinates of bottom left
corner of clipping rectangle. maxx%,maxy% = coordinates
of top right corner of clipping rectangle.

text
PROCwimp_plotwindowtexth(window%,t$,font%,x%,y%,fr%,fg%,fb%,br%,bg%,bb%,minx%,miny%,maxx%,maxy%)
Plots some text in a window using font handle.
window% = handle of window to plot in. t$ = string to
plot. font% = handle of font to use. s% = point size of
font. x%,y% = work area coordinates to plot text at.
fr%,fg%,fb% = foreground colour red, green and blue
components respectively, in the range 0-255. br%,bg%,bb%
= background colour red, green and blue components
respectively, in the range 0-255 minx%,miny% =
coordinates of bottom left corner of clipping rectangle.
maxx%,maxy% = coordinates of top right corner of
clipping rectangle.

text
PROCwimp_plottexth(text$,font%,x%,y%,fr%,fg%,fb%,br%,bg%,bb%)
Plots text using a font (with font handle).
t$ = string to plot.
font% = handle of font.
s% = point size of font.
x%,y% = coordinates to plot the text at.
fr%,fg%,fb% = foreground colour red, green and blue
amounts in range 0-255.
br%,bg%,bb% = background colour red, green and blue
amounts in range 0-255.

user
PROCuser_declarefonts
Any fonts being used in printing must be declared in
this function using PROCwimp_declarefont or
PROCwimp_declarefonth.

user
PROCuser_print(minx%,miny%,maxx%,maxy%,page%)
Called to draw a page for printing, if user%=1 when
PROCwimp_print was called.
minx%,miny% = coordinates of bottom left corner of
clipping rectangle on page in paper coordinates.
maxx%,maxy% = coordinates of top right corner of
clipping rectangle on page in paper coordinates.
page% = number of page to print.

user
FNuser_printing(copy%,page%,totpages%,pagepos%)
Called repeatedly during printing so application can
keep user informed of current printing status, and give
them the option to cancel printing.
copy% = number of current copy being printed.
page% = number of current page being printed.
totpages% = total number of pages being printed.
pagepos% = current page being printed (starts at 1 each
time and goes up to totpages%).
Return a 1 to cancel printing or a 0 to continue.

user
PROCuser_printerchange
Called when the printer settings or the current printer
has changed so you can update your page measurements,
current printer name, etc.

printing
FNwimp_screentopaper(window%,coord%,side%,orient%)
Converts a screen x or y coordinate to a paper x or y
coordinate.
window% = handle of window whose work area to use.
coord% = coordinate (x or y).
If side%=0 then coord% is a x coordinate, and a x
coordinate is returned.
If side%=1 then coord% is a y coordinate, and a y
coordinate is returned.
If orient%=0 then page is portrait. If orient%=1 then
page is landscape.

printing
FNwimp_papertoscreen(window%,coord%,side%,orient%)
Converts a paper x or y coordinate to a screen x or y
coordinate.
window% = handle of window whose work area to use.
coord% = coordinate (x or y).
If side%=0 then coord% is a x coordinate, and a x
coordinate is returned.
If side%=1 then coord% is a y coordinate, and a y
coordinate is returned.
If orient%=0 then page is portrait. If orient%=1 then
page is landscape.

printing
FNwimp_worktopaper(coord%,side%,orient%)
Converts a work area x or y coordinate to a paper x or y
coordinate.
coord% = coordinate (x or y).
If side%=0 then coord% is a x coordinate, and a x
coordinate is returned.
If side%=1 then coord% is a y coordinate, and a y
coordinate is returned.
If orient%=0 then page is portrait. If orient%=1 then
page is landscape.

printing
FNwimp_papertowork(coord%,side%,orient%)
Converts a paper x or y coordinate to a work area x or y
coordinate.
coord% = coordinate (x or y).
If side%=0 then coord% is a x coordinate, and a x
coordinate is returned.
If side%=1 then coord% is a y coordinate, and a y
coordinate is returned.
If orient%=0 then page is portrait. If orient%=1 then
page is landscape.

printing
PROCwimp_print(user%,window%,fpage%,lpage%,perpage%,copies%,orient%)
Initiates printing of a document.
IF user%=0 PROCuser_redraw is called to draw the pages,
with printing% set to TRUE and the clipping rectangle
set to the page coordinates. If user%=1 PROCuser_print
is called to draw the pages.
window% = handle of window to redraw if user%=0.
fpage% = page number of first page to print.
lpage% = page number of last page to print.
perpage% = number of A4 pages to fit onto a physical A4 page. Can be 1, 2 or 4.
copies% = number of copies of the document to print.
If orient%=0 then page is portrait. If orient%=1 then page is landscape.

printing
FNwimp_pdriverpresent
Checks to see if a printer driver is loaded.
Returns a 0 if one isn't, returns a 1 if one is.

printing
FNwimp_getpdrivername
If a printer driver is loaded, then this function
returns a string containing the name of the printer
driver. Check to make sure one is loaded first with
FNwimp_pdriverpresent.

windows
FNwimp_getwindowworksize(window%,side%)
Returns the size on OS units of a window work area.
window% = handle of window.
If side%=0 the width of the work area is returned. If
side%=1 the height of the work area is returned.

printing
FNwimp_getpapersize(side%,type%)
Returns various information about the current paper
size.
IF side%=0 then a horizonal measurement is returned. If
side%=1 then a vertical measurement is returned. Which
measurement is determined by type%.
If type%=0 then the width or height is returned.
If type%=1 then the left or bottom margin is returned.
If type%=2 then the printable width or printable height
is returned.
If type%=3 then the right or top margin is returned.

printing
PROCwimp_declaredfilefonts(drawfile%)
Declares the fonts used in a drawfile (especially) for
postscript printing.
drawfile% = handle of drawfile to be printed.

text
FNwimp_gettextsize(text$,font$,size%,side%)
Returns the size of some text in a particular font in OS
units.
text$ = string to measure.
font$ = name of font, period seperated, eg:
"Trinity.Medium".
size% = point size of font.
If side%=0 then the width is returned. If side%=1 then
the height is returned.

text
FNwimp_gettextsizeh(text$,font%,side%)
Returns the size of some text in a particular font in OS
units, using a font handle.
text$ = string to measure.
font% = handle of font.
If side%=0 then the width is returned. If side%=1 then
the height is returned.

misc
FNwimp_OStolength(coord,scale,inch%)
Converts OS units to mm or inches.
coord = value to convert (can be integer or floating
point).
scale = scaling factor 0-100 (%).
If inch%=0 the value returned is in mm. If inch%=1 the
value returned is in inches.

misc
FNwimp_lengthtoOS(coord,scale,inch%)
Converts mm or inches to OS units.
coord = value to convert (can be integer or floating
point).
scale = scaling factor 0-100 (%).
If inch%=0 the value coord supplied is in mm. If inch%=1
the value coord supplied is in inches.

printing
PROCwimp_declarefont(font$)
Declares a font for printing.
font$ = name of font to declare, period seperated. eg:
"Trinity.Medium".

printing
PROCwimp_declarefonth(font%)
Declares a font for printing using font handle.
font% = handle of font to declare.

text
FNwimp_getfont(font$,size%)
Obtains a font handle for a particular font at a
particular size.
font$ = name of font, period seperated. eg:
"Trinity.Medium".
size% = point size of font.
Returns 0 if the font cannot be found.

text
PROCwimp_losefont(font%)
Forgets about a font. Should be called when you have
finished with the font, eg. when the application is
quitting.
font% = handle of font to lose.

text
FNwimp_fontcolour(fr%,fg%,fb%)
Returns control codes in a string to change the current
font colour. Useful for using in the middle of a string
of text being plotted using a font.
fr%,fg%,fb% = red, green and blue components of the
foreground colour respectively, in the range 0-255.

text
FNwimp_fontunderline(on%)
Returns control codes in a string to turn underlining on
or off. Useful for using in the middle of a string of
text being plotted using a font.
If on%=0 turns underlining off. If on%=1 turns
underlining on.

text
FNwinp_fontchangeh(font%)
Returns control codes in a string to change the current
font. Useful for using in the middle of a string of text
being plotted using a font.
font% = handle of font to change to.

messages
FNwimp_createmessagemenu(tag$,title$,size%)
Creates a menu automatically from a Messages file, with
the same result as FNwimp_createmenu.
tag$ = tag for menu. Eg: if tag$="MMenu" then the tag
"MMenuT" will specify the title, "MMenu1" the first
item, "MMenu2" the second etc.
If title$="" then the title defined in the message file
will be used, otherwise title$ will override whatever is
defined in the messages file.
IF size%>number of items then the menu is dynamic, ie.
the items can be increased up to size%.

menus
FNwimp_createmessagemenu(tag$,title$,size%)
Creates a menu automatically from a Messages file, with
the same result as FNwimp_createmenu.
tag$ = tag for menu. Eg: if tag$="MMenu" then the tag
"MMenuT" will specify the title, "MMenu1" the first
item, "MMenu2" the second etc.
If title$="" then the title defined in the message file
will be used, otherwise title$ will override whatever is
defined in the messages file.
IF size%>number of items then the menu is dynamic, ie.
the items can be increased up to size%.

windows
FNwimp_iswindowopen(window%)
Returns a 1 if the window is open otherwise returns a 0.
window% = handle of window.

misc
FNwimp_getscreenres
Finds out the resolution of the current screen mode.
Returns a 0 if its low-res and 1 if its high-res.

windows
FNwimp_createwindow(vminx%,vminy%,vmaxx%,vmaxy%,wminx%,wminy%,wmaxx%,wmaxy%,f%,wcol%,but%,t$,mind%,sarea%)
Creates a window, returning the handle to it.
vminx%,vminy%,vmaxx%,vmaxy% = bounding box of window on
the screen in OS units.
wminx%,wminy%,wmaxx%,wmaxy% = bounding box of work area
in work area coordinates.
f% = number representing window flags.
wcol% = work area colour in desktop colours, in range 0-15.
but% = work area button type. 0 for ignoring clicks, 1 for allowing them.
t$ = title of window.
maxind% = maximum size of title if indirected.
sarea% = handle of sprite area, or 0 to use wimp sprite area.

icons
FNwimp_createicon(window%,wminx%,wminy%,wmaxx%,wmaxy%,f%,esg%,but%,fcol%,bcol%,font%,t$,s$,sarea%,mind%,v$)
Creates an icon and returns the handle to it (icon number).
window% = handle of window to create icon in.
wminx%,wminy%,wmaxx%,wmaxy% = bounding box of icon in work area coordinates.
f% = number representing flags for icon.
esg% = esg number of icon. 0 for icons which arn't radio buttons. but% = button type of icon.
fcol%,bcol% = foreground and background colours of icons (if not using
outline font) in dekstop colours, so both in the range 0-15.
font% = handle of outline font. 0 if not using a font.
t$ = text for icon. s$ = sprite name for icon.
sarea% = handle of sprite area, or 0 to use wimp sprite area.
mind% = if icon is indirected then maximum size. v$ = icon validation string.

icons
PROCwimp_deleteicon(window%,icon%,redraw%)
Removes an icon from a window. The icon will not
dissappear unless the window is redrawn.
window% = handle of window contaning icon.
icon% = icon number of icon to delete.
If redraw% is 1 then the window is redrawn. If redraw%
is 0 then it isn't and the icon won't dissappear.

windows
PROCwimp_deletewindow(window%)
Deletes a window, closing it if it is open. All the
memory apart from the indirected memory is reclaimed and
the window handle becomes invalid.
window% = handle of window to delete.

windows
FNwimp_getwindowvisibleOS(window%,side%,end%)
Return the work area coordinates of the edges of the
current visible area of the window.
window% = handle of window.
If side%=0 then a x coordinate will be returned. If
side%=1 then a y coordinate will be returned.
If end%=0, then the minimum coordinate will be returned,
ie the left or bottom of the visible area depending on
the value of side%. If end%=1, then the maximum
coordinate will be returned, ie the right or top of the
visible area depending on the value of side%.

windows
FNwimp_getwindowvisiblescreen(window%,side%,end%)
Return the screen coordinates of the edges of the
current visible area of the window.
window% = handle of window.
If side%=0 then a x coordinate will be returned. If
side%=1 then a y coordinate will be returned.
If end%=0, then the minimum coordinate will be returned,
ie the left or bottom of the visible area depending on
the value of side%. If end%=1, then the maximum
coordinate will be returned, ie the right or top of the
visible area depending on the value of side%.

pointer
PROCwimp_bindpointer(window%)
Binds the mouse pointer within the given window in the
same manner as a standard error message. The pointer is
also placed inside the bound area if it was outside it.
Useful if your application uses its own error or message
windows which you want to force the user to respond to.
As the pointer cannot reach any of the window control
icons, your window should have a title bar at most. It
should be used when the window the mouse is to be bound
in is opened.

pointer
PROCwimp_releasepointer
Releases the mouse pointer to roam over the whole screen
after using PROCwimp_ bindpointer. It should be used when
the window the mouse is bound in is closed.

windows
PROCwimp_updatewindow(window%,minx%,miny%,maxx%,maxy%)
This procedure tells the Wimp to redraw only the part of
a window which is defined by the given coordinates. This
greatly speeds up redraws where lots of graphics are
used and the window needs regular updating as it avoids
redrawing the whole window. The necessary code needs to
be in PROCuser_redraw to enable the redraw to be done.
window% = handle of window to be updated.
minx%, miny% = bottom left of box to be redrawn in work area
coordinates.
maxx%, maxy% = top right of box to be redrawn in work area
coordinates.

windows
PROCwimp_scroll(window%,side%,direction%,distance%)
Causes the window to automatically scroll vertically or
horizontally a given distance in a given direction.
window% = handle of window to be scrolled.
If side%=0 then a horizontal scroll will be done. If
side%=1 then a vertical scroll will be done.
If direction%=0 then the scroll will be left or down
depending on the value of side%. If direction%=1 then
the scroll will be right or up depending on the value of
side%. distance% = the distance to scroll the window
given in OS units.

user
PROCuser_initialise
This procedure should contain the following: All your
window and menu definitions; all your global variables
and arrays; anything that is to be done before polling
starts.

windows
PROCwimp_resizewindowvisible(whan%,width%,height%)
Resizes the visible area of the window to the specified
width and height which are in OS co-ordinates.

dynamic
FNwimp_createdynamic(size%,type%,drag%,name$)
Creates a dynamic area.
size% = size of area initially in bytes.
If type%=1 then the area is in the module area, if
type%=0 and RISC OS 3.5+ is being used then a specific
dynamic area is created.
If type%=0 and drag%=1 then the user can change the size
of the area by dragging in the task manager. If type%=1
then drag% is ignored.
If type%=0 then name$ is the name of the dynamic area,
which appears in the task manager. If type%=1 then name$
is ignored.
Returns a handle to the dynamic area.

dynamic
FNwimp_changedynamic(darea%,absolute%,size%)
Changes the size of a dynamic area.
darea% = handle of dynamic area to change the size of.
If absolute%=1 then the size in bytes given in size% is
the new absolute size of the dynamic area. If
absolute%=0 then the size in bytes given in size% is the
amount to change the dynamic area size by. If size% is
positive then the area will become larger, if size% is
negative then the area will shrink.

dynamic
FNwimp_measuredynamic(darea%)
Returns the current size of a dynamic area in bytes.
darea% = handle of dynamic area to measure.

dynamic
PROCwimp_deletedynamic(darea%)
Deletes a dynamic area, returning the memory so it can
be used for other applications, modules, etc.
darea% = handle of dynamic area to delete.

icons
FNwimp_geticonenable(window%,icon%)
Returns a 0 if the icon icon% in the window whose handle
is window%, is disabled/greyed. Returns a 1 if it isn't.

sprites
FNwimp_countsprites(sprite%)
Returns the number of sprites in a sprite area.
sprite% = handle of sprite area.

sprites
FNwimp_getspritename(sprite%,number%)
Returns the name of a sprite in a sprite area.
sprite% = handle of sprite area.
number% = number of sprite. First sprite is numbered 1.

user
FNuser_quit(type%)
Called when the application is quit either from the user
choosing quit or from a desktop shutdown.
Return a 1 to continue with the quit/shutdown or return
a 0 to stop it, perhaps allowing the user to save any
data.
If type%=0 then it is a quit, if type%=1 then it is a
shutdown.

misc
PROCwimp_quit(type%)
Causes the application to quit or the desktop to be
shutdown. FNuser_quit will be called with type% passed
to it.
If type%=0 the application will quit. If type%=1 the
desktop will be shutdown.

misc
PROCwimp_hourglasson
Turns on the hourglass.

misc
PROCwimp_hourglassoff
Turns off the hourglass.

misc
PROCwimp_hourglasspercentage(percentage%)
Sets the percentage display on the hourglass.
percentage% is in the range 0 to 99.

pointer
FNwimp_getpointerposition(side%)
Returns the screen coordinates of the pointer.
If side%=0 then the x coordinate is returned.
If side%=1 then the y coordinate is returned.

pointer
PROCwimp_setpointerposition(x%,y%)
Moves the pointer to a given position on the screen.
x%,y% = screen coordinates to move the pointer to.
