3 * provides handling for clever buttons and things.
5 * v. 1.00 (23 July 1991)
7 * © 1991-1998 Straylight
10 /*----- Licensing note ----------------------------------------------------*
12 * This file is part of Straylight's Steel library.
14 * Steel is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2, or (at your option)
19 * Steel is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with Steel. If not, write to the Free Software Foundation,
26 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40 typedef void (*buttons_arrowProc)(dbox d,dbox_field f,int diff,void *handle);
50 * A function to handle the update of a slider.
52 typedef void (*buttons_sliderHandler)(dbox d,wimp_i i,int val,void *handle);
55 * void buttons_arrowClick
66 * Increases (or decreases) the value in a writable box. If the last event
67 * was a click with the adjust button, the increment is made negative (i.e.
68 * 1 becomes -1, and -1 becomes 1), following the standard convention. The
69 * value will not be allowed to exceed the limits passed. If you don't
70 * want limits, make max and min the same. Optionally, you can make the
71 * field's value 'wrap around' if it goes out of range.
74 * dbox d == the dbox handle
75 * dbox_field f == the field number
76 * int min == the lowest allowable value for the field
77 * int max == the highest allowable value for the field
78 * int increment == what to add to the value. This may be negative.
79 * BOOL wrap == wrap around or not
82 void buttons_arrowClick
93 * void buttons_arrow(dbox d,
97 * buttons_arrowProc p,
102 * Handles a click on an arrow button. It constrains the mouse pointer
103 * so it doesn't drift away annoyingly, and presses the icon in (by
104 * selecting it, so set up the sprites properly) while it's being clicked,
105 * with nary a flicker in sight. It simulates auto-repeat on the button,
106 * so don't use real auto-repeat buttons.
109 * dbox d,dbox_field f == the icon that was clicked
110 * dbox wd,dbox_field wf == the (writable) icon that is passed to p
111 * buttons_arrowProc p == a procedure to call for each `click' on the
112 * button. It may call buttons_arrowClick to bump the field. If you pass
113 * 0, a default function is called which just bumps the icon. handle must
114 * point to a buttons_simpleArrow structure filled in correctly.
115 * int diff == the difference to add to the icon (passed to p). The sign
116 * is toggled if the click was with the adjust button.
117 * void *handle == a handle to pass to p
120 void buttons_arrow(dbox d,
129 * BOOL buttons_insertChar(dbox d,int chcode,char min,char max)
132 * This function inserts the character specified into the writable field
133 * containing the caret. Useful if you want to handle input yourself so
134 * you can update things (such as sliders) in deending on the input. It
135 * will insure that the character is within the limits given (invalid
136 * limits will cause a default of 32-255 to be used).
139 * dbox d == dbox handle
140 * int chcode == the character, as returned from dbox_eventProcess().
141 * char min == minimum character allowable.
142 * char max == maximum character allowable.
145 * Whether it inserted the character or not.
148 BOOL buttons_insertChar(dbox d,int chcode,char min,char max);
151 * void buttons_redrawSlider
162 * Draws a slider in the specified icon
165 * dbox d == dbox handle
166 * wimp_i icon == the icon we're dealing with
167 * int max == the maximum value you want
168 * int val == the current value of the slider
169 * int colour == the WIMP colour for the slider
170 * BOOL isVertical == TRUE if the slider is vertical
173 void buttons_redrawSlider
184 * void buttons_updateSlider
195 * Redraws a slider in the specified icon
198 * dbox d == dbox handle
199 * wimp_i icon == the icon we're dealing with
200 * int max == the maximum value you want
201 * int val == the current value of the slider
202 * int colour == the WIMP colour for the slider
203 * BOOL isVertical == TRUE if the slider is vertical
206 void buttons_updateSlider
217 * void buttons_slideSlider
225 * buttons_sliderHandler proc,
230 * This routine just neatly handles the slider totally. Just pass it the
231 * parameters it needs, and let it get on with it.
235 * wimp_i i == the icon number
236 * int max == the maximum slider value
237 * int *val == a pointer to the slider value (updated as we go along)
238 * int colour == the colour for the slider
239 * BOOL isVertical == whether the slider is vertical
240 * buttons_sliderHandler proc == a slider handler, which can update, say a
241 * a writable field as the drag takes place
242 * void *handle == a handle to pass the routine
245 void buttons_slideSlider
253 buttons_sliderHandler proc,
258 * void buttons_redrawColourButton(dbox d,wimp_i i,buttons_colourstr *c)
261 * Redraws a true-colour button.
265 * wimp_i i == icon number
266 * buttons_colourstr == the colour we're intersted in
269 void buttons_redrawColourButton(dbox d,wimp_i i,wimp_paletteword c);
272 * buttons_updateColourButton(dbox d,wimp_i i,wimp_paletteword c)
275 * This routine redraws a colour button.
279 * wimp_i == the icon number
280 * wimp_paletteword c == the colour number
283 void buttons_updateColourButton(dbox d,wimp_i i,wimp_paletteword c);