ftp.nice.ch/pub/next/connectivity/news/NewsBase.3.02.s.tar.gz#/NewsBase302.source/NNTP/IPercentageView.m

This is IPercentageView.m in view mode; [Download] [Up]

/* Generated by Interface Builder */

#import "IPercentageView.h"
#import <dpsclient/wraps.h>
#import <appkit/graphics.h>

@implementation IPercentageView

- initFrame:(const NXRect *)frameRect
{
    [super initFrame:frameRect];
    iMin = 0.0;
    iMax = 1.0;
    return self;
}

- setMin:(float)amin max:(float)amax
{
    iMin = amin;
    iMax = amax;
    if (iMin > iMax) {
	fprintf(stderr,"IPercentageView: min is larger than max\n");
	return nil;
    }
    return self;
}

- displayValue:(float)aval
{
    iVal = aval;
    return ([self display]);
}

- resetValue
{
    [self setMin:0.0 max:0.0];
    return ([self display]);
}

- drawSelf:(const NXRect *)rects :(int)rectCount
{
    NXRect	drawRect;
    
    drawRect = *rects;
    NXDrawGrayBezel(&bounds, NULL);
    NXInsetRect(&drawRect, 2.0, 2.0);
    if ((iMax-iMin) != 0) {
	drawRect.size.width = drawRect.size.width * (iVal - iMin) / (iMax - iMin);
	PSsetgray(NX_DKGRAY);
	PSrectfill(drawRect.origin.x, drawRect.origin.y,
    			 drawRect.size.width, drawRect.size.height);
    }

    return ([super drawSelf:rects :rectCount]);
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.