This is TrafficLightView.m in view mode; [Download] [Up]
/* Generated by Interface Builder */ #import "TrafficLightView.h" #import "cards.h" #import "cheap_strings.h" #import "draw_ball.h" #import <appkit/graphics.h> #import <assert.h> // These data structures specify circle information to draw // the read and green lights and two smaller balls that depict // the traffic light lit. For example, the roll card has the stop // light drawn in black the the green light in light gray. The balls // are therefore drawn in light gray. The stop light draws the // green light in black and the red light in dark gray. The balls // are therefore drawn in dark gray. float redLight[] = { 40 + 10.0, 90 + 10.0, ( 18 / 2 ) }, greenLight[] = { 40 + 10.0, 40 + 10.0, ( 18 / 2 ) }, ulBall[] = { 9 + 6.1090, 130 + 6.1090, ( 11 / 2 ) }, lrBall[] = { 80 + 6.1090, 9 + 6.1090, ( 11 / 2 ) }; @implementation TrafficLightView - init { [ super init ]; bottomFaceBitmap = [[ CardImage allocFromZone:cardZone ] initFromFile:TRAFFIC_LIGHT_TEMPLATE_BOTTOM_FACE ]; assert( bottomFaceBitmap ); return self; } - drawSelf:( const NXRect * )rects :( int )rectCount { assert( label ); [ super drawSelf:rects :rectCount ]; if( !showTopFaceFlag ) { float nameBox[] = { 52, 129, 42, 14 }; draw_ball( redLightColor, redLight ); draw_ball( greenLightColor, greenLight ); draw_ball( ballAndLabelColor, ulBall ); draw_ball( ballAndLabelColor, lrBall ); draw_string( nameBox, ballAndLabelColor, 14.0, label ); } return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.