4 ; Nice listbox handling routines
6 ; © 1994-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 -------------------------------------------------------------
47 [ :LNOT::DEF:listbox__dfn
52 ; On entry: R0 == pointer to list manager description block
53 ; R1 == pointer to the list
54 ; R2 == pointer to a width function
55 ; R3 == The height of each item
56 ; R4 == parent window handle or
57 ; pointer to window block if R5 == -1
58 ; R5 == parent icon handle or -1 if not a pane
60 ; On exit: R0 == listbox handle
61 ; R1 == window handle of list box
62 ; May return an error (R1 corrupted)
68 ; On entry: R0 == listbox handle
72 ; Use: Destroys the given listbox.
76 ; --- lb_eventHandler ---
78 ; On entry: R0 == listbox handle
79 ; R1 == handler function
80 ; R2 == R10 value to pass
81 ; R3 == R12 value to pass
85 ; Use: Registers an event handler for the given listbox.
87 IMPORT lb_eventHandler
89 ; --- lb_plotString ---
91 ; On entry: R0 == pointer to a string
92 ; R1 == pointer to the list item
93 ; R2-R5 == window coordinates to plot it
94 ; R10 == pointer to the listbox
98 ; Use: Plots a list item consisting of a single string. It assumes
99 ; the default selection model.
105 ; On entry: R0 == listbox handle
107 ; On exit: May return an error
109 ; Use: Updates the entire listbox prettily
113 ; --- lb_updateItem ---
115 ; On entry: R0 == list box handle
116 ; R1 == list item handle
120 ; Use: Redraws a list item to reflect a change in its state.
126 ; On entry: R0 == listbox handle
128 ; R2 == 0 to unselect, 1 to select, or 2 to toggle
132 ; Use: Selects or deselects a listbox item, nicely and without
137 ; --- lb_isSelected ---
139 ; On entry: R0 == listbox handle
142 ; On exit: CS if item is selected, else CC
144 ; Use: Informs you whether an item is selected.
148 ; --- lb_clearSelection ---
150 ; On entry: R0 == listbox handle
151 ; R1 == item handle of item to ignore (or 0 for none)
155 ; Use: Deselects all items in the listbox.
157 IMPORT lb_clearSelection
161 ; On entry: R0 == listbox handle
162 ; R1 == pointer to list item
163 ; R3 == mouse button status
167 ; Use: Provides a default action for clicking on an item in a
170 ; Only one selection is possible at any one time.
176 ; On entry: R0 == listbox handle
177 ; R1 == pointer to list item
178 ; R3 == mouse button status
182 ; Use: Provides a default action for clicking on an item in a
185 ; The multiple selection model is used.
191 ; On entry: R1 == pointer to list item
192 ; R2 == window relative y position
193 ; R3 == mouse button status
194 ; R10 == listbox handle
198 ; Use: Starts a drag operation to allow for easy multiple
203 ; --- lb_inserted ---
205 ; On entry: R0 == pointer to the listbox
206 ; R1 == pointer to the new item
210 ; Use: Informs the listbox that an item has been inserted,
211 ; and causes a flicker free insert to occur if possible.
217 ; On entry: R0 == pointer to the listbox
218 ; R1 == index of item removed
222 ; Use: Informs the listbox that an item has been removed, and
223 ; causes a flicker free remove to occur, if possible.
229 ; On entry: R0 == listbox handle
231 ; On exit: R0 == window handle
233 ; Use: Returns the window handle of the listbox
243 ; Use: Initialises the listbox unit.
247 ;----- List events ----------------------------------------------------------
250 lbEvent_close # 1 ;Listbox has been closed
252 lbEvent_redraw # 1 ;Redraw a list item
253 ;R1 == pointer to list item
254 ;R2-R5 == window coords
255 lbEvent_click # 1 ;Click/Double on listbox
256 ;R1 == pointer to list item
257 ;R2 == window relative y pos
258 ;R3 == button type (10)
259 lbEvent_menu # 1 ;Menu click
260 ;R1 == pointer to list item
261 ;R2 == window relative y pos
262 ;R3 == button type (10)
263 lbEvent_drag # 1 ;Drag on listbox
264 ;R1 == pointer to list item
265 ;R2 == window relative y pos
266 ;R3 == button type (10)
267 lbEvent_help # 1 ;R1 == pointer to list item
268 lbEvent_drop # 1 ;R1 == pointer to list item
270 ;R3 == pointer to filename
271 ;R4 == estimated file size
281 ;----- That's all, folks ----------------------------------------------------