comparison dstep/appkit/NSStringDrawing.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
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.NSStringDrawing;
8
9 import dstep.appkit.NSAttributedString;
10 import dstep.foundation.NSObjCRuntime;
11 import dstep.foundation.NSString;
12 import dstep.objc.bridge.Bridge;
13 import dstep.objc.objc;
14
15 typedef NSInteger NSStringDrawingOptions;
16
17 enum : NSInteger
18 {
19 NSStringDrawingTruncatesLastVisibleLine = (1 << 5),
20 NSStringDrawingUsesLineFragmentOrigin = (1 << 0),
21 NSStringDrawingUsesFontLeading = (1 << 1),
22 NSStringDrawingDisableScreenFontSubstitution = (1 << 2),
23 NSStringDrawingUsesDeviceMetrics = (1 << 3),
24 NSStringDrawingOneShot = (1 << 4)
25 }
26
27 const TNSStringDrawing = `
28
29 NSSize size ()
30 {
31 return invokeObjcSelf!(NSSize, "size");
32 }
33
34 void drawAtPoint (NSPoint point)
35 {
36 return invokeObjcSelf!(void, "drawAtPoint:", NSPoint)(point);
37 }
38
39 void drawInRect (NSRect rect)
40 {
41 return invokeObjcSelf!(void, "drawInRect:", NSRect)(rect);
42 }
43
44 //mixin ObjcBindMethod!(size, "size");
45 //mixin ObjcBindMethod!(drawAtPoint, "drawAtPoint:");
46 //mixin ObjcBindMethod!(drawInRect, "drawInRect:");
47
48 `;
49
50 const TNSExtendedStringDrawing = `
51
52 void drawWithRect (NSRect rect, int options, NSDictionary attributes)
53 {
54 return invokeObjcSelf!(void, "drawWithRect:options:attributes:", NSRect, int, NSDictionary)(rect, options, attributes);
55 }
56
57 NSRect boundingRectWithSize (NSSize size, int options, NSDictionary attributes)
58 {
59 return invokeObjcSelf!(NSRect, "boundingRectWithSize:options:attributes:", NSSize, int, NSDictionary)(size, options, attributes);
60 }
61
62 //mixin ObjcBindMethod!(drawWithRect, "drawWithRect:options:attributes:");
63 //mixin ObjcBindMethod!(boundingRectWithSize, "boundingRectWithSize:options:attributes:");
64
65 `;
66