home *** CD-ROM | disk | FTP | other *** search
- #import "Info.h"
-
- #define POINTSIZE 18.0
-
- static void handler( DPSTimedEntry teNumber, double now, void *userData )
- {
- [ (id)userData animationClick ];
- }
-
- @implementation InfoView
-
- - initFrame:(const NXRect *)rect
- {
- [ super initFrame:rect ];
-
- animationFont = [ Font newFont:"Symbol" size:POINTSIZE matrix:NX_IDENTITYMATRIX ];
-
- return self;
- }
-
- - animateInfo:sender
- {
- [ self display ];
- [ self removeTE ];
-
- [ window setDelegate:self ];
-
- animationStep = 0;
- animationFloat = 0;
- animateTE = DPSAddTimedEntry( .001, (DPSTimedEntryProc)handler, self, NX_BASETHRESHOLD );
-
- return self;
- }
-
- - removeTE
- {
- if( animateTE ) {
- DPSRemoveTimedEntry( animateTE );
- animateTE = 0;
- }
-
- return self;
- }
-
- - windowWillClose:sender
- {
- [ self removeTE ];
- [ window setDelegate:nil ];
-
- return self;
- }
-
- - animationClick
- {
- char *dropstrings[ 4 ] = { "+", "-", "\264", "\270" };
- const float step = 2.0;
-
- float x = NX_WIDTH( &frame ) - animationFloat;
- float y = 0;
-
- [ self lockFocus ];
-
- [ animationFont set ];
-
- PSsetgray( NX_LTGRAY );
- PSmoveto( x, y );
- PSshow( dropstrings[ animationStep ] );
-
- PSsetgray( NX_BLACK );
- PSmoveto( x - step, y );
- PSshow( dropstrings[ animationStep ] );
-
- PSflushgraphics( );
-
- [ self unlockFocus ];
-
- animationFloat += step;
-
- if ( animationFloat >= NX_WIDTH( &bounds ) - animationStep * 10 ) {
- animationFloat = 0;
- animationStep++;
- if( animationStep == 4 )
- [ self removeTE ];
- }
-
- return self;
- }
-
- - drawSelf:(const NXRect *)rects:(int)rectCount
- {
- PSsetgray( NX_LTGRAY );
- NXRectFill( &bounds );
-
- return self;
- }
-
- @end
-