4 * Provides a bit more control than the original version
6 * © 1994-1998 Straylight
9 /*----- Licensing note ----------------------------------------------------*
11 * This file is part of Straylight's Steel library.
13 * Steel 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 * Steel 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 Steel. If not, write to the Free Software Foundation,
25 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 extern void _dllEntry(visdelay__exitHandler)(void);
41 static visdelay_state visdelay__state={0,-1};
42 static BOOL visdelay__exit;
45 * void visdelay__exitHandler(void)
48 * Shuts the hourglass off if we've used it
51 _dll_static void visdelay__exitHandler(void)
53 if (visdelay__state.count)
54 wimpt_noerr(_swix(XHourglass_Off,0));
58 * void visdelay_begin(void)
61 * Starts the hourglass.
64 void visdelay_begin(void)
66 if (!visdelay__state.count)
68 wimpt_noerr(_swix(XHourglass_On,0));
69 visdelay__state.percent=-1;
71 visdelay__state.count++;
74 atexit(_dllEntry(visdelay__exitHandler));
80 * void visdelay_end(void)
83 * Turns off the hourglass. Note that calls to visdelay_begin() and
84 * visdelay_end() must be matched.
87 void visdelay_end(void)
89 if (visdelay__state.count)
91 visdelay__state.count--;
92 wimpt_noerr(_swix(XHourglass_Off,0));
97 * void visdelay_percent(int percent)
100 * Puts up the little percentage indicator on the hourglass.
103 * int percent == the percentage number to indicate.
106 void visdelay_percent(int percent)
108 wimpt_noerr(_swix(XHourglass_Percentage,_in(0),percent));
109 visdelay__state.percent=percent;
113 * visdelay_state visdelay_suspend(void)
116 * Turns the hourglass right off. It also returns information about the
117 * current state of the hourglass so that it can be resumed.
120 * State information recorded in an undefined manner.
123 visdelay_state visdelay_suspend(void)
125 visdelay_state c=visdelay__state;
126 wimpt_noerr(_swix(XHourglass_Off,0));
127 visdelay__state.count=0;
132 * void visdelay_resume(visdelay_state state)
135 * Returns the hourglass to the state it was in when the last
136 * visdelay_suspend() call was made.
139 * visdelay_state state == the hourglass state as returned by
140 * visdelay_suspend().
143 void visdelay_resume(visdelay_state state)
145 visdelay__state=state;
146 if (visdelay__state.count)
148 wimpt_noerr(_swix(XHourglass_On,0));
149 wimpt_noerr(_swix(XHourglass_Percentage,_in(0),visdelay__state.percent));