This is BarView.m in view mode; [Download] [Up]
/* Generated by Interface Builder */
#import "BarView.h"
// Copyright 1991 by Eric P. Scott.
// Permission is granted to use this code for any purpose as
// long as proper attribution is given.
@implementation BarView
- initFrame:(const NXRect *)frameRect
{
[super initFrame:frameRect];
[self setOpaque:YES];
[self setClipping:NO];
[self drawInSuperview];
return self;
}
- setFloatValue:(float)aFloat
{
value = aFloat;
[self display];
return self;
}
- (float)floatValue
{
return value;
}
- drawSelf:(const NXRect *)rects :(int)rectCount
{
if (value<1.0) {
PSsetgray(NX_LTGRAY);
NXRectFill(&bounds);
}
if (value>0.0) {
NXRect r;
r = bounds;
if (value<1.0) r.size.width *= value;
#ifdef ORIGINAL
PSsetgray(NX_DKGRAY);
#else
PSsetgray(value>=0.9 ? NX_WHITE : NX_DKGRAY);
#endif
NXRectFill(&r);
}
return self;
}
- takeFloatValueFrom:sender
{
[self setFloatValue:[sender floatValue]];
return self;
}
- write:(NXTypedStream *)stream
{
[super write:stream];
NXWriteTypes(stream, "f", &value);
return self;
}
- read:(NXTypedStream *)stream
{
[super read:stream];
NXReadTypes(stream, "f", &value);
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.