Mercurial > projects > dstep
comparison dstep/appkit/NSRulerView.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.NSRulerView; | |
8 | |
9 import dstep.appkit.NSEvent; | |
10 import dstep.appkit.NSRulerMarker; | |
11 import dstep.appkit.NSScrollView; | |
12 import dstep.appkit.NSView; | |
13 import dstep.applicationservices.coregraphics.CGBase; | |
14 import dstep.foundation.NSArray; | |
15 import dstep.foundation.NSGeometry; | |
16 import dstep.foundation.NSObjCRuntime; | |
17 import dstep.foundation.NSString; | |
18 import dstep.objc.bridge.Bridge; | |
19 import dstep.objc.objc; | |
20 | |
21 alias NSUInteger NSRulerOrientation; | |
22 | |
23 enum | |
24 { | |
25 NSHorizontalRuler, | |
26 NSVerticalRuler | |
27 } | |
28 | |
29 class NSRulerView : NSView | |
30 { | |
31 mixin (ObjcWrap); | |
32 | |
33 static void registerUnitWithName (NSString unitName, NSString abbreviation, CGFloat conversionFactor, NSArray stepUpCycle, NSArray stepDownCycle) | |
34 { | |
35 return invokeObjcSelfClass!(void, "registerUnitWithName:abbreviation:unitToPointsConversionFactor:stepUpCycle:stepDownCycle:", NSString, NSString, CGFloat, NSArray, NSArray)(unitName, abbreviation, conversionFactor, stepUpCycle, stepDownCycle); | |
36 } | |
37 | |
38 NSRulerView initWithScrollView (NSScrollView scrollView, uint orientation) | |
39 { | |
40 id result = invokeObjcSelf!(id, "initWithScrollView:orientation:", NSScrollView, uint)(scrollView, orientation); | |
41 return result is this.objcObject ? this : (result !is null ? new NSRulerView(result) : null); | |
42 } | |
43 | |
44 this (NSScrollView scrollView, uint orientation) | |
45 { | |
46 super(NSRulerView.alloc.initWithScrollView(scrollView, orientation).objcObject); | |
47 } | |
48 | |
49 void setScrollView (NSScrollView scrollView) | |
50 { | |
51 return invokeObjcSelf!(void, "setScrollView:", NSScrollView)(scrollView); | |
52 } | |
53 | |
54 NSScrollView scrollView () | |
55 { | |
56 return invokeObjcSelf!(NSScrollView, "scrollView"); | |
57 } | |
58 | |
59 void setOrientation (uint orientation) | |
60 { | |
61 return invokeObjcSelf!(void, "setOrientation:", uint)(orientation); | |
62 } | |
63 | |
64 uint orientation () | |
65 { | |
66 return invokeObjcSelf!(uint, "orientation"); | |
67 } | |
68 | |
69 CGFloat baselineLocation () | |
70 { | |
71 return invokeObjcSelf!(CGFloat, "baselineLocation"); | |
72 } | |
73 | |
74 CGFloat requiredThickness () | |
75 { | |
76 return invokeObjcSelf!(CGFloat, "requiredThickness"); | |
77 } | |
78 | |
79 void setRuleThickness (CGFloat thickness) | |
80 { | |
81 return invokeObjcSelf!(void, "setRuleThickness:", CGFloat)(thickness); | |
82 } | |
83 | |
84 CGFloat ruleThickness () | |
85 { | |
86 return invokeObjcSelf!(CGFloat, "ruleThickness"); | |
87 } | |
88 | |
89 void setReservedThicknessForMarkers (CGFloat thickness) | |
90 { | |
91 return invokeObjcSelf!(void, "setReservedThicknessForMarkers:", CGFloat)(thickness); | |
92 } | |
93 | |
94 CGFloat reservedThicknessForMarkers () | |
95 { | |
96 return invokeObjcSelf!(CGFloat, "reservedThicknessForMarkers"); | |
97 } | |
98 | |
99 void setReservedThicknessForAccessoryView (CGFloat thickness) | |
100 { | |
101 return invokeObjcSelf!(void, "setReservedThicknessForAccessoryView:", CGFloat)(thickness); | |
102 } | |
103 | |
104 CGFloat reservedThicknessForAccessoryView () | |
105 { | |
106 return invokeObjcSelf!(CGFloat, "reservedThicknessForAccessoryView"); | |
107 } | |
108 | |
109 void setMeasurementUnits (NSString unitName) | |
110 { | |
111 return invokeObjcSelf!(void, "setMeasurementUnits:", NSString)(unitName); | |
112 } | |
113 | |
114 NSString measurementUnits () | |
115 { | |
116 return invokeObjcSelf!(NSString, "measurementUnits"); | |
117 } | |
118 | |
119 void setOriginOffset (CGFloat offset) | |
120 { | |
121 return invokeObjcSelf!(void, "setOriginOffset:", CGFloat)(offset); | |
122 } | |
123 | |
124 CGFloat originOffset () | |
125 { | |
126 return invokeObjcSelf!(CGFloat, "originOffset"); | |
127 } | |
128 | |
129 void setClientView (NSView client) | |
130 { | |
131 return invokeObjcSelf!(void, "setClientView:", NSView)(client); | |
132 } | |
133 | |
134 NSView clientView () | |
135 { | |
136 return invokeObjcSelf!(NSView, "clientView"); | |
137 } | |
138 | |
139 void setMarkers (NSArray markers) | |
140 { | |
141 return invokeObjcSelf!(void, "setMarkers:", NSArray)(markers); | |
142 } | |
143 | |
144 void addMarker (NSRulerMarker marker) | |
145 { | |
146 return invokeObjcSelf!(void, "addMarker:", NSRulerMarker)(marker); | |
147 } | |
148 | |
149 void removeMarker (NSRulerMarker marker) | |
150 { | |
151 return invokeObjcSelf!(void, "removeMarker:", NSRulerMarker)(marker); | |
152 } | |
153 | |
154 NSArray markers () | |
155 { | |
156 return invokeObjcSelf!(NSArray, "markers"); | |
157 } | |
158 | |
159 bool trackMarker (NSRulerMarker marker, NSEvent event) | |
160 { | |
161 return invokeObjcSelf!(bool, "trackMarker:withMouseEvent:", NSRulerMarker, NSEvent)(marker, event); | |
162 } | |
163 | |
164 void setAccessoryView (NSView accessory) | |
165 { | |
166 return invokeObjcSelf!(void, "setAccessoryView:", NSView)(accessory); | |
167 } | |
168 | |
169 NSView accessoryView () | |
170 { | |
171 return invokeObjcSelf!(NSView, "accessoryView"); | |
172 } | |
173 | |
174 void moveRulerlineFromLocation (CGFloat oldLocation, CGFloat newLocation) | |
175 { | |
176 return invokeObjcSelf!(void, "moveRulerlineFromLocation:toLocation:", CGFloat, CGFloat)(oldLocation, newLocation); | |
177 } | |
178 | |
179 void invalidateHashMarks () | |
180 { | |
181 return invokeObjcSelf!(void, "invalidateHashMarks"); | |
182 } | |
183 | |
184 void drawHashMarksAndLabelsInRect (NSRect rect) | |
185 { | |
186 return invokeObjcSelf!(void, "drawHashMarksAndLabelsInRect:", NSRect)(rect); | |
187 } | |
188 | |
189 void drawMarkersInRect (NSRect rect) | |
190 { | |
191 return invokeObjcSelf!(void, "drawMarkersInRect:", NSRect)(rect); | |
192 } | |
193 | |
194 bool isFlipped () | |
195 { | |
196 return invokeObjcSelf!(bool, "isFlipped"); | |
197 } | |
198 } | |
199 | |
200 const TNSRulerMarkerClientViewDelegation = ` | |
201 | |
202 bool rulerView_shouldMoveMarker (NSRulerView ruler, NSRulerMarker marker) | |
203 { | |
204 return invokeObjcSelf!(bool, "rulerView:shouldMoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); | |
205 } | |
206 | |
207 CGFloat rulerView (NSRulerView ruler, NSRulerMarker marker, CGFloat location) | |
208 { | |
209 return invokeObjcSelf!(CGFloat, "rulerView:willMoveMarker:toLocation:", NSRulerView, NSRulerMarker, CGFloat)(ruler, marker, location); | |
210 } | |
211 | |
212 void rulerView (NSRulerView ruler, NSRulerMarker marker) | |
213 { | |
214 return invokeObjcSelf!(void, "rulerView:didMoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); | |
215 } | |
216 | |
217 void rulerView_shouldRemoveMarker (NSRulerView ruler, NSRulerMarker marker) | |
218 { | |
219 return invokeObjcSelf!(void, "rulerView:shouldRemoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); | |
220 } | |
221 | |
222 void rulerView_didRemoveMarker (NSRulerView ruler, NSRulerMarker marker) | |
223 { | |
224 return invokeObjcSelf!(void, "rulerView:didRemoveMarker:", NSRulerView, NSRulerMarker)(ruler, marker); | |
225 } | |
226 | |
227 bool rulerView_shouldAddMarker (NSRulerView ruler, NSRulerMarker marker) | |
228 { | |
229 return invokeObjcSelf!(bool, "rulerView:shouldAddMarker:", NSRulerView, NSRulerMarker)(ruler, marker); | |
230 } | |
231 | |
232 CGFloat rulerView_willAddMarker_atLocation (NSRulerView ruler, NSRulerMarker marker, CGFloat location) | |
233 { | |
234 return invokeObjcSelf!(CGFloat, "rulerView:willAddMarker:atLocation:", NSRulerView, NSRulerMarker, CGFloat)(ruler, marker, location); | |
235 } | |
236 | |
237 void rulerView_didAddMarker (NSRulerView ruler, NSRulerMarker marker) | |
238 { | |
239 return invokeObjcSelf!(void, "rulerView:didAddMarker:", NSRulerView, NSRulerMarker)(ruler, marker); | |
240 } | |
241 | |
242 void rulerView (NSRulerView ruler, NSEvent event) | |
243 { | |
244 return invokeObjcSelf!(void, "rulerView:handleMouseDown:", NSRulerView, NSEvent)(ruler, event); | |
245 } | |
246 | |
247 CGFloat rulerView (NSRulerView ruler, NSView newClient) | |
248 { | |
249 return invokeObjcSelf!(CGFloat, "rulerView:willSetClientView:", NSRulerView, NSView)(ruler, newClient); | |
250 } | |
251 | |
252 //mixin ObjcBindMethod!(rulerView_shouldMoveMarker, "rulerView:shouldMoveMarker:"); | |
253 //mixin ObjcBindMethod!(rulerView, CGFloat, "rulerView:willMoveMarker:toLocation:", NSRulerView, NSRulerMarker, CGFloat); | |
254 //mixin ObjcBindMethod!(rulerView, void, "rulerView:didMoveMarker:", NSRulerView, NSRulerMarker); | |
255 //mixin ObjcBindMethod!(rulerView_shouldRemoveMarker, "rulerView:shouldRemoveMarker:"); | |
256 //mixin ObjcBindMethod!(rulerView_didRemoveMarker, "rulerView:didRemoveMarker:"); | |
257 //mixin ObjcBindMethod!(rulerView_shouldAddMarker, "rulerView:shouldAddMarker:"); | |
258 //mixin ObjcBindMethod!(rulerView_willAddMarker_atLocation, "rulerView:willAddMarker:atLocation:"); | |
259 //mixin ObjcBindMethod!(rulerView_didAddMarker, "rulerView:didAddMarker:"); | |
260 //mixin ObjcBindMethod!(rulerView, void, "rulerView:handleMouseDown:", NSRulerView, NSEvent); | |
261 //mixin ObjcBindMethod!(rulerView, CGFloat, "rulerView:willSetClientView:", NSRulerView, NSView); | |
262 | |
263 `; | |
264 |