home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / Palettes / TTools / TToolsPalette / Timer.subproj / Timer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-09  |  2.0 KB  |  106 lines

  1. /* Timer.h
  2.  * Written By:  Thomas Burkholder
  3.  *
  4.  * You may freely copy, distribute, and reuse the code in this example.
  5.  * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
  6.  * fitness for any particular use.
  7.  */
  8.  
  9. #import <appkit/appkit.h>
  10.  
  11. void handler(DPSTimedEntry tag, double now, char *data);
  12.  
  13. // An action-emitting object that also carries state.
  14. @interface Timer:Object
  15. {
  16.  
  17.     id            target;
  18.     SEL            action;
  19.     DPSTimedEntry    entry;
  20.     double        period;
  21.     int            priority;
  22.  
  23.     struct {
  24. #ifdef __BIG_ENDIAN__
  25.         unsigned int    visibleDebug:1;
  26.         unsigned int    wrap:1;
  27.         unsigned int    sync:1;
  28.         unsigned int    RESERVED:5;
  29. #else
  30.         unsigned int    RESERVED:5;
  31.         unsigned int    sync:1;
  32.         unsigned int    wrap:1;
  33.         unsigned int    visibleDebug:1;
  34. #endif
  35.     } bFlags;
  36.  
  37.     int            syncValue;
  38.     float            value;
  39.     float            startValue;
  40.     float            wrapValue;
  41.     float            incrementBy;
  42.  
  43.     // ivars that we don't want to archive
  44.     unsigned        int syncTime;
  45.     int            syncCounter;
  46.     IMP            actionFunc;
  47. }
  48.  
  49. // initializing and freeing the object
  50. - init;
  51. - free;
  52.  
  53. // action methods
  54. - start:sender;
  55. - stop:sender;
  56. - pause:sender;
  57. - resume:sender;
  58.  
  59. // methods to get/set the value of the timer
  60. - (float)floatValue;
  61. - setFloatValue:(float)aValue;
  62. - (int)intValue;
  63. - setIntValue:(int)aValue;
  64. - (const char *)stringValue;
  65. - setStringValue:(const char *)aValue;
  66. - (double)doubleValue;
  67. - setDoubleValue:(double)aValue;
  68. - (float)incrementBy;
  69.  
  70. // methods to get/set behaviours
  71. - target;
  72. - setTarget:anObject;
  73. - (SEL)action;
  74. - setAction:(SEL)anAction;
  75. - (DPSTimedEntry) entry;
  76. - (double)period;
  77. - setPeriod:(double)aPeriod;
  78. - (int)priority;
  79. - setPriority:(int)aPriority;
  80. - (BOOL)visibleDebug;
  81. - setVisibleDebug:(BOOL)yn;
  82. - (float)startValue;
  83. - setStartValue:(float)aValue;
  84.  
  85.  
  86. // Synchronization
  87. - (unsigned int)currentTime;
  88. - (BOOL)sync;
  89. - setSync:(BOOL)yn;
  90. - (int)syncValue;
  91. - setSyncValue:(int)aValue;
  92. - synchronize:sender;
  93.  
  94. // Wrapping
  95. - (BOOL)wrap;
  96. - setWrap:(BOOL)yn;
  97. - (float)wrapValue;
  98. - setWrapValue:(float)aValue;
  99. - setIncrementBy:(float)aValue;
  100.  
  101. // archival methods
  102. - read:(NXTypedStream *)stream;
  103. - write:(NXTypedStream *)stream;
  104.  
  105. @end
  106.