This is ProgressView.m in view mode; [Download] [Up]
/**********************************************************************
ProgressView.m
Author: (taken from NeXT doc, DevTools/18_CustomPalette)
Date: 9 December, 1992
**********************************************************************/
#import <dpsclient/wraps.h>
#import "ProgressView.h"
@implementation ProgressView
- initFrame:(const NXRect *)frameRect
{
[super initFrame:frameRect];
total = MAXSIZE;
stepSize = DEFAULTSTEPSIZE;
return self;
}
- drawSelf:(const NXRect *)rects :(int)rectCount
{
PSsetgray(NX_LTGRAY);
NXRectFill(&bounds);
if (ratio > 0) {
NXRect r = bounds;
r.size.width = bounds.size.width * ratio;
PSsetgray(NX_DKGRAY);
NXRectFill(&r);
}
PSsetgray(NX_BLACK);
NXFrameRect(&bounds);
return self;
}
- setStepSize:(int)value
{
stepSize = value;
return self;
}
- (int)stepSize
{
return stepSize;
}
- setRatio:(float)newRatio
{
if (newRatio > 1.0) newRatio = 1.0;
if (ratio != newRatio) {
ratio = newRatio;
[self display];
}
return self;
}
- increment:sender
{
count += stepSize;
[self setRatio:(float)count/(float)total];
return self;
}
- read:(NXTypedStream*)stream
{
[super read:stream];
NXReadTypes(stream, "ii", &total, &stepSize);
return self;
}
- write:(NXTypedStream*)stream
{
[super write:stream];
NXWriteTypes(stream, "ii", &total, &stepSize);
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.