home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscProgressPie.m -- a simple view class for displaying a pie
- // Written and (c) 1993 by James Heiser. (jheiser@adobe.com)
- // Rendering code massaged by Don Yacktman.
- // Version 1.0. All rights reserved.
- //
- // This notice may not be removed from this source code.
- //
- // This object is included in the MiscKit by permission from the author
- // and its use is governed by the MiscKit license, found in the file
- // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
- //
-
- #import "MiscProgressPie.h"
-
- @implementation MiscProgressPie
-
- - initFrame:(const NXRect *)frameRect
- {
- [super initFrame:frameRect];
- [self setHidden:NO];
- return self;
- }
-
- - renderBar
- {
- float angle = 90.0;
- if ([self isHidden] || (ratio <= 0.0)) return self;
- if (ratio >= 1.0) angle = -270.0;
- if (ratio < 1.0 && ratio > 0.0) angle = 90.0 - 360.0 * ratio;
- PSmoveto (NX_WIDTH(&bounds) / 2.0, NX_HEIGHT(&bounds) / 2.0);
- PSarcn (NX_WIDTH(&bounds) / 2.0, NX_HEIGHT(&bounds) / 2.0,
- NX_HEIGHT(&bounds) / 2.0, 90.0, angle);
- PSclosepath ();
- NXSetColor(fg);
- PSfill();
- return self;
- }
-
- - renderBorder
- {
- float angle = 90.0;
- if ([self isHidden]) return self;
- NXSetColor(bd);
- PSarc ((bounds.size.width / 2), (bounds.size.height / 2),
- (bounds.size.height / 2), 0.0, 360.0);
- PSstroke();
- if (ratio >= 1.0) angle = -270.0;
- if ((ratio < 1.0) && (ratio > 0.0)) angle = 90.0 - 360.0 * ratio;
- PSmoveto (NX_WIDTH(&bounds) / 2.0, NX_HEIGHT(&bounds) / 2.0);
- PSarcn (NX_WIDTH(&bounds) / 2.0, NX_HEIGHT(&bounds) / 2.0,
- NX_HEIGHT(&bounds) / 2.0, 90.0, angle);
- PSclosepath();
- PSstroke();
- return self;
- }
-
- - setHidden:(BOOL)aBool
- {
- isHidden = aBool;
- return self;
- }
-
- - (BOOL)isHidden
- {
- return isHidden;
- }
-
- - read:(NXTypedStream*)stream
- {
- [super read:stream];
- NXReadTypes(stream, "c", &isHidden);
- return self;
- }
-
- - write:(NXTypedStream*)stream
- {
- [super write:stream];
- NXWriteTypes(stream, "c", &isHidden);
- return self;
- }
-
- - (const char *)getInspectorClassName
- {
- return "MiscProgressPieInspector";
- }
-
-
- @end
-