3 * handles a 'caret pointer' - one that changes to a 'I' shape if over a
6 * Also (as of 05-Apr-1994), changes pointer according to `xp<name>,<x>,<y>'
7 * validation string commands.
9 * v. 1.00 (25 July 1993)
11 * © 1993-1998 Straylight
14 /*----- Licensing note ----------------------------------------------------*
16 * This file is part of Straylight's Steel library.
18 * Steel is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2, or (at your option)
23 * Steel is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with Steel. If not, write to the Free Software Foundation,
30 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
44 * The SWI number for Wimp_SendMessage.
46 #define Wimp_SendMessage 0x600E7
48 static BOOL caretptr__onOrOff;
49 static sprite_id caretptr__name;
50 static sprite_area *caretptr__area;
51 static int caretptr__x;
52 static int caretptr__y;
53 static wimp_i caretptr__icon=-20;
54 static BOOL caretptr__stdptr=TRUE;
57 * void caretptr__idles(void *handle)
60 * Called every null event to update the pointer.
63 * void *handle == handle from win segment, not used.
66 static void caretptr__idles(void *handle)
73 wimpt_noerr(wimp_get_point_info(&mse));
74 if (caretptr__icon!=mse.i)
76 wimpt_noerr(wimp_get_icon_info(mse.w,mse.i,&i));
77 bt=(((int)i.flags)>>12)&15;
78 if ((i.flags & wimp_INDIRECT) &&
79 (i.flags & wimp_ITEXT) &&
80 !((wimpt_options() & wimpt_ONOWIMPSHADE) &&
81 (i.flags & 0x001f0000)==0x001f0000) &&
82 (i.data.indirecttext.validstring!=(char *)-1))
88 char *p=i.data.indirecttext.validstring;
92 for (;*p>31 && state!=5;p++)
114 if (p[1]=='p' || p[1]=='P')
159 sid.tag=sprite_id_name;
160 pointer_set_shape(resspr_area(),&sid,x,y);
161 caretptr__stdptr=FALSE;
162 caretptr__icon=mse.i;
167 if (bt==14 || bt==15)
169 wimpt_noerr(pointer_set_shape(caretptr__area,
173 caretptr__stdptr=FALSE;
175 else if (!caretptr__stdptr)
177 pointer_reset_shape();
178 caretptr__stdptr=TRUE;
180 caretptr__icon=mse.i;
185 * void caretPtr(char *name,sprite_area *area,int x,int y)
188 * Turns the caret pointer on
191 * char *name == the name of the sprite to use
192 * sprite_area *area == pointer to sprite area
193 * int x == x position of hotspot
194 * int y == y position of hotspot
197 void caretPtr(char *name,sprite_area *area,int x,int y)
199 if (caretptr__onOrOff)
201 caretptr__name.s.name=name;
202 caretptr__name.tag=sprite_id_name;
206 caretptr__onOrOff=TRUE;
210 void caretPtr__pointer(BOOL ownIt)
212 if (caretptr__onOrOff)
216 win_addIdleClaimer(caretptr__idles,win_DONTCARE,0);
221 win_remove_idle_claimer(caretptr__idles,0);
222 if (!caretptr__stdptr)
223 pointer_reset_shape();
224 caretptr__stdptr=TRUE;
231 * void caretPtrOff(void)
234 * Turns the caretPtr off.
237 void caretPtrOff(void)
239 if (!caretptr__onOrOff)
241 if (caretptr__icon>-20)
243 win_remove_idle_claimer(caretptr__idles,0);
244 pointer_reset_shape();