comparison dwt/internal/cocoa/NSArrayController.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.NSArrayController;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSArray;
18 import dwt.internal.cocoa.NSIndexSet;
19 import dwt.internal.cocoa.NSInteger;
20 import dwt.internal.cocoa.NSObjectController;
21 import dwt.internal.cocoa.NSPredicate;
22 import dwt.internal.cocoa.OS;
23 import objc = dwt.internal.objc.runtime;
24
25 public class NSArrayController : NSObjectController
26 {
27 public this ()
28 {
29 super();
30 }
31
32 public this (objc.id id)
33 {
34 super(id);
35 }
36
37 public void add (id sender)
38 {
39 OS.objc_msgSend(this.id, OS.sel_add_1, sender !is null ? sender.id : null);
40 }
41
42 public void addObject (id object)
43 {
44 OS.objc_msgSend(this.id, OS.sel_addObject_1,
45 object !is null ? object.id : null);
46 }
47
48 public void addObjects (NSArray objects)
49 {
50 OS.objc_msgSend(this.id, OS.sel_addObjects_1,
51 objects !is null ? objects.id : null);
52 }
53
54 public bool addSelectedObjects (NSArray objects)
55 {
56 return OS.objc_msgSend(this.id, OS.sel_addSelectedObjects_1,
57 objects !is null ? objects.id : null) !is null;
58 }
59
60 public bool addSelectionIndexes (NSIndexSet indexes)
61 {
62 return OS.objc_msgSend(this.id, OS.sel_addSelectionIndexes_1,
63 indexes !is null ? indexes.id : null) !is null;
64 }
65
66 public bool alwaysUsesMultipleValuesMarker ()
67 {
68 return OS.objc_msgSend(this.id, OS.sel_alwaysUsesMultipleValuesMarker) !is null;
69 }
70
71 public NSArray arrangeObjects (NSArray objects)
72 {
73 objc.id result = OS.objc_msgSend(this.id, OS.sel_arrangeObjects_1,
74 objects !is null ? objects.id : null);
75 return result !is null ? new NSArray(result) : null;
76 }
77
78 public id arrangedObjects ()
79 {
80 objc.id result = OS.objc_msgSend(this.id, OS.sel_arrangedObjects);
81 return result !is null ? new id(result) : null;
82 }
83
84 public NSArray automaticRearrangementKeyPaths ()
85 {
86 objc.id result = OS.objc_msgSend(this.id,
87 OS.sel_automaticRearrangementKeyPaths);
88 return result !is null ? new NSArray(result) : null;
89 }
90
91 public bool automaticallyRearrangesObjects ()
92 {
93 return OS.objc_msgSend(this.id, OS.sel_automaticallyRearrangesObjects) !is null;
94 }
95
96 public bool avoidsEmptySelection ()
97 {
98 return OS.objc_msgSend(this.id, OS.sel_avoidsEmptySelection) !is null;
99 }
100
101 public bool canInsert ()
102 {
103 return OS.objc_msgSend(this.id, OS.sel_canInsert) !is null;
104 }
105
106 public bool canSelectNext ()
107 {
108 return OS.objc_msgSend(this.id, OS.sel_canSelectNext) !is null;
109 }
110
111 public bool canSelectPrevious ()
112 {
113 return OS.objc_msgSend(this.id, OS.sel_canSelectPrevious) !is null;
114 }
115
116 public bool clearsFilterPredicateOnInsertion ()
117 {
118 return OS.objc_msgSend(this.id, OS.sel_clearsFilterPredicateOnInsertion) !is null;
119 }
120
121 public void didChangeArrangementCriteria ()
122 {
123 OS.objc_msgSend(this.id, OS.sel_didChangeArrangementCriteria);
124 }
125
126 public NSPredicate filterPredicate ()
127 {
128 objc.id result = OS.objc_msgSend(this.id, OS.sel_filterPredicate);
129 return result !is null ? new NSPredicate(result) : null;
130 }
131
132 public void insert (id sender)
133 {
134 OS.objc_msgSend(this.id, OS.sel_insert_1,
135 sender !is null ? sender.id : null);
136 }
137
138 public void insertObject (id object, NSUInteger index)
139 {
140 OS.objc_msgSend(this.id, OS.sel_insertObject_1atArrangedObjectIndex_1,
141 object !is null ? object.id : null, index);
142 }
143
144 public void insertObjects (NSArray objects, NSIndexSet indexes)
145 {
146 OS.objc_msgSend(this.id,
147 OS.sel_insertObjects_1atArrangedObjectIndexes_1,
148 objects !is null ? objects.id : null,
149 indexes !is null ? indexes.id : null);
150 }
151
152 public bool preservesSelection ()
153 {
154 return OS.objc_msgSend(this.id, OS.sel_preservesSelection) !is null;
155 }
156
157 public void rearrangeObjects ()
158 {
159 OS.objc_msgSend(this.id, OS.sel_rearrangeObjects);
160 }
161
162 public void remove (id sender)
163 {
164 OS.objc_msgSend(this.id, OS.sel_remove_1,
165 sender !is null ? sender.id : null);
166 }
167
168 public void removeObject (id object)
169 {
170 OS.objc_msgSend(this.id, OS.sel_removeObject_1,
171 object !is null ? object.id : null);
172 }
173
174 public void removeObjectAtArrangedObjectIndex (NSUInteger index)
175 {
176 OS.objc_msgSend(this.id, OS.sel_removeObjectAtArrangedObjectIndex_1,
177 index);
178 }
179
180 public void removeObjects (NSArray objects)
181 {
182 OS.objc_msgSend(this.id, OS.sel_removeObjects_1,
183 objects !is null ? objects.id : null);
184 }
185
186 public void removeObjectsAtArrangedObjectIndexes (NSIndexSet indexes)
187 {
188 OS.objc_msgSend(this.id, OS.sel_removeObjectsAtArrangedObjectIndexes_1,
189 indexes !is null ? indexes.id : null);
190 }
191
192 public bool removeSelectedObjects (NSArray objects)
193 {
194 return OS.objc_msgSend(this.id, OS.sel_removeSelectedObjects_1,
195 objects !is null ? objects.id : null) !is null;
196 }
197
198 public bool removeSelectionIndexes (NSIndexSet indexes)
199 {
200 return OS.objc_msgSend(this.id, OS.sel_removeSelectionIndexes_1,
201 indexes !is null ? indexes.id : null) !is null;
202 }
203
204 public void selectNext (id sender)
205 {
206 OS.objc_msgSend(this.id, OS.sel_selectNext_1,
207 sender !is null ? sender.id : null);
208 }
209
210 public void selectPrevious (id sender)
211 {
212 OS.objc_msgSend(this.id, OS.sel_selectPrevious_1,
213 sender !is null ? sender.id : null);
214 }
215
216 public NSArray selectedObjects ()
217 {
218 objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedObjects);
219 return result !is null ? new NSArray(result) : null;
220 }
221
222 public NSUInteger selectionIndex ()
223 {
224 return OS.objc_msgSend(this.id, OS.sel_selectionIndex);
225 }
226
227 public NSIndexSet selectionIndexes ()
228 {
229 objc.id result = OS.objc_msgSend(this.id, OS.sel_selectionIndexes);
230 return result !is null ? new NSIndexSet(result) : null;
231 }
232
233 public bool selectsInsertedObjects ()
234 {
235 return OS.objc_msgSend(this.id, OS.sel_selectsInsertedObjects) !is null;
236 }
237
238 public void setAlwaysUsesMultipleValuesMarker (bool flag)
239 {
240 OS.objc_msgSend(this.id, OS.sel_setAlwaysUsesMultipleValuesMarker_1,
241 flag);
242 }
243
244 public void setAutomaticallyRearrangesObjects (bool flag)
245 {
246 OS.objc_msgSend(this.id, OS.sel_setAutomaticallyRearrangesObjects_1,
247 flag);
248 }
249
250 public void setAvoidsEmptySelection (bool flag)
251 {
252 OS.objc_msgSend(this.id, OS.sel_setAvoidsEmptySelection_1, flag);
253 }
254
255 public void setClearsFilterPredicateOnInsertion (bool flag)
256 {
257 OS.objc_msgSend(this.id, OS.sel_setClearsFilterPredicateOnInsertion_1,
258 flag);
259 }
260
261 public void setFilterPredicate (NSPredicate filterPredicate)
262 {
263 OS.objc_msgSend(this.id, OS.sel_setFilterPredicate_1,
264 filterPredicate !is null ? filterPredicate.id : null);
265 }
266
267 public void setPreservesSelection (bool flag)
268 {
269 OS.objc_msgSend(this.id, OS.sel_setPreservesSelection_1, flag);
270 }
271
272 public bool setSelectedObjects (NSArray objects)
273 {
274 return OS.objc_msgSend(this.id, OS.sel_setSelectedObjects_1,
275 objects !is null ? objects.id : null) !is null;
276 }
277
278 public bool setSelectionIndex (NSUInteger index)
279 {
280 return OS.objc_msgSend(this.id, OS.sel_setSelectionIndex_1, index) !is null;
281 }
282
283 public bool setSelectionIndexes (NSIndexSet indexes)
284 {
285 return OS.objc_msgSend(this.id, OS.sel_setSelectionIndexes_1,
286 indexes !is null ? indexes.id : null) !is null;
287 }
288
289 public void setSelectsInsertedObjects (bool flag)
290 {
291 OS.objc_msgSend(this.id, OS.sel_setSelectsInsertedObjects_1, flag);
292 }
293
294 public void setSortDescriptors (NSArray sortDescriptors)
295 {
296 OS.objc_msgSend(this.id, OS.sel_setSortDescriptors_1,
297 sortDescriptors !is null ? sortDescriptors.id : null);
298 }
299
300 public NSArray sortDescriptors ()
301 {
302 objc.id result = OS.objc_msgSend(this.id, OS.sel_sortDescriptors);
303 return result !is null ? new NSArray(result) : null;
304 }
305
306 }