-
Notifications
You must be signed in to change notification settings - Fork 4
/
SelectMarker.h
65 lines (52 loc) · 1.65 KB
/
SelectMarker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// SelectMarker.h
// selectInPic
//
// Created by Fredrik Wallner on 2006-08-01.
// Copyright 2006 Fredrik Wallner. All rights reserved.
//
#import <Cocoa/Cocoa.h>
typedef enum _SelectionTrackingMode
{
trackNone,
trackSelecting,
trackMoving,
trackResizing // Not implemented! (Currently left as an exercise for the reader, but I may fill this in someday.)
} SelectionTrackingMode;
@interface SelectMarker : NSObject
{
NSView *target;
BOOL selecting, dragging, resizing;
NSRect selectedRect;
NSPoint lastLocation;
NSColor *fillColor, *strokeColor;
SelectionTrackingMode trackingMode;
NSBezierPath *selectedPath;
}
// Convenience constructor. Use this in most cases.
+ selectMarkerForView:aView;
// Designated Intiailizer
- initWithView:(NSView *) aView;
- (void) drawSelectMarker;
// The mouse-tracking methods
- (void) startSelectingAtPoint:(NSPoint) where;
- (void) continueSelectingAtPoint: (NSPoint) where;
- (void) stopSelectingAtPoint:(NSPoint) where;
- (void) startMovingAtPoint:(NSPoint) where;
- (void) continueMovingAtPoint: (NSPoint) where;
- (void) stopMovingAtPoint:(NSPoint) where;
- (void) mouseDown:(NSEvent *) theEvent;
- (void) mouseUp:(NSEvent *) theEvent;
- (void) mouseDragged:(NSEvent *) theEvent;
// Simple Accessors
- (void) setColor:(NSColor *) color;
- (void) setFillColor:(NSColor *) color;
- (void) setStrokeColor:(NSColor *) color;
- (NSBezierPath *) selectedPath;
- (NSRect) selectedRect;
- (void) setSelectedRect:(NSRect) rect;
- (void) setSelectedRectOrigin:(NSPoint) where;
- (void) setSelectedRectSize:(NSSize) size;
- (void) moveSelectedRectBy:(NSSize) delta;
@end
NSRect rectFromPoints(NSPoint p1, NSPoint p2);