mirror of https://github.com/adamdruppe/arsd.git
(very slightly) better mac support
This commit is contained in:
parent
2ea2b13591
commit
c266c59b1f
|
@ -12574,17 +12574,19 @@ version(OSXCocoa) {
|
||||||
mixin template NativeScreenPainterImplementation() {
|
mixin template NativeScreenPainterImplementation() {
|
||||||
CGContextRef context;
|
CGContextRef context;
|
||||||
ubyte[4] _outlineComponents;
|
ubyte[4] _outlineComponents;
|
||||||
|
id view;
|
||||||
|
|
||||||
void create(NativeWindowHandle window) {
|
void create(NativeWindowHandle window) {
|
||||||
context = window.drawingContext;
|
context = window.drawingContext;
|
||||||
|
view = window.view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
setNeedsDisplay(view, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NotYetImplementedException
|
// NotYetImplementedException
|
||||||
Size textSize(in char[] txt) { return Size(32, 16); throw new NotYetImplementedException(); }
|
Size textSize(in char[] txt) { return Size(32, 16); throw new NotYetImplementedException(); }
|
||||||
void pen(Pen p) {}
|
|
||||||
void rasterOp(RasterOp op) {}
|
void rasterOp(RasterOp op) {}
|
||||||
Pen _activePen;
|
Pen _activePen;
|
||||||
Color _fillColor;
|
Color _fillColor;
|
||||||
|
@ -12595,7 +12597,9 @@ version(OSXCocoa) {
|
||||||
|
|
||||||
// end
|
// end
|
||||||
|
|
||||||
@property void outlineColor(Color color) {
|
void pen(Pen pen) {
|
||||||
|
_activePen = pen;
|
||||||
|
auto color = pen.color; // FIXME
|
||||||
double alphaComponent = color.a/255.0f;
|
double alphaComponent = color.a/255.0f;
|
||||||
CGContextSetRGBStrokeColor(context,
|
CGContextSetRGBStrokeColor(context,
|
||||||
color.r/255.0f, color.g/255.0f, color.b/255.0f, alphaComponent);
|
color.r/255.0f, color.g/255.0f, color.b/255.0f, alphaComponent);
|
||||||
|
@ -12647,7 +12651,7 @@ version(OSXCocoa) {
|
||||||
_outlineComponents[1]*invAlpha,
|
_outlineComponents[1]*invAlpha,
|
||||||
_outlineComponents[2]*invAlpha,
|
_outlineComponents[2]*invAlpha,
|
||||||
_outlineComponents[3]/255.0f);
|
_outlineComponents[3]/255.0f);
|
||||||
CGContextShowTextAtPoint(context, x, y, text.ptr, text.length);
|
CGContextShowTextAtPoint(context, x, y + 12 /* this is cuz this picks baseline but i want bounding box */, text.ptr, text.length);
|
||||||
// auto cfstr = cast(id)createCFString(text);
|
// auto cfstr = cast(id)createCFString(text);
|
||||||
// objc_msgSend(cfstr, sel_registerName("drawAtPoint:withAttributes:"),
|
// objc_msgSend(cfstr, sel_registerName("drawAtPoint:withAttributes:"),
|
||||||
// NSPoint(x, y), null);
|
// NSPoint(x, y), null);
|
||||||
|
@ -12814,9 +12818,13 @@ version(OSXCocoa) {
|
||||||
// will like it. Let's leave it to the native handler.
|
// will like it. Let's leave it to the native handler.
|
||||||
|
|
||||||
// perform the default action.
|
// perform the default action.
|
||||||
auto superData = objc_super(self, superclass(self));
|
|
||||||
alias extern(C) void function(objc_super*, SEL, id) T;
|
// so the default action is to make a bomp sound and i dont want that
|
||||||
(cast(T)&objc_msgSendSuper)(&superData, _cmd, event);
|
// sooooooooo yeah not gonna do that.
|
||||||
|
|
||||||
|
//auto superData = objc_super(self, superclass(self));
|
||||||
|
//alias extern(C) void function(objc_super*, SEL, id) T;
|
||||||
|
//(cast(T)&objc_msgSendSuper)(&superData, _cmd, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue