This is UHLineShape.m in view mode; [Download] [Up]
/* Generated by Interface Builder */
#import "UHLineShape.h"
@implementation UHLineShape
- initFrame:(const NXRect *)frameRect
{
[super initFrame:frameRect];
choice=UH_VARIABLESLOPE;
angle = 0.0;
return self;
}
-(const char *)getInspectorClassName;
{
return "UHLineShapeInspector";
}
- drawSelf:(const NXRect *)r :(int)c
{
switch(choice)
{
case UH_HORIZONTAL :
PSmoveto(0.0, bounds.size.height/2.0);
PSrlineto(bounds.size.width, 0);
break;
case UH_VERTICAL :
PSmoveto(bounds.size.width/2.0,0.0);
PSrlineto( 0.0, bounds.size.height);
break;
case UH_POSITIVESLOPE:
PSmoveto(0.0,0.0);
PSrlineto(bounds.size.width, bounds.size.height);
break;
case UH_NEGATIVESLOPE:
PSmoveto(bounds.size.width, 0.0);
PSrlineto(-bounds.size.width, bounds.size.height);
break;
case UH_VARIABLESLOPE:
default:
PStranslate((bounds.size.width/2.00),(bounds.size.height/2.00));
PSrotate(angle);
PSmoveto(MIN(bounds.size.width,bounds.size.height)/2.00, 0.0);
PSrlineto(-MIN(bounds.size.width,bounds.size.height), 0.0);
break;
}
NXSetColor(lineColor);
PSsetlinewidth(lineWidth);
PSstroke();
return self;
}
- setAngle:(float)value
{
angle = value;
return self;
}
- (float)angle
{
return angle;
}
- read:(NXTypedStream*)stream
{
[super read:stream];
NXReadType(stream,"f", &angle);
return self;
}
- write:(NXTypedStream*)stream
{
[super write:stream];
NXWriteType(stream,"f", &angle);
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.