home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / IBPalettes / WWTCLKit / WWTTTimer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-22  |  3.5 KB  |  171 lines

  1. /* WWTTTimer.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. // why even declare this and clutter up the namespace?
  12. //void handler(DPSTimedEntry tag, double now, char *data);
  13.  
  14. // An action-emitting object that also carries state.
  15. @interface WWTTTimer:Object
  16. {
  17.  
  18.   id    interp;
  19.   id    startButton;
  20.   id    stopButton;
  21.   id    pauseButton;
  22.  
  23.         BOOL            autoStart;
  24.         BOOL            paused;
  25.     id            target;
  26.     SEL            action;
  27.     DPSTimedEntry    entry;
  28.     double        period;
  29.     int            priority;
  30.     struct {
  31. #ifdef __BIG_ENDIAN__
  32.         unsigned int    visibleDebug:1;
  33.         unsigned int    wrap:1;
  34.         unsigned int    sync:1;
  35.         unsigned int    RESERVED:5;
  36. #else
  37.         unsigned int    RESERVED:5;
  38.         unsigned int    sync:1;
  39.         unsigned int    wrap:1;
  40.         unsigned int    visibleDebug:1;
  41. #endif
  42.     } bFlags;
  43.  
  44.     int            syncValue;
  45.     float            value;
  46.     float            startValue;
  47.     float            wrapValue;
  48.     float            incrementBy;
  49.  
  50.     // ivars that we don't want to archive
  51.     unsigned        int syncTime;
  52.     int            syncCounter;
  53.     IMP            actionFunc;
  54.         BOOL   awakeInIB;
  55.  
  56.   int   preControlStringSize;
  57.   char  *preControlString;
  58.  
  59.   int   conditionalSize;
  60.   char  *conditional;  // my "reason for living"
  61.  
  62.   int   controlStringSize;
  63.   char  *controlString;
  64.   char  *sprintfControlString;
  65.  
  66.   int   postControlStringSize;
  67.   char  *postControlString;
  68.  
  69.   char  *tclCommand;
  70.   int   tclCommandSize;
  71.   BOOL  tclCommandDirty;
  72.   BOOL  finiteLife;
  73.   BOOL  conditionalLifespan;
  74. }
  75.  
  76. // initializing and freeing the object
  77. - init;
  78. - free;
  79.  
  80. // action methods
  81. - start:sender;
  82. - stop:sender;
  83. - pause:sender;
  84. - resume:sender;
  85.  
  86. // methods to get/set the value of the timer
  87. - (float)floatValue;
  88. - setFloatValue:(float)aValue;
  89. - (int)intValue;
  90. - setIntValue:(int)aValue;
  91. - (const char *)stringValue;
  92. - setStringValue:(const char *)aValue;
  93. - (double)doubleValue;
  94. - setDoubleValue:(double)aValue;
  95. - (float)incrementBy;
  96.  
  97. // methods to get/set behaviours
  98. - target;
  99. - setTarget:anObject;
  100. - (SEL)action;
  101. - setAction:(SEL)anAction;
  102. - (DPSTimedEntry) entry;
  103. - (double)period;
  104. - setPeriod:(double)aPeriod;
  105. - (int)priority;
  106. - setPriority:(int)aPriority;
  107. - (BOOL)visibleDebug;
  108. - setVisibleDebug:(BOOL)yn;
  109. - (float)startValue;
  110. - setStartValue:(float)aValue;
  111.  
  112. - (BOOL)autoStart;
  113. - setAutoStart:(BOOL)flag;
  114.  
  115. // Synchronization
  116. - (unsigned int)currentTime;
  117. - (BOOL)sync;
  118. - setSync:(BOOL)yn;
  119. - (int)syncValue;
  120. - setSyncValue:(int)aValue;
  121. - synchronize:sender;
  122.  
  123. // Wrapping
  124. - (BOOL)wrap;
  125. - setWrap:(BOOL)yn;
  126. - (float)wrapValue;
  127. - setWrapValue:(float)aValue;
  128. - setIncrementBy:(float)aValue;
  129.  
  130. // archival methods
  131. - read:(NXTypedStream *)stream;
  132. - write:(NXTypedStream *)stream;
  133.  
  134. // private!! for subclasses only
  135. - logError:(char *)str;
  136. - stopEntry;
  137. - startEntry;
  138.  
  139.  
  140. // WavesWorld stuff
  141. - setInterp:newInterp;
  142. - setPreControlString:(const char *)str;
  143. - (const char *)preControlString;
  144. - setControlString:(const char *)str;
  145. - (const char *)controlString;
  146. - setPostControlString:(const char *)str;
  147. - (const char *)postControlString;
  148. - setTclCommand:(const char *)str;
  149. - (const char *)tclCommand;
  150. - setConditional:(const char *)str;
  151. - (const char *)conditional;
  152.  
  153. - updateTclCommand;
  154. - updateInterp;
  155.  
  156. // new stuff from wave
  157. - (BOOL)finiteLife;
  158. - setFiniteLife:(BOOL)n;
  159. - (BOOL)conditionalLifespan;
  160. - setConditionalLifespan:(BOOL)n;
  161. - (BOOL)checkConditional;
  162.  
  163.  
  164. - takePeriod:sender;
  165. - takeStartValue:sender;
  166. - takeWrapValue:sender;
  167. - takeIncrementBy:sender;
  168. - takeFiniteLife:sender;
  169.  
  170. @end
  171.