Mercurial > projects > dstep
comparison dstep/appkit/NSCursor.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children | b9de51448c6b |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Sep 24, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.appkit.NSCursor; | |
8 | |
9 import dstep.appkit.NSColor; | |
10 import dstep.appkit.NSEvent; | |
11 import dstep.appkit.NSImage; | |
12 import dstep.foundation.NSCoder; | |
13 import dstep.foundation.NSGeometry; | |
14 import dstep.foundation.NSObject; | |
15 import dstep.objc.bridge.Bridge; | |
16 import dstep.objc.objc; | |
17 | |
18 class NSCursor : NSObject, INSCoding | |
19 { | |
20 mixin (ObjcWrap); | |
21 | |
22 this (NSCoder aDecoder) | |
23 { | |
24 super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); | |
25 } | |
26 | |
27 void encodeWithCoder (NSCoder aCoder) | |
28 { | |
29 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); | |
30 } | |
31 | |
32 typeof(this) initWithCoder (NSCoder aDecoder) | |
33 { | |
34 return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); | |
35 } | |
36 | |
37 static NSCursor currentCursor () | |
38 { | |
39 return invokeObjcSelfClass!(NSCursor, "currentCursor"); | |
40 } | |
41 | |
42 static NSCursor arrowCursor () | |
43 { | |
44 return invokeObjcSelfClass!(NSCursor, "arrowCursor"); | |
45 } | |
46 | |
47 static NSCursor IBeamCursor () | |
48 { | |
49 return invokeObjcSelfClass!(NSCursor, "IBeamCursor"); | |
50 } | |
51 | |
52 static NSCursor pointingHandCursor () | |
53 { | |
54 return invokeObjcSelfClass!(NSCursor, "pointingHandCursor"); | |
55 } | |
56 | |
57 static NSCursor closedHandCursor () | |
58 { | |
59 return invokeObjcSelfClass!(NSCursor, "closedHandCursor"); | |
60 } | |
61 | |
62 static NSCursor openHandCursor () | |
63 { | |
64 return invokeObjcSelfClass!(NSCursor, "openHandCursor"); | |
65 } | |
66 | |
67 static NSCursor resizeLeftCursor () | |
68 { | |
69 return invokeObjcSelfClass!(NSCursor, "resizeLeftCursor"); | |
70 } | |
71 | |
72 static NSCursor resizeRightCursor () | |
73 { | |
74 return invokeObjcSelfClass!(NSCursor, "resizeRightCursor"); | |
75 } | |
76 | |
77 static NSCursor resizeLeftRightCursor () | |
78 { | |
79 return invokeObjcSelfClass!(NSCursor, "resizeLeftRightCursor"); | |
80 } | |
81 | |
82 static NSCursor resizeUpCursor () | |
83 { | |
84 return invokeObjcSelfClass!(NSCursor, "resizeUpCursor"); | |
85 } | |
86 | |
87 static NSCursor resizeDownCursor () | |
88 { | |
89 return invokeObjcSelfClass!(NSCursor, "resizeDownCursor"); | |
90 } | |
91 | |
92 static NSCursor resizeUpDownCursor () | |
93 { | |
94 return invokeObjcSelfClass!(NSCursor, "resizeUpDownCursor"); | |
95 } | |
96 | |
97 static NSCursor crosshairCursor () | |
98 { | |
99 return invokeObjcSelfClass!(NSCursor, "crosshairCursor"); | |
100 } | |
101 | |
102 static NSCursor disappearingItemCursor () | |
103 { | |
104 return invokeObjcSelfClass!(NSCursor, "disappearingItemCursor"); | |
105 } | |
106 | |
107 NSCursor initWithImage (NSImage newImage, NSPoint aPoint) | |
108 { | |
109 id result = invokeObjcSelf!(id, "initWithImage:hotSpot:", NSImage, NSPoint)(newImage, aPoint); | |
110 return result is this.objcObject ? this : (result !is null ? new NSCursor(result) : null); | |
111 } | |
112 | |
113 this (NSImage newImage, NSPoint aPoint) | |
114 { | |
115 super(NSCursor.alloc.initWithImage(newImage, aPoint).objcObject); | |
116 } | |
117 | |
118 NSCursor initWithImage (NSImage newImage, NSColor fg, NSColor bg, NSPoint hotSpot) | |
119 { | |
120 id result = invokeObjcSelf!(id, "initWithImage:foregroundColorHint:backgroundColorHint:hotSpot:", NSImage, NSColor, NSColor, NSPoint)(newImage, fg, bg, hotSpot); | |
121 return result is this.objcObject ? this : (result !is null ? new NSCursor(result) : null); | |
122 } | |
123 | |
124 this (NSImage newImage, NSColor fg, NSColor bg, NSPoint hotSpot) | |
125 { | |
126 super(NSCursor.alloc.initWithImage(newImage, fg, bg, hotSpot).objcObject); | |
127 } | |
128 | |
129 static void hide () | |
130 { | |
131 return invokeObjcSelfClass!(void, "hide"); | |
132 } | |
133 | |
134 static void unhide () | |
135 { | |
136 return invokeObjcSelfClass!(void, "unhide"); | |
137 } | |
138 | |
139 static void setHiddenUntilMouseMoves (bool flag) | |
140 { | |
141 return invokeObjcSelfClass!(void, "setHiddenUntilMouseMoves:", bool)(flag); | |
142 } | |
143 | |
144 static void pop_static () | |
145 { | |
146 return invokeObjcSelfClass!(void, "pop"); | |
147 } | |
148 | |
149 NSImage image () | |
150 { | |
151 return invokeObjcSelf!(NSImage, "image"); | |
152 } | |
153 | |
154 NSPoint hotSpot () | |
155 { | |
156 return invokeObjcSelf!(NSPoint, "hotSpot"); | |
157 } | |
158 | |
159 void push () | |
160 { | |
161 return invokeObjcSelf!(void, "push"); | |
162 } | |
163 | |
164 void pop () | |
165 { | |
166 return invokeObjcSelf!(void, "pop"); | |
167 } | |
168 | |
169 void set () | |
170 { | |
171 return invokeObjcSelf!(void, "set"); | |
172 } | |
173 | |
174 void setOnMouseExited (bool flag) | |
175 { | |
176 return invokeObjcSelf!(void, "setOnMouseExited:", bool)(flag); | |
177 } | |
178 | |
179 void setOnMouseEntered (bool flag) | |
180 { | |
181 return invokeObjcSelf!(void, "setOnMouseEntered:", bool)(flag); | |
182 } | |
183 | |
184 bool isSetOnMouseExited () | |
185 { | |
186 return invokeObjcSelf!(bool, "isSetOnMouseExited"); | |
187 } | |
188 | |
189 bool isSetOnMouseEntered () | |
190 { | |
191 return invokeObjcSelf!(bool, "isSetOnMouseEntered"); | |
192 } | |
193 | |
194 void mouseEntered (NSEvent theEvent) | |
195 { | |
196 return invokeObjcSelf!(void, "mouseEntered:", NSEvent)(theEvent); | |
197 } | |
198 | |
199 void mouseExited (NSEvent theEvent) | |
200 { | |
201 return invokeObjcSelf!(void, "mouseExited:", NSEvent)(theEvent); | |
202 } | |
203 | |
204 } | |
205 |