-
Notifications
You must be signed in to change notification settings - Fork 3
/
ESCursors.h
115 lines (78 loc) · 3.91 KB
/
ESCursors.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
ESCursors.h
Copyright 2008-2017 Sven-S. Porst, earthlingsoft: https://earthlingsoft.net/ssp/
Some rights reserved: https://opensource.org/licenses/mit
Available at: https://github.com/ssp/ESCursors
v1 (2008-07-27) Initial release.
********************************************************************
ESCursors provides a wide variety of arrow cursors.
In particular it provides rotated versions of cursors which NSCursor
does not provide.
Try out our Symmetries application, available at
http://earthlingsoft.net/Symmetries to see those cursors in action.
For each cursor type there is a class method providing the cursor
which calls a helper method that creates the Bézier path for the
shape, draws it at the right size in black with a white border,
rotated and scaled to the desired size and returns it as an NSCursor.
*/
#import <Cocoa/Cocoa.h>
@interface ESCursors : NSObject {
}
#pragma mark CURVED CURSORS
/*
CURVED CURSORS
A cross shaped cursor whose horizontal stroke is slightly curved to the bottom.
The options specify which of the arrows should exist, not all of them should be NO.
The arrow heads in these cursors overlap which gives the right look at small size but looks bad at huge sizes.
The third variant with an 'underlay' lets you pass an image that is drawn beneath the cursor image.
*/
+ (NSBezierPath *) curvedCursorBezierPathWithRightArrow:(BOOL) rightArrow
upArrow:(BOOL) upArrow
leftArrow:(BOOL) leftArrow
downArrow:(BOOL) downArrow
forAngle:(CGFloat) angle;
+ (NSCursor *) curvedCursorWithRightArrow:(BOOL) rightArrow
upArrow:(BOOL) upArrow
leftArrow:(BOOL) leftArrow
downArrow:(BOOL) downArrow
forAngle:(CGFloat) angle
size:(CGFloat) size;
+ (NSCursor *) curvedCursorWithRightArrow:(BOOL) rightArrow
upArrow:(BOOL) upArrow
leftArrow:(BOOL) leftArrow
downArrow:(BOOL) downArrow
forAngle:(CGFloat) angle
size:(CGFloat) size
underlay:(NSImage*) underlay;
#pragma mark STRAIGHT CURSORS
/*
STRAIGHT CURSORS
cross shaped
threePronged (oriented like an upside-down T)
right angle shaped (oriented like an L)
straight line shaped (horizontal)
semi-straight line shaped (horizontal, shorter and with a bar at the left end)
*/
+ (NSBezierPath *) crossCursorBezierPathForAngle: (CGFloat) angle;
+ (NSCursor *) crossCursorForAngle: (CGFloat) angle withSize: (CGFloat) size;
+ (NSBezierPath *) threeProngedCursorBezierPathForAngle: (CGFloat) angle;
+ (NSCursor *) threeProngedCursorForAngle: (CGFloat) angle withSize: (CGFloat) size;
+ (NSBezierPath *) angleCursorBezierPathForAngle: (CGFloat) angle;
+ (NSCursor *) angleCursorForAngle: (CGFloat) angle withSize: (CGFloat) size;
+ (NSBezierPath *) straightCursorBezierPathForAngle: (CGFloat) angle;
+ (NSCursor *) straightCursorForAngle: (CGFloat) angle withSize: (CGFloat) size;
+ (NSBezierPath *) halfStraightCursorBezierPathForAngle: (CGFloat) angle;
+ (NSCursor *) halfStraightCursorForAngle: (CGFloat) angle withSize: (CGFloat) size;
#pragma mark HELPER METHODS
/*
HELPER METHODS
to do the actual drawing.
*/
+ (NSCursor *) cursorForBezierPath:(NSBezierPath *) path
withRotation:(CGFloat) angle
andSize:(CGFloat) size;
+ (NSCursor *) cursorForBezierPath:(NSBezierPath *) path
withRotation:(CGFloat) angle
size:(CGFloat) size
andUnderlay:(NSImage *) underlay;
@end