Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSAttributedString.d @ 1:8b48be5454ce
The internal cocoa classes compile now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Tue, 19 Aug 2008 17:35:17 +0200 |
parents | 380af2bdd8e5 |
children | f565d3a95c0a |
comparison
equal
deleted
inserted
replaced
0:380af2bdd8e5 | 1:8b48be5454ce |
---|---|
17 import dwt.internal.cocoa.NSDictionary; | 17 import dwt.internal.cocoa.NSDictionary; |
18 import dwt.internal.cocoa.NSInteger; | 18 import dwt.internal.cocoa.NSInteger; |
19 import dwt.internal.cocoa.NSObject; | 19 import dwt.internal.cocoa.NSObject; |
20 import dwt.internal.cocoa.NSPoint; | 20 import dwt.internal.cocoa.NSPoint; |
21 import dwt.internal.cocoa.NSRange; | 21 import dwt.internal.cocoa.NSRange; |
22 import dwt.internal.cocoa.NSRect; | |
22 import dwt.internal.cocoa.NSSize; | 23 import dwt.internal.cocoa.NSSize; |
23 import dwt.internal.cocoa.NSString; | 24 import dwt.internal.cocoa.NSString; |
24 import dwt.internal.cocoa.OS; | 25 import dwt.internal.cocoa.OS; |
25 import objc = dwt.internal.objc.runtime; | 26 import objc = dwt.internal.objc.runtime; |
26 | 27 |
27 public class NSAttributedString : NSObject | 28 public class NSAttributedString : NSObject |
28 { | 29 { |
29 public this () | 30 public this () |
30 { | 31 { |
31 this(); | 32 super(); |
32 } | 33 } |
33 | 34 |
34 public this (objc.id id) | 35 public this (objc.id id) |
35 { | 36 { |
36 this(id); | 37 super(id); |
37 } | 38 } |
38 | 39 |
39 public id attribute_atIndex_effectiveRange_ (NSString attrName, NSUInteger location, objc.id range) | 40 public id attribute_atIndex_effectiveRange_ (NSString attrName, NSUInteger location, objc.id range) |
40 { | 41 { |
41 objc.id result = OS.objc_msgSend(this.id, OS.sel_attribute_1atIndex_1effectiveRange_1, attrName !is null ? attrName.id : null, location, | 42 objc.id result = OS.objc_msgSend(this.id_, OS.sel_attribute_1atIndex_1effectiveRange_1, attrName !is null ? attrName.id_ : null, location, |
42 range); | 43 range); |
43 return result !is null ? new id(result) : null; | 44 return result !is null ? new id(result) : null; |
44 } | 45 } |
45 | 46 |
46 public id attribute_atIndex_longestEffectiveRange_inRange_ (NSString attrName, NSUInteger location, objc.id range, NSRange rangeLimit) | 47 public id attribute_atIndex_longestEffectiveRange_inRange_ (NSString attrName, NSUInteger location, objc.id range, NSRange rangeLimit) |
47 { | 48 { |
48 objc.id result = OS.objc_msgSend(this.id, OS.sel_attribute_1atIndex_1longestEffectiveRange_1inRange_1, | 49 objc.id result = OS.objc_msgSend(this.id_, OS.sel_attribute_1atIndex_1longestEffectiveRange_1inRange_1, |
49 attrName !is null ? attrName.id : null, location, range, rangeLimit); | 50 attrName !is null ? attrName.id_ : null, location, range, rangeLimit); |
50 return result !is null ? new id(result) : null; | 51 return result !is null ? new id(result) : null; |
51 } | 52 } |
52 | 53 |
53 public NSAttributedString attributedSubStringFromRange (NSRange range) | 54 public NSAttributedString attributedSubStringFromRange (NSRange range) |
54 { | 55 { |
55 objc.id result = OS.objc_msgSend(this.id, OS.sel_attributedSubStringFromRange_1, range); | 56 objc.id result = OS.objc_msgSend(this.id_, OS.sel_attributedSubStringFromRange_1, range); |
56 return result is this.id ? this : (result !is null ? new NSAttributedString(result) : null); | 57 return result is this.id_ ? this : (result !is null ? new NSAttributedString(result) : null); |
57 } | 58 } |
58 | 59 |
59 public NSDictionary attributesAtIndex_effectiveRange_ (int location, objc.id range) | 60 public NSDictionary attributesAtIndex_effectiveRange_ (int location, objc.id range) |
60 { | 61 { |
61 objc.id result = OS.objc_msgSend(this.id, OS.sel_attributesAtIndex_1effectiveRange_1, location, range); | 62 objc.id result = OS.objc_msgSend(this.id_, OS.sel_attributesAtIndex_1effectiveRange_1, location, range); |
62 return result !is null ? new NSDictionary(result) : null; | 63 return result !is null ? new NSDictionary(result) : null; |
63 } | 64 } |
64 | 65 |
65 public NSDictionary attributesAtIndex_longestEffectiveRange_inRange_ (NSUInteger location, objc.id range, NSRange rangeLimit) | 66 public NSDictionary attributesAtIndex_longestEffectiveRange_inRange_ (NSUInteger location, objc.id range, NSRange rangeLimit) |
66 { | 67 { |
67 objc.id result = OS.objc_msgSend(this.id, OS.sel_attributesAtIndex_1longestEffectiveRange_1inRange_1, location, range, rangeLimit); | 68 objc.id result = OS.objc_msgSend(this.id_, OS.sel_attributesAtIndex_1longestEffectiveRange_1inRange_1, location, range, rangeLimit); |
68 return result !is null ? new NSDictionary(result) : null; | 69 return result !is null ? new NSDictionary(result) : null; |
69 } | 70 } |
70 | 71 |
71 public NSAttributedString initWithAttributedString (NSAttributedString attrStr) | 72 public NSAttributedString initWithAttributedString (NSAttributedString attrStr) |
72 { | 73 { |
73 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithAttributedString_1, attrStr !is null ? attrStr.id : null); | 74 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithAttributedString_1, attrStr !is null ? attrStr.id_ : null); |
74 return result !is null ? this : null; | 75 return result !is null ? this : null; |
75 } | 76 } |
76 | 77 |
77 public NSAttributedString initWithString_ (NSString str) | 78 public NSAttributedString initWithString_ (NSString str) |
78 { | 79 { |
79 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1, str !is null ? str.id : null); | 80 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithString_1, str !is null ? str.id_ : null); |
80 return result !is null ? this : null; | 81 return result !is null ? this : null; |
81 } | 82 } |
82 | 83 |
83 public NSAttributedString initWithString_attributes_ (NSString str, NSDictionary attrs) | 84 public NSAttributedString initWithString_attributes_ (NSString str, NSDictionary attrs) |
84 { | 85 { |
85 objc.id | 86 objc.id |
86 result = OS.objc_msgSend(this.id, OS.sel_initWithString_1attributes_1, str !is null ? str.id : null, attrs !is null ? attrs.id : null); | 87 result = OS.objc_msgSend(this.id_, OS.sel_initWithString_1attributes_1, str !is null ? str.id_ : null, attrs !is null ? attrs.id_ : null); |
87 return result !is null ? this : null; | 88 return result !is null ? this : null; |
88 } | 89 } |
89 | 90 |
90 public bool isEqualToAttributedString (NSAttributedString other) | 91 public bool isEqualToAttributedString (NSAttributedString other) |
91 { | 92 { |
92 return OS.objc_msgSend(this.id, OS.sel_isEqualToAttributedString_1, other !is null ? other.id : null) !is null; | 93 return OS.objc_msgSend(this.id_, OS.sel_isEqualToAttributedString_1, other !is null ? other.id_ : null) !is null; |
93 } | 94 } |
94 | 95 |
95 public NSUInteger length () | 96 public NSUInteger length () |
96 { | 97 { |
97 return OS.objc_msgSend(this.id, OS.sel_length); | 98 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_length); |
98 } | 99 } |
99 | 100 |
100 public NSString String () | 101 public NSString String () |
101 { | 102 { |
102 objc.id result = OS.objc_msgSend(this.id, OS.sel_String); | 103 objc.id result = OS.objc_msgSend(this.id_, OS.sel_string); |
103 return result !is null ? new NSString(result) : null; | 104 return result !is null ? new NSString(result) : null; |
104 } | 105 } |
105 | 106 |
106 public NSSize size () | 107 public NSSize size () |
107 { | 108 { |
108 NSSize result; | 109 NSSize result; |
109 OS.objc_msgSend_struct(result, this.id, OS.sel_size); | 110 OS.objc_msgSend_struct(&result, this.id_, OS.sel_size); |
110 return result; | 111 return result; |
111 } | 112 } |
112 | 113 |
113 public void drawAtPoint (NSPoint pt) | 114 public void drawAtPoint (NSPoint pt) |
114 { | 115 { |
115 OS.objc_msgSend(id, OS.sel_drawAtPoint_, pt); | 116 OS.objc_msgSend(id_, OS.sel_drawAtPoint_, pt); |
116 } | 117 } |
117 | 118 |
118 public void drawInRect (NSRect rect) | 119 public void drawInRect (NSRect rect) |
119 { | 120 { |
120 OS.objc_msgSend(id, OS.sel_drawInRect_1, rect); | 121 OS.objc_msgSend(id_, OS.sel_drawInRect_1, rect); |
121 } | 122 } |
122 | 123 |
123 public void drawInRect (NSRect rect, objc.id options) | 124 public void drawInRect (NSRect rect, objc.id options) |
124 { | 125 { |
125 OS.objc_msgSend(id, OS.sel_drawInRect_1, rect, options); | 126 OS.objc_msgSend(id_, OS.sel_drawInRect_1, rect, options); |
126 } | 127 } |
127 | 128 |
128 public NSUInteger nextWordFromIndex (NSUInteger index, bool forward) | 129 public NSUInteger nextWordFromIndex (NSUInteger index, bool forward) |
129 { | 130 { |
130 return OS.objc_msgSend(id, OS.sel_nextWordFromIndex_1forward_1, index, forward); | 131 return cast(NSUInteger) OS.objc_msgSend(id_, OS.sel_nextWordFromIndex_1forward_1, index, forward); |
131 } | 132 } |
132 | 133 |
133 public NSRange doubleClickAtIndex (NSUInteger index) | 134 public NSRange doubleClickAtIndex (NSUInteger index) |
134 { | 135 { |
135 NSRange result; | 136 NSRange result; |
136 OS.objc_msgSend_struct(result, id, OS.sel_doubleClickAtIndex_1, index); | 137 OS.objc_msgSend_struct(&result, id_, OS.sel_doubleClickAtIndex_1, index); |
137 return result; | 138 return result; |
138 } | 139 } |
139 } | 140 } |