1 /*
2  Project: Graphos
3  GRBezierControlPoint.h
4 
5  Copyright (C) 2000-2017 GNUstep Application Project
6 
7  Author: Enrico Sersale (original GDraw implementation)
8  Author: Ing. Riccardo Mottola
9 
10  This application is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public
12  License as published by the Free Software Foundation; either
13  version 2 of the License, or (at your option) any later version.
14 
15  This application is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  Library General Public License for more details.
19 
20  You should have received a copy of the GNU General Public
21  License along with this library; if not, write to the Free
22  Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
23  */
24 
25 #import <Foundation/Foundation.h>
26 #import <AppKit/AppKit.h>
27 #import "GRObjectControlPoint.h"
28 
29 enum
30 {
31   GRPointMiddle = 0,
32   GRPointStart = 1,
33   GRPointEnd = 2
34 }; typedef NSUInteger GRPointTangentStyle;
35 
36 typedef struct
37 {
38     NSPoint firstHandle;
39     NSRect firstHandleRect;
40     NSPoint center;
41     NSRect centerRect;
42     NSPoint secondHandle;
43     NSRect secondHandleRect;
44 } GRBezierHandle;
45 
46 @class GRBezierPath;
47 
48 @interface GRBezierControlPoint : GRObjectControlPoint
49 {
50   GRBezierPath *path;
51   GRBezierHandle bzHandle;
52   BOOL symmetricalHandles;
53   GRPointTangentStyle pointPosition;
54 }
55 
56 - (id)initAtPoint:(NSPoint)aPoint
57           forPath:(GRBezierPath *)aPath
58        zoomFactor:(CGFloat)zf;
59 
60 - (void)setPath:(GRBezierPath *)thePath;
61 - (void)calculateBezierHandles:(NSPoint)draggedHandlePosition;
62 - (void)moveToPoint:(NSPoint)p;
63 - (void)moveBezierHandleToPosition:(NSPoint)newp oldPosition:(NSPoint)oldp;
64 - (void)overlapHandles;
65 - (void)extractHandles;
66 
67 - (GRBezierHandle)bzHandle;
68 - (void)setBezierHandle:(GRBezierHandle)handle;
69 - (void)drawHandle;
70 
71 - (void)select;
72 - (void)unselect;
73 - (BOOL)isSelect;
74 - (BOOL)isActiveHandle;
75 - (BOOL)symmetricalHandles;
76 - (void)setSymmetricalHandles:(BOOL)flag;
77 - (void)setPointPosition:(GRPointTangentStyle)pPos;
78 
79 @end
80 
81