home *** CD-ROM | disk | FTP | other *** search
- /* Timer.h
- * Written By: Thomas Burkholder
- *
- * You may freely copy, distribute, and reuse the code in this example.
- * NeXT disclaims any warranty of any kind, expressed or implied, as to its
- * fitness for any particular use.
- */
-
- #import <appkit/appkit.h>
-
- void handler(DPSTimedEntry tag, double now, char *data);
-
- // An action-emitting object that also carries state.
- @interface Timer:Object
- {
-
- id target;
- SEL action;
- DPSTimedEntry entry;
- double period;
- int priority;
-
- struct {
- #ifdef __BIG_ENDIAN__
- unsigned int visibleDebug:1;
- unsigned int wrap:1;
- unsigned int sync:1;
- unsigned int RESERVED:5;
- #else
- unsigned int RESERVED:5;
- unsigned int sync:1;
- unsigned int wrap:1;
- unsigned int visibleDebug:1;
- #endif
- } bFlags;
-
- int syncValue;
- float value;
- float startValue;
- float wrapValue;
- float incrementBy;
-
- // ivars that we don't want to archive
- unsigned int syncTime;
- int syncCounter;
- IMP actionFunc;
- }
-
- // initializing and freeing the object
- - init;
- - free;
-
- // action methods
- - start:sender;
- - stop:sender;
- - pause:sender;
- - resume:sender;
-
- // methods to get/set the value of the timer
- - (float)floatValue;
- - setFloatValue:(float)aValue;
- - (int)intValue;
- - setIntValue:(int)aValue;
- - (const char *)stringValue;
- - setStringValue:(const char *)aValue;
- - (double)doubleValue;
- - setDoubleValue:(double)aValue;
- - (float)incrementBy;
-
- // methods to get/set behaviours
- - target;
- - setTarget:anObject;
- - (SEL)action;
- - setAction:(SEL)anAction;
- - (DPSTimedEntry) entry;
- - (double)period;
- - setPeriod:(double)aPeriod;
- - (int)priority;
- - setPriority:(int)aPriority;
- - (BOOL)visibleDebug;
- - setVisibleDebug:(BOOL)yn;
- - (float)startValue;
- - setStartValue:(float)aValue;
-
-
- // Synchronization
- - (unsigned int)currentTime;
- - (BOOL)sync;
- - setSync:(BOOL)yn;
- - (int)syncValue;
- - setSyncValue:(int)aValue;
- - synchronize:sender;
-
- // Wrapping
- - (BOOL)wrap;
- - setWrap:(BOOL)yn;
- - (float)wrapValue;
- - setWrapValue:(float)aValue;
- - setIncrementBy:(float)aValue;
-
- // archival methods
- - read:(NXTypedStream *)stream;
- - write:(NXTypedStream *)stream;
-
- @end
-