Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 118 lines (85 sloc) 4.386 kB
a516cc8 Initial check-in.
uli authored
1 //
2 // UKPaintTool.h
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
3 // ULIPaintView
a516cc8 Initial check-in.
uli authored
4 //
5 // Created by Uli Kusterer on Fri Oct 31 2003.
6 // Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
7 //
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
8 // This software is provided 'as-is', without any express or implied
9 // warranty. In no event will the authors be held liable for any damages
10 // arising from the use of this software.
11 //
12 // Permission is granted to anyone to use this software for any purpose,
13 // including commercial applications, and to alter it and redistribute it
14 // freely, subject to the following restrictions:
15 //
16 // 1. The origin of this software must not be misrepresented; you must not
17 // claim that you wrote the original software. If you use this software
18 // in a product, an acknowledgment in the product documentation would be
19 // appreciated but is not required.
20 //
21 // 2. Altered source versions must be plainly marked as such, and must not be
22 // misrepresented as being the original software.
23 //
24 // 3. This notice may not be removed or altered from any source
25 // distribution.
26 //
27
28 /*
29 Base class for all our paint tools. ULIPaintView only knows how to do tracking
30 etc. for this one tool, and the tools then decide what to react to and what
31 to ignore.
32 */
a516cc8 Initial check-in.
uli authored
33
c331828 @uliwitness Make this compile on 10.6 and without a prefix header.
authored
34 #import <AppKit/AppKit.h>
a516cc8 Initial check-in.
uli authored
35
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
36 @class ULIPaintView;
a516cc8 Initial check-in.
uli authored
37
38
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
39 @interface ULIPaintTool : NSObject
a516cc8 Initial check-in.
uli authored
40 {
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
41 IBOutlet ULIPaintView* owner;
a516cc8 Initial check-in.
uli authored
42 IBOutlet NSButton* toolButton;
43 }
44
45
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
46 +(id) paintToolWithPaintView: (ULIPaintView*)pv;
a516cc8 Initial check-in.
uli authored
47
48
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
49 -(id) initWithPaintView: (ULIPaintView*)pv;
a516cc8 Initial check-in.
uli authored
50
51
52 -(IBAction) chooseTool: (id)sender;
53
54
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
55 -(void) setOwner: (ULIPaintView*)o;
56 -(ULIPaintView*)owner;
a516cc8 Initial check-in.
uli authored
57
58
59 -(NSButton*) toolButton;
60 -(void) setToolButton: (NSButton*)b;
61
62
63 /* Sent immediately before the first draw[Temporary]TrackingToolShapeFrom:to: message:
64 If you need 'trackingDidEnd', just do your clean-up in drawFinalToolShapeFrom:to: or
65 drawDisposableToolShapeFrom:to: */
66 -(void) trackingWillStart;
67
68 /* Override this to draw a shape during tracking:
69 The drawings you do in here will be undone before you're called again. */
70 -(void) drawTemporaryTrackingToolShapeFrom: (NSPoint*)prevPos to: (NSPoint)currPos;
71
72 /* Override this to draw a brush during tracking:
73 The drawings you do in here will end up in the actual image buffer. */
74 -(void) drawTrackingToolShapeFrom: (NSPoint*)prevPos to: (NSPoint)currPos;
75
76 /* Override this to draw a shape once tracking has finished:
77 The drawings you do here will end up in the actual image buffer. */
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
78 -(void) drawFinalToolShapeFrom: (NSPoint*)prevPos to: (NSPoint)currPos; // By default calls through to drawTemporaryTrackingToolShapeFrom:to:
a516cc8 Initial check-in.
uli authored
79
80 /* The following is the "final" method for markers:
81 This draws into the tracking buffer, and will be erased as soon as tracking starts. */
82 -(void) drawDisposableToolShapeFrom: (NSPoint*)prevPos to: (NSPoint)currPos;
83
84
85 /* If you're doing something like a Text tool, where the tool just creates an editable area,
86 Override this:
87 You'll want to draw some sort of outline in drawTemporaryTrackingToolShapeFrom:to: and
88 create the text box in drawFinalToolShapeFrom:to:, and then delete it from this method. */
89 -(void) paintToolWillUnload: (id)sender;
90 -(void) paintToolDidLoad: (id)sender;
91
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
92 /* If you're drawing a shape, this will generate a rect from the two points that can be drawn: */
a516cc8 Initial check-in.
uli authored
93 -(NSRect) rectFrom: (NSPoint)prevPos to: (NSPoint)currPos;
94
6a767a7 @uliwitness Big clean-up. Adopted new prefix. Fixed support for line and fill col…
authored
95 /* Like rectFrom:to: but then outsets the rectangle by a bit (usually the line
96 size plus a bit of slop). This is useful for getting the rect to update after
97 drawing something: */
a516cc8 Initial check-in.
uli authored
98 -(NSRect) rectWithLineSizeFrom: (NSPoint)prevPos to: (NSPoint)currPos; // Uses paint view's default line size.
99 -(NSRect) rectWithLineSize: (NSSize)lineSize from: (NSPoint)prevPos to: (NSPoint)currPos;
100
101 // Return a cursor for use when this tool is current:
102 -(NSCursor*) drawingCursor;
103 -(NSCursor*) selectionCursor; // When mouse is over selection. Defaults to drawingCursor.
104
105
106 // Return an image to use as the icon for this tool in the tool palette:
107 -(NSImage*) toolIcon; // By default loads the image named toolIconName.
108
109 // Return the name of an image to use as the icon for this tool in the tool palette.
110 -(NSString*) toolIconName;
111
112 -(BOOL) adjustCoordinates; // Do we want this tool to get coordinates offset to draw on full pixels instead of between? Defaults to YES.
113
114 -(void) restoreSavedShapeFrom: (NSPoint)startPos to: (NSPoint*)endPos;
115 -(BOOL) isSaveableTool;
116
117 @end
Something went wrong with that request. Please try again.