4 ; Filer-like windows with re-arranging icons
6 ; © 1995-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Sapphire library.
13 ; Sapphire 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)
18 ; Sapphire 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.
23 ; You should have received a copy of the GNU General Public License
24 ; along with Sapphire. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Overview -------------------------------------------------------------
40 ; viewer_dragSelection
46 [ :LNOT::DEF:viewer__dfn
49 ; --- viewer_create ---
51 ; On entry: R0 == pointer to a viewer definition block
52 ; R1 == pointer to a list
53 ; R2 == sprite area for window
55 ; On exit: R0 == viewer handle
58 ; Use: Creates a viewer window. The viewer definition block
59 ; contains various interesting bits of information about the
60 ; viewer which are likely to be known at assembly time:
62 ; (word) address of a list manager definition block
63 ; (word) address of a shape handler function (or 0)
64 ; (word) standard width of icons
65 ; (word) standard height of icons
66 ; (string) banner text message tag, or empty
68 ; The shape function is used to allow viewer icons to have a
69 ; non-rectangular shape. The function is called with a reason
70 ; code in R0; entry and exit conditions depend on this:
74 ; R1 == pointer to list item
75 ; R2 == standard width of icon
76 ; R3 == standard height of icon
79 ; R2 == width of this icon
80 ; R3 == height of this icon
83 ; This routine is used to find the actual size of an icon.
84 ; The icons are aligned on a grid according to the largest
85 ; one: this routine is used to find out which one that is.
89 ; R1 == pointer to list item
90 ; R2 == address of bounding box of this icon
91 ; R3 == address of bounding box to compare
94 ; CS if boxes intersect, else CC
97 ; For detecting mouse clicks etc. on an icon. viewer has
98 ; already ensured that the box in R3 intersects with the
99 ; bounding box, so for rectangular icons, you can just return
100 ; with C set always. This entry is provided so that you
101 ; can check against the sprite and text of a text+sprite
104 ; More reason codes may be added later; it will always be
105 ; sensible to return immediately preserving all registers and
110 ; --- viewer_destroy ---
112 ; On entry: R0 == viewer handle
116 ; Use: Destroys a viewer, removing it from the screen etc.
118 IMPORT viewer_destroy
120 ; --- viewer_open ---
122 ; On entry: R0 == viewer handle
123 ; R1 == opening style
124 ; R2,R3 == extra arguments
128 ; Use: Opens a viewer window on the screen.
132 ; --- viewer_close ---
134 ; On entry: R0 == viewer handle
138 ; Use: Closes a viewer window.
142 ; --- viewer_eventHandler ---
144 ; On entry: R0 == viewer handle
145 ; R1 == pointer to event handler
146 ; R2 == value to pass in R10
147 ; R3 == value to pass in R12
149 ; On exit: R1-R3 == old values
151 ; Use: Sets up the event handle for the viewer.
153 IMPORT viewer_eventHandler
155 ; --- viewer_select ---
157 ; On entry: R0 == viewer handle
159 ; R2 == 0 to unselect, 1 to select or 2 to toggle
163 ; Use: Selects an icon, or maybe unselects it. Whatever, it doesn't
164 ; flicker if it doesn't need to.
168 ; --- viewer_isSelected ---
170 ; On entry: R0 == viewer handle
173 ; On exit: CS if icon is selected, else CC
175 ; Use: Informs you whether an icon is selected.
177 IMPORT viewer_isSelected
179 ; --- viewer_selectAll ---
181 ; On entry: R0 == viewer handle
182 ; R2 == 0 to deselect, or 1 to select
186 ; Use: Selects or deselects all the icons in a viewer.
188 IMPORT viewer_selectAll
190 ; --- viewer_click ---
192 ; On entry: R0 == viewer handle
193 ; R1 == icon handle (or 0)
194 ; R2 == mouse button state
198 ; Use: Handles a click, drag etc. according to the standard
203 ; --- viewer_dragSelection ---
205 ; On entry: R0 == viewer handle
209 ; Use: Starts a drag of the icons within the viewer. When the drag
210 ; is finished, you get sent a vwEvent_dragged event.
212 IMPORT viewer_dragSelection
214 ; --- viewer_window ---
216 ; On entry: R0 == viewer handle
218 ; On exit: R0 == window handle
220 ; Use: Returns the window handle of the viewer.
224 ; --- viewer_update ---
226 ; On entry: R0 == viewer handle
231 ; Use: Updates (redraws) a given icon.
235 ; --- viewer_setTitle ---
237 ; On entry: R0 == viewer handle
242 ; Use: Sets the viewer window's title.
244 IMPORT viewer_setTitle
246 ; --- viewer_rescan ---
248 ; On entry: R0 == viewer handle
252 ; Use: Rescans all the icons in the viewer and forces a redraw,
253 ; in case icons have been added or deleted (or renamed). Note
254 ; that the redraw is done *anyway* -- it's your responsibility
255 ; to avoid calling this routine when you don't need to.
259 ;----- Shape function reason codes ------------------------------------------
262 vwShape_size # 1 ;Read an icon's size
263 ;Entry: R1 == list item
265 ;Exit: R2,R3 == actual size
267 vwShape_intersects # 1 ;Does icon intersect box?
268 ;Entry: R1 == list item
269 ; R2 == ptr to icon box
271 ;Exit: CS if intersect
273 vwShape_slowBit # 1 ;Does icon need slow redraw
274 ;Entry: R1 == list item
275 ; R2 == ptr to icon box
278 ;----- Viewer event codes ---------------------------------------------------
281 vwEvent_close # 1 ;User has closed the window
283 vwEvent_click # 1 ;User has clicked an icon
284 ;R1 == icon handle (or 0)
287 vwEvent_double # 1 ;User has double-clicked
288 ;R1 == icon handle (or 0)
291 vwEvent_drag # 1 ;User has dragged the mouse
292 ;R1 == icon handle (or 0)
295 vwEvent_menu # 1 ;User has clicked menu
296 ;R1 == icon handle (or 0)
299 vwEvent_redraw # 1 ;Redraw a viewer icon
301 ;R2 == pointer to coords blk
302 ;R3 == pointer to clip blk
303 ;R5,R6 == window origin
305 vwEvent_drop # 1 ;File dropped on the viewer
306 ;R1 == filetype of data
307 ;R2 == estimated size
308 ;R3 == address of filename
311 vwEvent_help # 1 ;Help request for the viewer
312 ;R1 == icon handle, or 0
314 vwEvent_key # 1 ;Key pressed
315 ;R1 == key code (translated)
316 ;Return CS if used, else CC
318 vwEvent_dragged # 1 ;Icons dropped on a window
319 ;R1 == destination window
320 ;R2 == destination icon
322 vwEvent_sprite # 1 ;Return sprite name to use
323 ;Entry: R1 == icon handle
325 ;Exit: CS if sprite found,
326 ; R0 == ptr to spr area
327 ; R1 == pointer to name
330 vwEvent_open # 1 ;The viewer has been moved
331 ;R1 == ptr to open/state blk
333 vwEvent_draw # 1 ;Fully draw icon
335 ;R2 == pointer to coords blk
336 ;R3 == pointer to clip blk
337 ;R5,R6 == window origin
338 ;(Event only used by gallery)
340 vwEvent_unDraw # 1 ;Undraw temporary part
342 ;R2 == pointer to coords blk
343 ;R3 == pointer to clip blk
344 ;R5,R6 == window origin
345 ;(Event only used by gallery)
347 ; --- Drop event subreason codes ---
350 vwDrop_save # 1 ;File from another app
351 vwDrop_load # 1 ;File from filing system
355 ;----- That's all, folks ----------------------------------------------------