1 /* 2 * VRectangle.h 3 * 4 * Copyright (C) 1996-2011 by vhf interservice GmbH 5 * Author: Georg Fleischmann 6 * 7 * created: 1997-11-14 8 * modified: 2008-06-08 2011-08-07 (-setDirectionCCW:) 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the vhf Public License as 12 * published by vhf interservice GmbH. Among other things, the 13 * License requires that the copyright notices and this notice 14 * be preserved on all copies. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 19 * See the vhf Public License for more details. 20 * 21 * You should have received a copy of the vhf Public License along 22 * with this program; see the file LICENSE. If not, write to vhf. 23 * 24 * vhf interservice GmbH, Im Marxle 3, 72119 Altingen, Germany 25 * eMail: info@vhf.de 26 * http://www.vhf.de 27 */ 28 29 #ifndef VHF_H_VRECTANGLE 30 #define VHF_H_VRECTANGLE 31 32 #include "VGraphic.h" 33 #include "VPath.h" 34 35 #define PTS_RECTANGLE 4 36 #define PT_LL 0 37 #define PT_UL 1 38 #define PT_UR 2 39 #define PT_LR 3 40 41 @interface VRectangle:VGraphic 42 { 43 NSPoint origin, size; // the origin and size of the rectangle 44 float radius; // the corner radius 45 int filled; // 1 = fill 2 = graduated filled 46 int selectedKnob; // index of the selected knob (0 - 3 or -1) 47 float rotAngle; // the rotation angle 48 NSColor *fillColor; // fillColor if we are filled 49 NSColor *endColor; // endColor if we are graduated/radial filled 50 float graduateAngle; // angle of graduate filling 51 float stepWidth; // stepWidth the color will change by graduate/radial filling 52 NSPoint radialCenter; // the center position for radial filling in percent to the bounds 53 NSMutableArray *graduateList; // list holding the graduate filling graphic objects 54 BOOL graduateDirty; // if we must update the graduateList (calculate the graduate filling new) 55 NSRect coordBounds; // our coord bounding box 56 } 57 58 /* class methods */ 59 60 + (VRectangle*)rectangle; 61 + (VRectangle*)rectangleWithOrigin:(NSPoint)o size:(NSSize)s; 62 63 /* rectangle methods */ 64 - (void)setVertices:(NSPoint)origin :(NSPoint)size; 65 - (void)getVertices:(NSPoint*)origin :(NSPoint*)size; 66 - (void)setRadius:(float)value; 67 - (float)radius; 68 - (void)setSize:(NSSize)size; 69 - (NSSize)size; 70 - (NSColor*)fillColor; 71 - (void)setFillColor:(NSColor*)col; 72 - (NSColor*)endColor; 73 - (void)setEndColor:(NSColor*)col; 74 - (float)graduateAngle; 75 - (void)setGraduateAngle:(float)a; 76 - (void)setStepWidth:(float)sw; 77 - (float)stepWidth; 78 - (void)setRadialCenter:(NSPoint)rc; 79 - (NSPoint)radialCenter; 80 - (void)setRotAngle:(float)angle; 81 - (int)selectedKnobIndex; 82 - (VPath*)pathRepresentation; 83 - (NSArray*)clip:obj; 84 - (BOOL)isPointInside:(NSPoint)p; 85 - (int)isPointInsideOrOn:(NSPoint)p; 86 - (NSPoint)appendToBezierPath:(NSBezierPath*)bPath currentPoint:(NSPoint)currentPoint; 87 88 - (void)setDirectionCCW:(BOOL)ccw; 89 90 @end 91 92 #endif // VHF_H_VRECTANGLE 93