Mercurial > projects > dwt-mac
comparison dwt/widgets/Canvas.d @ 37:642f460a0908
Fixed a lot of compile errors, a "hello world" app compiles now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Fri, 10 Oct 2008 12:29:48 +0200 |
parents | 9414ecde7ba7 |
children | d8635bb48c7c |
comparison
equal
deleted
inserted
replaced
36:db5a898b2119 | 37:642f460a0908 |
---|---|
27 import dwt.internal.cocoa.NSRect; | 27 import dwt.internal.cocoa.NSRect; |
28 import dwt.internal.cocoa.NSSize; | 28 import dwt.internal.cocoa.NSSize; |
29 import dwt.internal.cocoa.OS; | 29 import dwt.internal.cocoa.OS; |
30 | 30 |
31 import dwt.dwthelper.utils; | 31 import dwt.dwthelper.utils; |
32 import dwt.internal.cocoa.NSImage; | |
32 import dwt.widgets.Caret; | 33 import dwt.widgets.Caret; |
33 import dwt.widgets.Composite; | 34 import dwt.widgets.Composite; |
34 import dwt.widgets.Control; | 35 import dwt.widgets.Control; |
35 import dwt.widgets.IME; | 36 import dwt.widgets.IME; |
36 | 37 |
134 } else { | 135 } else { |
135 gc.fillRectangle (x, y, width, height); | 136 gc.fillRectangle (x, y, width, height); |
136 } | 137 } |
137 } | 138 } |
138 | 139 |
139 void drawRect(int id, NSRect rect) { | 140 void drawRect(objc.id id, NSRect rect) { |
140 super.drawRect(id, rect); | 141 super.drawRect(id, rect); |
141 if (caret is null) return; | 142 if (caret is null) return; |
142 if (caret.isShowing) { | 143 if (caret.isShowing) { |
143 NSGraphicsContext context = NSGraphicsContext.currentContext(); | 144 NSGraphicsContext context = NSGraphicsContext.currentContext(); |
144 | 145 |
149 fromRect.width = size.width; | 150 fromRect.width = size.width; |
150 fromRect.height = size.height; | 151 fromRect.height = size.height; |
151 NSPoint point = NSPoint(); | 152 NSPoint point = NSPoint(); |
152 point.x = caret.x; | 153 point.x = caret.x; |
153 point.y = caret.y; | 154 point.y = caret.y; |
154 image.handle.drawAtPoint(point, rect, OS.NSCompositeXOR, 1); | 155 image.handle.drawAtPoint(point, rect, NSCompositeXOR, 1); |
155 } else { | 156 } else { |
156 context.saveGraphicsState(); | 157 context.saveGraphicsState(); |
157 context.setCompositingOperation(OS.NSCompositeXOR); | 158 context.setCompositingOperation(NSCompositeXOR); |
158 NSRect drawRect = NSRect(); | 159 NSRect drawRect = NSRect(); |
159 drawRect.x = caret.x; | 160 drawRect.x = caret.x; |
160 drawRect.y = caret.y; | 161 drawRect.y = caret.y; |
161 drawRect.width = caret.width !is 0 ? caret.width : Caret.DEFAULT_WIDTH; | 162 drawRect.width = caret.width !is 0 ? caret.width : Caret.DEFAULT_WIDTH; |
162 drawRect.height = caret.height; | 163 drawRect.height = caret.height; |