Initial revision
[ssr] / StraySrc / Libraries / Sapphire / csapph / h / viewer
1 /*
2 * viewer.h
3 *
4 * [Generated from viewer, 25 September 1996]
5 */
6
7 #if !defined(__CC_NORCROFT) || !defined(__arm)
8 #error You must use the Norcroft ARM Compiler for Sapphire programs
9 #endif
10
11 #pragma include_only_once
12 #pragma force_top_level
13
14 #ifndef __viewer_h
15 #define __viewer_h
16
17 #ifndef __sapphire_h
18 #include "sapphire.h"
19 #endif
20
21 /*----- Overview ----------------------------------------------------------*
22 *
23 * Functions provided:
24 *
25 * viewer_create
26 * viewer_destroy
27 * viewer_open
28 * viewer_close
29 * viewer_eventHandler
30 * viewer_select
31 * viewer_isSelected
32 * viewer_selectAll
33 * viewer_click
34 * viewer_dragSelection
35 * viewer_window
36 * viewer_update
37 * viewer_setTitle
38 * viewer_rescan
39 */
40
41 /* --- viewer_create --- *
42 *
43 * On entry: R0 == pointer to a viewer definition block
44 * R1 == pointer to a list
45 * R2 == sprite area for window
46 *
47 * On exit: R0 == viewer handle
48 * May return an error
49 *
50 * Use: Creates a viewer window. The viewer definition block
51 * contains various interesting bits of information about the
52 * viewer which are likely to be known at assembly time:
53 *
54 * (word) address of a list manager definition block
55 * (word) address of a shape handler function (or 0)
56 * (word) standard width of icons
57 * (word) standard height of icons
58 * (string) banner text message tag, or empty
59 *
60 * The shape function is used to allow viewer icons to have a
61 * non-rectangular shape. The function is called with a reason
62 * code in R0; entry and exit conditions depend on this:
63 *
64 * vwShape_size
65 * On entry
66 * R1 == pointer to list item
67 * R2 == standard width of icon
68 * R3 == standard height of icon
69 *
70 * On exit
71 * R2 == width of this icon
72 * R3 == height of this icon
73 *
74 * Use
75 * This routine is used to find the actual size of an icon.
76 * The icons are aligned on a grid according to the largest
77 * one: this routine is used to find out which one that is.
78 *
79 * vwShape_intersects
80 * On entry
81 * R1 == pointer to list item
82 * R2 == address of bounding box of this icon
83 * R3 == address of bounding box to compare
84 *
85 * On exit
86 * CS if boxes intersect, else CC
87 *
88 * Use
89 * For detecting mouse clicks etc. on an icon. viewer has
90 * already ensured that the box in R3 intersects with the
91 * bounding box, so for rectangular icons, you can just return
92 * with C set always. This entry is provided so that you
93 * can check against the sprite and text of a text+sprite
94 * icon separately.
95 *
96 * More reason codes may be added later; it will always be
97 * sensible to return immediately preserving all registers and
98 * flags.
99 */
100
101 extern routine viewer_create;
102
103 /* --- viewer_destroy --- *
104 *
105 * On entry: R0 == viewer handle
106 *
107 * On exit: --
108 *
109 * Use: Destroys a viewer, removing it from the screen etc.
110 */
111
112 extern routine viewer_destroy;
113
114 /* --- viewer_open --- *
115 *
116 * On entry: R0 == viewer handle
117 * R1 == opening style
118 * R2,R3 == extra arguments
119 *
120 * On exit: --
121 *
122 * Use: Opens a viewer window on the screen.
123 */
124
125 extern routine viewer_open;
126
127 /* --- viewer_close --- *
128 *
129 * On entry: R0 == viewer handle
130 *
131 * On exit: --
132 *
133 * Use: Closes a viewer window.
134 */
135
136 extern routine viewer_close;
137
138 /* --- viewer_eventHandler --- *
139 *
140 * On entry: R0 == viewer handle
141 * R1 == pointer to event handler
142 * R2 == value to pass in R10
143 * R3 == value to pass in R12
144 *
145 * On exit: R1-R3 == old values
146 *
147 * Use: Sets up the event handle for the viewer.
148 */
149
150 extern routine viewer_eventHandler;
151
152 /* --- viewer_select --- *
153 *
154 * On entry: R0 == viewer handle
155 * R1 == icon handle
156 * R2 == 0 to unselect, 1 to select or 2 to toggle
157 *
158 * On exit: --
159 *
160 * Use: Selects an icon, or maybe unselects it. Whatever, it doesn't
161 * flicker if it doesn't need to.
162 */
163
164 extern routine viewer_select;
165
166 /* --- viewer_isSelected --- *
167 *
168 * On entry: R0 == viewer handle
169 * R1 == icon handle
170 *
171 * On exit: CS if icon is selected, else CC
172 *
173 * Use: Informs you whether an icon is selected.
174 */
175
176 extern routine viewer_isSelected;
177
178 /* --- viewer_selectAll --- *
179 *
180 * On entry: R0 == viewer handle
181 * R2 == 0 to deselect, or 1 to select
182 *
183 * On exit: --
184 *
185 * Use: Selects or deselects all the icons in a viewer.
186 */
187
188 extern routine viewer_selectAll;
189
190 /* --- viewer_click --- *
191 *
192 * On entry: R0 == viewer handle
193 * R1 == icon handle (or 0)
194 * R2 == mouse button state
195 *
196 * On exit: --
197 *
198 * Use: Handles a click, drag etc. according to the standard
199 * selection model.
200 */
201
202 extern routine viewer_click;
203
204 /* --- viewer_dragSelection --- *
205 *
206 * On entry: R0 == viewer handle
207 *
208 * On exit: --
209 *
210 * Use: Starts a drag of the icons within the viewer. When the drag
211 * is finished, you get sent a vwEvent_dragged event.
212 */
213
214 extern routine viewer_dragSelection;
215
216 /* --- viewer_window --- *
217 *
218 * On entry: R0 == viewer handle
219 *
220 * On exit: R0 == window handle
221 *
222 * Use: Returns the window handle of the viewer.
223 */
224
225 extern routine viewer_window;
226
227 /* --- viewer_update --- *
228 *
229 * On entry: R0 == viewer handle
230 * R1 == icon handle
231 *
232 * On exit: --
233 *
234 * Use: Updates (redraws) a given icon.
235 */
236
237 extern routine viewer_update;
238
239 /* --- viewer_setTitle --- *
240 *
241 * On entry: R0 == viewer handle
242 * R1 == title string
243 *
244 * On exit: --
245 *
246 * Use: Sets the viewer window's title.
247 */
248
249 extern routine viewer_setTitle;
250
251 /* --- viewer_rescan --- *
252 *
253 * On entry: R0 == viewer handle
254 *
255 * On exit: --
256 *
257 * Use: Rescans all the icons in the viewer and forces a redraw,
258 * in case icons have been added or deleted (or renamed). Note
259 * that the redraw is done *anyway* -- it's your responsibility
260 * to avoid calling this routine when you don't need to.
261 */
262
263 extern routine viewer_rescan;
264
265 /*----- Shape function reason codes ---------------------------------------*/
266
267 #define vwShape_size 0
268
269 #define vwShape_intersects 1
270
271 #define vwShape_slowBit 2
272
273 /*----- Viewer event codes ------------------------------------------------*/
274
275 #define vwEvent_close 0
276
277 #define vwEvent_click 1
278
279 #define vwEvent_double 2
280
281 #define vwEvent_drag 3
282
283 #define vwEvent_menu 4
284
285 #define vwEvent_redraw 5
286
287 #define vwEvent_drop 6
288
289 #define vwEvent_help 7
290
291 #define vwEvent_key 8
292
293 #define vwEvent_dragged 9
294
295 #define vwEvent_sprite 10
296
297 #define vwEvent_open 11
298
299 #define vwEvent_draw 12
300
301 #define vwEvent_unDraw 13
302
303 #define vwDrop_save 0
304 #define vwDrop_load 1
305
306 /*----- That's all, folks -------------------------------------------------*/
307
308 #endif