appletcursor.c

Go to the documentation of this file.
00001 
00002 /*  $Id: appletcursor.c 355 2005-01-11 22:48:55Z andreradke $    */
00003 
00004 /* copyright 1991-96 UserLand Software, Inc. All Rights Reserved.*/
00005 
00006 
00007 #include "appletdefs.h"
00008 #include "appletcursor.h"
00009 
00010 
00011 
00012 static long ticklastroll = 0;
00013 
00014 static short beachballstate = cursorisbeachball4;
00015 
00016 static short earthstate = cursorisearth7;
00017 
00018 
00019 
00020 void setcursortype (tycursortype cursor) {
00021     
00022     CursHandle hcursor;
00023     
00024     if (cursor == cursorisarrow) {
00025         
00026         SetCursor (&quickdrawglobal (arrow));
00027         
00028         return;
00029         }
00030     
00031     hcursor = GetCursor (cursor);
00032     
00033     if (hcursor != nil) 
00034         SetCursor (*hcursor);
00035     } /*setcursortype*/
00036 
00037 
00038 void obscurecursor (void) {
00039     
00040     ObscureCursor ();
00041     } /*obscurecursor*/
00042 
00043 
00044 static boolean rollingtimerexpired (void) {
00045     
00046     long tc;
00047     
00048     tc = TickCount ();
00049     
00050     if ((ticklastroll == 0) || (tc > (ticklastroll + 6))) {
00051     
00052         ticklastroll = tc;
00053         
00054         return (true);
00055         }
00056         
00057     return (false);
00058     } /*rollingtimerexpired*/
00059     
00060     
00061 void rollbeachball (void) {
00062     
00063     tycursortype state;
00064     
00065     if (rollingtimerexpired ()) {
00066     
00067         state = (tycursortype) (beachballstate + 1);
00068         
00069         if (state > cursorisbeachball4) 
00070             state = cursorisbeachball1;
00071         
00072         setcursortype (state);
00073         
00074         beachballstate = state;
00075         }
00076     } /*rollbeachball*/
00077 
00078 
00079 void initbeachball (void) {
00080     
00081     ticklastroll = 0;
00082     
00083     rollbeachball ();
00084     } /*initbeachball*/
00085     
00086     
00087 void initearth (void) {
00088     
00089     earthstate = cursorisearth1;
00090     
00091     ticklastroll = TickCount ();
00092     } /*initearth*/
00093 
00094 
00095 void rollearth (void) {
00096     
00097     tycursortype state;
00098     
00099     if (rollingtimerexpired ()) {
00100     
00101         state = (tycursortype) (earthstate + 1); 
00102         
00103         if (state > cursorisearth7) /*wrap around*/
00104             state = cursorisearth1;
00105                         
00106         setcursortype (state);
00107         
00108         earthstate = state;
00109         }
00110     } /*rollearth*/
00111 
00112 
00113 void watchcursor () {
00114     
00115     CursHandle hcursor;
00116     
00117     hcursor = GetCursor (watchCursor);
00118     
00119     if (hcursor != nil) 
00120         SetCursor (*hcursor);
00121     } /*watchcursor*/
00122     
00123     
00124 void arrowcursor () {
00125     
00126     SetCursor (&quickdrawglobal (arrow));
00127     } /*arrowcursor*/
00128     
00129     
00130 
00131 

Generated on Wed May 31 18:19:40 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6