Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSPasteboard.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSPasteboard; | |
15 | |
16 import dwt.internal.cocoa.NSArray; | |
17 import dwt.internal.cocoa.NSData; | |
18 import dwt.internal.cocoa.NSFileWrapper; | |
19 import dwt.internal.cocoa.NSInteger; | |
20 import dwt.internal.cocoa.NSObject; | |
21 import dwt.internal.cocoa.NSString; | |
22 import dwt.internal.cocoa.OS; | |
23 import objc = dwt.internal.objc.runtime; | |
24 | |
25 public class NSPasteboard : NSObject | |
26 { | |
27 | |
28 public this () | |
29 { | |
30 super(); | |
31 } | |
32 | |
33 public this (objc.id id) | |
34 { | |
35 super(id); | |
36 } | |
37 | |
38 public NSInteger addTypes (NSArray newTypes, id newOwner) | |
39 { | |
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 } | |
42 | |
43 public NSString availableTypeFromArray (NSArray types) | |
44 { | |
45 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 } | |
48 | |
49 public NSInteger changeCount () | |
50 { | |
51 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_changeCount); | |
52 } | |
53 | |
54 public NSData dataForType (NSString dataType) | |
55 { | |
56 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 } | |
59 | |
60 public NSInteger declareTypes (NSArray newTypes, id newOwner) | |
61 { | |
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 } | |
64 | |
65 public static NSPasteboard generalPasteboard () | |
66 { | |
67 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_generalPasteboard); | |
68 return result !is null ? new NSPasteboard(result) : null; | |
69 } | |
70 | |
71 public NSString name () | |
72 { | |
73 objc.id result = OS.objc_msgSend(this.id, OS.sel_name); | |
74 return result !is null ? new NSString(result) : null; | |
75 } | |
76 | |
77 public static NSPasteboard pasteboardByFilteringData (NSData data, NSString type) | |
78 { | |
79 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 return result !is null ? new NSPasteboard(result) : null; | |
82 } | |
83 | |
84 public static NSPasteboard pasteboardByFilteringFile (NSString filename) | |
85 { | |
86 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 } | |
89 | |
90 public static NSPasteboard pasteboardByFilteringTypesInPasteboard (NSPasteboard pboard) | |
91 { | |
92 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 } | |
95 | |
96 public static NSPasteboard pasteboardWithName (NSString name) | |
97 { | |
98 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 } | |
101 | |
102 public static NSPasteboard pasteboardWithUniqueName () | |
103 { | |
104 objc.id result = OS.objc_msgSend(OS.class_NSPasteboard, OS.sel_pasteboardWithUniqueName); | |
105 return result !is null ? new NSPasteboard(result) : null; | |
106 } | |
107 | |
108 public id propertyListForType (NSString dataType) | |
109 { | |
110 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 } | |
113 | |
114 public NSString readFileContentsType (NSString type, NSString filename) | |
115 { | |
116 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 return result !is null ? new NSString(result) : null; | |
119 } | |
120 | |
121 public NSFileWrapper readFileWrapper () | |
122 { | |
123 objc.id result = OS.objc_msgSend(this.id, OS.sel_readFileWrapper); | |
124 return result !is null ? new NSFileWrapper(result) : null; | |
125 } | |
126 | |
127 public void releaseGlobally () | |
128 { | |
129 OS.objc_msgSend(this.id, OS.sel_releaseGlobally); | |
130 } | |
131 | |
132 public bool setData (NSData data, NSString dataType) | |
133 { | |
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 } | |
136 | |
137 public bool setPropertyList (id plist, NSString dataType) | |
138 { | |
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 } | |
141 | |
142 public bool setString (NSString string, NSString dataType) | |
143 { | |
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 } | |
146 | |
147 public NSString stringForType (NSString dataType) | |
148 { | |
149 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 } | |
152 | |
153 public NSArray types () | |
154 { | |
155 objc.id result = OS.objc_msgSend(this.id, OS.sel_types); | |
156 return result !is null ? new NSArray(result) : null; | |
157 } | |
158 | |
159 public static NSArray typesFilterableTo (NSString type) | |
160 { | |
161 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 } | |
164 | |
165 public bool writeFileContents (NSString filename) | |
166 { | |
167 return OS.objc_msgSend(this.id, OS.sel_writeFileContents_1, filename !is null ? filename.id : null) !is null; | |
168 } | |
169 | |
170 public bool writeFileWrapper (NSFileWrapper wrapper) | |
171 { | |
172 return OS.objc_msgSend(this.id, OS.sel_writeFileWrapper_1, wrapper !is null ? wrapper.id : null) !is null; | |
173 } | |
174 | |
175 } |