Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSPasteboard.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 |
---|---|
11 * Port to the D Programming language: | 11 * Port to the D Programming language: |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <jacob.carlborg@gmail.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.cocoa.NSPasteboard; | 14 module dwt.internal.cocoa.NSPasteboard; |
15 | 15 |
16 import dwt.internal.cocoa.id; | |
16 import dwt.internal.cocoa.NSArray; | 17 import dwt.internal.cocoa.NSArray; |
17 import dwt.internal.cocoa.NSData; | 18 import dwt.internal.cocoa.NSData; |
18 import dwt.internal.cocoa.NSFileWrapper; | 19 import dwt.internal.cocoa.NSFileWrapper; |
19 import dwt.internal.cocoa.NSInteger; | 20 import dwt.internal.cocoa.NSInteger; |
20 import dwt.internal.cocoa.NSObject; | 21 import dwt.internal.cocoa.NSObject; |
35 super(id); | 36 super(id); |
36 } | 37 } |
37 | 38 |
38 public NSInteger addTypes (NSArray newTypes, id newOwner) | 39 public NSInteger addTypes (NSArray newTypes, id newOwner) |
39 { | 40 { |
40 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_addTypes_1owner_1, newTypes !is null ? newTypes.id : null, newOwner !is null ? newOwner.id : null); | 41 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_addTypes_1owner_1, newTypes !is null ? newTypes.id_ : null, newOwner !is null ? newOwner.id_ : null); |
41 } | 42 } |
42 | 43 |
43 public NSString availableTypeFromArray (NSArray types) | 44 public NSString availableTypeFromArray (NSArray types) |
44 { | 45 { |
45 objc.id result = OS.objc_msgSend(this.id, OS.sel_availableTypeFromArray_1, types !is null ? types.id : null); | 46 objc.id result = OS.objc_msgSend(this.id_, OS.sel_availableTypeFromArray_1, types !is null ? types.id_ : null); |
46 return result !is null ? new NSString(result) : null; | 47 return result !is null ? new NSString(result) : null; |
47 } | 48 } |
48 | 49 |
49 public NSInteger changeCount () | 50 public NSInteger changeCount () |
50 { | 51 { |
51 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_changeCount); | 52 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_changeCount); |
52 } | 53 } |
53 | 54 |
54 public NSData dataForType (NSString dataType) | 55 public NSData dataForType (NSString dataType) |
55 { | 56 { |
56 objc.id result = OS.objc_msgSend(this.id, OS.sel_dataForType_1, dataType !is null ? dataType.id : null); | 57 objc.id result = OS.objc_msgSend(this.id_, OS.sel_dataForType_1, dataType !is null ? dataType.id_ : null); |
57 return result !is null ? new NSData(result) : null; | 58 return result !is null ? new NSData(result) : null; |
58 } | 59 } |
59 | 60 |
60 public NSInteger declareTypes (NSArray newTypes, id newOwner) | 61 public NSInteger declareTypes (NSArray newTypes, id newOwner) |
61 { | 62 { |
62 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_declareTypes_1owner_1, newTypes !is null ? newTypes.id : null, newOwner !is null ? newOwner.id : null); | 63 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_declareTypes_1owner_1, newTypes !is null ? newTypes.id_ : null, newOwner !is null ? newOwner.id_ : null); |
63 } | 64 } |
64 | 65 |
65 public static NSPasteboard generalPasteboard () | 66 public static NSPasteboard generalPasteboard () |
66 { | 67 { |
67 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_generalPasteboard); | 68 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_generalPasteboard); |
68 return result !is null ? new NSPasteboard(result) : null; | 69 return result !is null ? new NSPasteboard(result) : null; |
69 } | 70 } |
70 | 71 |
71 public NSString name () | 72 public NSString name () |
72 { | 73 { |
73 objc.id result = OS.objc_msgSend(this.id, OS.sel_name); | 74 objc.id result = OS.objc_msgSend(this.id_, OS.sel_name); |
74 return result !is null ? new NSString(result) : null; | 75 return result !is null ? new NSString(result) : null; |
75 } | 76 } |
76 | 77 |
77 public static NSPasteboard pasteboardByFilteringData (NSData data, NSString type) | 78 public static NSPasteboard pasteboardByFilteringData (NSData data, NSString type) |
78 { | 79 { |
79 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardByFilteringData_1ofType_1, data !is null ? data.id : null, | 80 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardByFilteringData_1ofType_1, data !is null ? data.id_ : null, |
80 type !is null ? type.id : null); | 81 type !is null ? type.id_ : null); |
81 return result !is null ? new NSPasteboard(result) : null; | 82 return result !is null ? new NSPasteboard(result) : null; |
82 } | 83 } |
83 | 84 |
84 public static NSPasteboard pasteboardByFilteringFile (NSString filename) | 85 public static NSPasteboard pasteboardByFilteringFile (NSString filename) |
85 { | 86 { |
86 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardByFilteringFile_1, filename !is null ? filename.id : null); | 87 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardByFilteringFile_1, filename !is null ? filename.id_ : null); |
87 return result !is null ? new NSPasteboard(result) : null; | 88 return result !is null ? new NSPasteboard(result) : null; |
88 } | 89 } |
89 | 90 |
90 public static NSPasteboard pasteboardByFilteringTypesInPasteboard (NSPasteboard pboard) | 91 public static NSPasteboard pasteboardByFilteringTypesInPasteboard (NSPasteboard pboard) |
91 { | 92 { |
92 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardByFilteringTypesInPasteboard_1, pboard !is null ? pboard.id : null); | 93 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardByFilteringTypesInPasteboard_1, pboard !is null ? pboard.id_ : null); |
93 return result !is null ? new NSPasteboard(result) : null; | 94 return result !is null ? new NSPasteboard(result) : null; |
94 } | 95 } |
95 | 96 |
96 public static NSPasteboard pasteboardWithName (NSString name) | 97 public static NSPasteboard pasteboardWithName (NSString name) |
97 { | 98 { |
98 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardWithName_1, name !is null ? name.id : null); | 99 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardWithName_1, name !is null ? name.id_ : null); |
99 return result !is null ? new NSPasteboard(result) : null; | 100 return result !is null ? new NSPasteboard(result) : null; |
100 } | 101 } |
101 | 102 |
102 public static NSPasteboard pasteboardWithUniqueName () | 103 public static NSPasteboard pasteboardWithUniqueName () |
103 { | 104 { |
105 return result !is null ? new NSPasteboard(result) : null; | 106 return result !is null ? new NSPasteboard(result) : null; |
106 } | 107 } |
107 | 108 |
108 public id propertyListForType (NSString dataType) | 109 public id propertyListForType (NSString dataType) |
109 { | 110 { |
110 objc.id result = OS.objc_msgSend(this.id, OS.sel_propertyListForType_1, dataType !is null ? dataType.id : null); | 111 objc.id result = OS.objc_msgSend(this.id_, OS.sel_propertyListForType_1, dataType !is null ? dataType.id_ : null); |
111 return result !is null ? new id(result) : null; | 112 return result !is null ? new id(result) : null; |
112 } | 113 } |
113 | 114 |
114 public NSString readFileContentsType (NSString type, NSString filename) | 115 public NSString readFileContentsType (NSString type, NSString filename) |
115 { | 116 { |
116 objc.id result = OS.objc_msgSend(this.id, OS.sel_readFileContentsType_1toFile_1, type !is null ? type.id : null, | 117 objc.id result = OS.objc_msgSend(this.id_, OS.sel_readFileContentsType_1toFile_1, type !is null ? type.id_ : null, |
117 filename !is null ? filename.id : null); | 118 filename !is null ? filename.id_ : null); |
118 return result !is null ? new NSString(result) : null; | 119 return result !is null ? new NSString(result) : null; |
119 } | 120 } |
120 | 121 |
121 public NSFileWrapper readFileWrapper () | 122 public NSFileWrapper readFileWrapper () |
122 { | 123 { |
123 objc.id result = OS.objc_msgSend(this.id, OS.sel_readFileWrapper); | 124 objc.id result = OS.objc_msgSend(this.id_, OS.sel_readFileWrapper); |
124 return result !is null ? new NSFileWrapper(result) : null; | 125 return result !is null ? new NSFileWrapper(result) : null; |
125 } | 126 } |
126 | 127 |
127 public void releaseGlobally () | 128 public void releaseGlobally () |
128 { | 129 { |
129 OS.objc_msgSend(this.id, OS.sel_releaseGlobally); | 130 OS.objc_msgSend(this.id_, OS.sel_releaseGlobally); |
130 } | 131 } |
131 | 132 |
132 public bool setData (NSData data, NSString dataType) | 133 public bool setData (NSData data, NSString dataType) |
133 { | 134 { |
134 return OS.objc_msgSend(this.id, OS.sel_setData_1forType_1, data !is null ? data.id : null, dataType !is null ? dataType.id : null) !is null; | 135 return OS.objc_msgSend(this.id_, OS.sel_setData_1forType_1, data !is null ? data.id_ : null, dataType !is null ? dataType.id_ : null) !is null; |
135 } | 136 } |
136 | 137 |
137 public bool setPropertyList (id plist, NSString dataType) | 138 public bool setPropertyList (id plist, NSString dataType) |
138 { | 139 { |
139 return OS.objc_msgSend(this.id, OS.sel_setPropertyList_1forType_1, plist !is null ? plist.id : null, dataType !is null ? dataType.id : null) !is null; | 140 return OS.objc_msgSend(this.id_, OS.sel_setPropertyList_1forType_1, plist !is null ? plist.id_ : null, dataType !is null ? dataType.id_ : null) !is null; |
140 } | 141 } |
141 | 142 |
142 public bool setString (NSString string, NSString dataType) | 143 public bool setString (NSString string, NSString dataType) |
143 { | 144 { |
144 return OS.objc_msgSend(this.id, OS.sel_setString_1forType_1, string !is null ? string.id : null, dataType !is null ? dataType.id : null) !is null; | 145 return OS.objc_msgSend(this.id_, OS.sel_setString_1forType_1, string !is null ? string.id_ : null, dataType !is null ? dataType.id_ : null) !is null; |
145 } | 146 } |
146 | 147 |
147 public NSString stringForType (NSString dataType) | 148 public NSString stringForType (NSString dataType) |
148 { | 149 { |
149 objc.id result = OS.objc_msgSend(this.id, OS.sel_stringForType_1, dataType !is null ? dataType.id : null); | 150 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringForType_1, dataType !is null ? dataType.id_ : null); |
150 return result !is null ? new NSString(result) : null; | 151 return result !is null ? new NSString(result) : null; |
151 } | 152 } |
152 | 153 |
153 public NSArray types () | 154 public NSArray types () |
154 { | 155 { |
155 objc.id result = OS.objc_msgSend(this.id, OS.sel_types); | 156 objc.id result = OS.objc_msgSend(this.id_, OS.sel_types); |
156 return result !is null ? new NSArray(result) : null; | 157 return result !is null ? new NSArray(result) : null; |
157 } | 158 } |
158 | 159 |
159 public static NSArray typesFilterableTo (NSString type) | 160 public static NSArray typesFilterableTo (NSString type) |
160 { | 161 { |
161 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_typesFilterableTo_1, type !is null ? type.id : null); | 162 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_typesFilterableTo_1, type !is null ? type.id_ : null); |
162 return result !is null ? new NSArray(result) : null; | 163 return result !is null ? new NSArray(result) : null; |
163 } | 164 } |
164 | 165 |
165 public bool writeFileContents (NSString filename) | 166 public bool writeFileContents (NSString filename) |
166 { | 167 { |
167 return OS.objc_msgSend(this.id, OS.sel_writeFileContents_1, filename !is null ? filename.id : null) !is null; | 168 return OS.objc_msgSend(this.id_, OS.sel_writeFileContents_1, filename !is null ? filename.id_ : null) !is null; |
168 } | 169 } |
169 | 170 |
170 public bool writeFileWrapper (NSFileWrapper wrapper) | 171 public bool writeFileWrapper (NSFileWrapper wrapper) |
171 { | 172 { |
172 return OS.objc_msgSend(this.id, OS.sel_writeFileWrapper_1, wrapper !is null ? wrapper.id : null) !is null; | 173 return OS.objc_msgSend(this.id_, OS.sel_writeFileWrapper_1, wrapper !is null ? wrapper.id_ : null) !is null; |
173 } | 174 } |
174 | 175 |
175 } | 176 } |