chiark / gitweb /
Initial revision
[ssr] / StraySrc / Libraries / Steel / h / wimp
1 /*
2  * wimp.h
3  *
4  * Interface to WIMP SWIs
5  *
6  * © 1994-1998 Straylight
7  */
8
9 /*----- Licensing note ----------------------------------------------------*
10  *
11  * This file is part of Straylight's Steel library.
12  *
13  * Steel is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2, or (at your option)
16  * any later version.
17  *
18  * Steel is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with Steel.  If not, write to the Free Software Foundation,
25  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26  */
27
28 #ifndef __wimp_h
29 #define __wimp_h
30
31 #ifndef __wimpstruct_h
32   #include "wimpstruct.h"
33 #endif
34
35 /*----- Notes -------------------------------------------------------------*
36  *
37  * This file defines functions callable from C programs to allow access to
38  * the WIMP at the SWI level.
39  *
40  * Each function maps directly to a single WIMP SWI, and performs little
41  * or no additional processing.  For full information about each one,
42  * you should consult the RISC OS 3 Programmer's Reference Manual.
43  * Little or no documentation is provided for each function.
44  *
45  * Two SWIs are not supported currently:
46  *
47  * Wimp_ClaimFreeMemory -- since the memory is only usable in SVC mode,
48  *   it doesn't seem to be very useful to be able to claim it from C.
49  *
50  * Wimp_SetColourMapping -- this call is only useful for specialised 
51  *   applications, and a veneer defined here isn't really appropriate.
52  */
53
54 /*----- Polling the WIMP --------------------------------------------------*
55  *
56  * The two functions wimp_poll and wimp_pollidle map to SWIs Wimp_Poll and
57  * Wimp_PollIdle respectively.  The other two functions control the saving
58  * or not of the floating point status -- the default is to save this
59  * status (although this is not performed if the FPEmulator is not present).
60  *
61  * Correct handling of the DLL Application Handle is also performed.
62  */
63
64 os_error *wimp_poll(wimp_emask mask,wimp_eventstr *e);
65 os_error *wimp_pollidle(wimp_emask mask,wimp_eventstr *e,int time);
66
67 void wimp_corrupt_fp_state_on_poll(void);
68 void wimp_save_fp_state_on_poll(void);
69
70 /*----- Initialising the WIMP ---------------------------------------------*
71  *
72  * wimp_initialise should only be used if you don't want a multitasking
73  * application -- not very useful, really.  wimp_taskinit will perform all
74  * the initialisation a full multitasking application requires.  If you
75  * initialise with a version number of 300 or higher, the optional messages
76  * argument should be filled in with a pointer to an array of message
77  * numbers.
78  */
79
80 os_error *wimp_initialise(int *version);
81 os_error *wimp_taskinit(char *name,
82                         int *version,
83                         wimp_t *taskhandle,...
84                      /* int *messages */);
85
86 /*----- Closing down the WIMP ---------------------------------------------*/
87
88 os_error *wimp_closedown(void);
89 os_error *wimp_taskclose(wimp_t taskhandle);
90
91 /*----- Creating and deleting windows and icons ---------------------------*/
92
93 os_error *wimp_create_wind(wimp_wind *w,wimp_w *handle);
94 os_error *wimp_delete_wind(wimp_w w);
95 os_error *wimp_create_icon(wimp_icreate *i,wimp_i *handle);
96 os_error *wimp_delete_icon(wimp_w w,wimp_i i);
97
98 /*----- Getting and changing window and icon states -----------------------*/
99
100 os_error *wimp_open_wind(wimp_openstr *o);
101 os_error *wimp_close_wind(wimp_w w);
102 os_error *wimp_set_extent(wimp_redrawstr *r);
103 os_error *wimp_get_wind_state(wimp_w w,wimp_wstate *s);
104 os_error *wimp_get_wind_info(wimp_winfo *w);
105 os_error *wimp_get_icon_info(wimp_w w,wimp_i i,wimp_icon *icn);
106 os_error *wimp_set_icon_state(wimp_w w,wimp_i i,int eorMask,int bicMask);
107 os_error *wimp_which_icon(wimp_which_block *w,wimp_i *icons);
108 os_error *wimp_getwindowoutline(wimp_redrawstr *r);
109
110 /*----- Redrawing windows -------------------------------------------------*/
111
112 os_error *wimp_redraw_wind(wimp_redrawstr *r,BOOL *more);
113 os_error *wimp_update_wind(wimp_redrawstr *r,BOOL *more);
114 os_error *wimp_get_rectangle(wimp_redrawstr *r,BOOL *more);
115 os_error *wimp_force_redraw(wimp_redrawstr *r);
116 os_error *wimp_ploticon(wimp_icon *i);
117 os_error *wimp_blockcopy(wimp_w w,wimp_box *box,int x,int y);
118
119 /*----- Menu handling -----------------------------------------------------*/
120
121 os_error *wimp_create_menu(wimp_menustr *m,int x,int y);
122 os_error *wimp_create_submenu(wimp_menustr *m,int x,int y);
123 os_error *wimp_decode_menu(wimp_menustr *m,void *hits,void *stringbuffer);
124 os_error *wimp_getmenustate(int action,
125                             int *hits,...
126                          /* wimp_w w, */
127                          /* wimp_i i */);
128
129 /*----- Colour handling ---------------------------------------------------*/
130
131 os_error *wimp_setcolour(int colour);
132 os_error *wimp_textcolour(int colour);
133 os_error *wimp_setfontcolours(int background,int foreground);
134 os_error *wimp_setpalette(wimp_palettestr *pal);
135 os_error *wimp_readpalette(wimp_palettestr *pal);
136
137 /*----- Sprite handling ---------------------------------------------------*/
138
139 os_error *wimp_spriteop(int action,char *sprite);
140 os_error *wimp_spriteop_full(os_regset r);
141 void *wimp_baseofsprites(void);
142 os_error *wimp_readpixtrans(sprite_area *sa,
143                             sprite_id *sid,
144                             sprite_factors *zoomage,
145                             sprite_pixtrans *pixtrans);
146
147 /*----- Message handling --------------------------------------------------*/
148
149 os_error *wimp_sendmessage(wimp_etype event,wimp_msgstr *m,wimp_t dest);
150 os_error *wimp_sendwmessage(wimp_etype event,
151                             wimp_msgstr *m,
152                             wimp_w w,
153                             wimp_i i);
154 os_error *wimp_addmessages(wimp_msgaction *messages);
155 os_error *wimp_removemessages(wimp_msgaction *messages);
156
157 /*----- Pointer handling --------------------------------------------------*/
158
159 os_error *wimp_get_point_info(wimp_mousestr *m);
160 os_error *wimp_set_point_shape(wimp_pshapestr *shapeinfo);
161
162 /*----- Caret and key handling --------------------------------------------*
163  *
164  * Warning: Don't pass STEEL extended keyset keys on with wimp_processkey!
165  *          Only use standard WIMP key mapping codes.
166  */
167
168 os_error *wimp_set_caret_pos(wimp_caretstr *c);
169 os_error *wimp_get_caret_pos(wimp_caretstr *c);
170 os_error *wimp_processkey(int key);
171
172 /*----- Handing template files --------------------------------------------*/
173
174 os_error *wimp_open_template(char *filename);
175 os_error *wimp_close_template(void);
176 os_error *wimp_load_template(wimp_template *loadinfo);
177
178 /*----- Miscellaneous calls -----------------------------------------------*
179  *
180  * Warning: Use _dll_starttask instead of wimp_starttask if you are using
181  *          a dynamically linked STEEL.
182  */
183
184 os_error *wimp_drag_box(wimp_dragstr *d);
185 os_error *wimp_starttask(char *command);
186 os_error *wimp_reporterror(os_error *error,wimp_errflags how,char *appname);
187 os_error *wimp_setmode(int newmode);
188 os_error *wimp_slotsize(int *current,int *next,int *free);
189 os_error *wimp_commandwindow(wimp_commandwind *dowhat);
190 os_error *wimp_transferblock(wimp_t sourceTask,
191                              char *sourceBuffer,
192                              wimp_t destinationTask,
193                              char *destinationBuffer,
194                              int size);
195 os_error *wimp_readsysinfo(wimp_sysinfo info,
196                            int *r0_out,...
197                         /* int *r1_out */);
198
199 /*----- The end -----------------------------------------------------------*/
200
201 #endif