Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSObjectController.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.NSObjectController; | |
15 | |
16 import dwt.internal.cocoa.NSArray; | |
17 import dwt.internal.cocoa.NSController; | |
18 import dwt.internal.cocoa.NSPredicate; | |
19 import dwt.internal.cocoa.NSString; | |
20 import dwt.internal.cocoa.OS; | |
21 import objc = dwt.internal.objc.runtime; | |
22 | |
23 public class NSObjectController : NSController | |
24 { | |
25 public this () | |
26 { | |
27 super(); | |
28 } | |
29 | |
30 public this (objc.id id) | |
31 { | |
32 super(id); | |
33 } | |
34 | |
35 public void add (id sender) | |
36 { | |
37 OS.objc_msgSend(this.id, OS.sel_add_1, sender !is null ? sender.id : null); | |
38 } | |
39 | |
40 public void addObject (id object) | |
41 { | |
42 OS.objc_msgSend(this.id, OS.sel_addObject_1, object !is null ? object.id : null); | |
43 } | |
44 | |
45 public bool automaticallyPreparesContent () | |
46 { | |
47 return OS.objc_msgSend(this.id, OS.sel_automaticallyPreparesContent) !is null; | |
48 } | |
49 | |
50 public bool canAdd () | |
51 { | |
52 return OS.objc_msgSend(this.id, OS.sel_canAdd) !is null; | |
53 } | |
54 | |
55 public bool canRemove () | |
56 { | |
57 return OS.objc_msgSend(this.id, OS.sel_canRemove) !is null; | |
58 } | |
59 | |
60 public id content () | |
61 { | |
62 objc.id result = OS.objc_msgSend(this.id, OS.sel_content); | |
63 return result !is null ? new id(result) : null; | |
64 } | |
65 | |
66 //public NSFetchRequest defaultFetchRequest() { | |
67 // objc.id result = OS.objc_msgSend(this.id, OS.sel_defaultFetchRequest); | |
68 // return result !is null ? new NSFetchRequest(result) : null; | |
69 //} | |
70 | |
71 public NSString entityName () | |
72 { | |
73 objc.id result = OS.objc_msgSend(this.id, OS.sel_entityName); | |
74 return result !is null ? new NSString(result) : null; | |
75 } | |
76 | |
77 public void fetch (id sender) | |
78 { | |
79 OS.objc_msgSend(this.id, OS.sel_fetch_1, sender !is null ? sender.id : null); | |
80 } | |
81 | |
82 public NSPredicate fetchPredicate () | |
83 { | |
84 objc.id result = OS.objc_msgSend(this.id, OS.sel_fetchPredicate); | |
85 return result !is null ? new NSPredicate(result) : null; | |
86 } | |
87 | |
88 // | |
89 //public bool fetchWithRequest(NSFetchRequest fetchRequest, bool merge, objc.id** error) { | |
90 // return OS.objc_msgSend(this.id, OS.sel_fetchWithRequest_1merge_1error_1, fetchRequest !is null ? fetchRequest.id : null, merge, error) !is null; | |
91 //} | |
92 | |
93 public NSObjectController initWithContent (id content) | |
94 { | |
95 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContent_1, content !is null ? content.id : null); | |
96 return result !is null ? this : null; | |
97 } | |
98 | |
99 public bool isEditable () | |
100 { | |
101 return OS.objc_msgSend(this.id, OS.sel_isEditable) !is null; | |
102 } | |
103 | |
104 //public NSManagedObjectContext managedObjectContext() { | |
105 // objc.id result = OS.objc_msgSend(this.id, OS.sel_managedObjectContext); | |
106 // return result !is null ? new NSManagedObjectContext(result) : null; | |
107 //} | |
108 | |
109 public id newObject () | |
110 { | |
111 objc.id result = OS.objc_msgSend(this.id, OS.sel_newObject); | |
112 return result !is null ? new id(result) : null; | |
113 } | |
114 | |
115 public objc.Class objectClass () | |
116 { | |
117 return cast(objc.Class) OS.objc_msgSend(this.id, OS.sel_objectClass); | |
118 } | |
119 | |
120 public void prepareContent () | |
121 { | |
122 OS.objc_msgSend(this.id, OS.sel_prepareContent); | |
123 } | |
124 | |
125 public void remove (id sender) | |
126 { | |
127 OS.objc_msgSend(this.id, OS.sel_remove_1, sender !is null ? sender.id : null); | |
128 } | |
129 | |
130 public void removeObject (id object) | |
131 { | |
132 OS.objc_msgSend(this.id, OS.sel_removeObject_1, object !is null ? object.id : null); | |
133 } | |
134 | |
135 public NSArray selectedObjects () | |
136 { | |
137 objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedObjects); | |
138 return result !is null ? new NSArray(result) : null; | |
139 } | |
140 | |
141 public id selection () | |
142 { | |
143 objc.id result = OS.objc_msgSend(this.id, OS.sel_selection); | |
144 return result !is null ? new id(result) : null; | |
145 } | |
146 | |
147 public void setAutomaticallyPreparesContent (bool flag) | |
148 { | |
149 OS.objc_msgSend(this.id, OS.sel_setAutomaticallyPreparesContent_1, flag); | |
150 } | |
151 | |
152 public void setContent (id content) | |
153 { | |
154 OS.objc_msgSend(this.id, OS.sel_setContent_1, content !is null ? content.id : null); | |
155 } | |
156 | |
157 public void setEditable (bool flag) | |
158 { | |
159 OS.objc_msgSend(this.id, OS.sel_setEditable_1, flag); | |
160 } | |
161 | |
162 public void setEntityName (NSString entityName) | |
163 { | |
164 OS.objc_msgSend(this.id, OS.sel_setEntityName_1, entityName !is null ? entityName.id : null); | |
165 } | |
166 | |
167 public void setFetchPredicate (NSPredicate predicate) | |
168 { | |
169 OS.objc_msgSend(this.id, OS.sel_setFetchPredicate_1, predicate !is null ? predicate.id : null); | |
170 } | |
171 | |
172 //public void setManagedObjectContext(NSManagedObjectContext managedObjectContext) { | |
173 // OS.objc_msgSend(this.id, OS.sel_setManagedObjectContext_1, managedObjectContext !is null ? managedObjectContext.id : null); | |
174 //} | |
175 | |
176 public void setObjectClass (objc.Class objectClass) | |
177 { | |
178 OS.objc_msgSend(this.id, OS.sel_setObjectClass_1, objectClass); | |
179 } | |
180 | |
181 public void setUsesLazyFetching (bool enabled) | |
182 { | |
183 OS.objc_msgSend(this.id, OS.sel_setUsesLazyFetching_1, enabled); | |
184 } | |
185 | |
186 public bool usesLazyFetching () | |
187 { | |
188 return OS.objc_msgSend(this.id, OS.sel_usesLazyFetching) !is null; | |
189 } | |
190 | |
191 public bool validateUserInterfaceItem (id item) | |
192 { | |
193 return OS.objc_msgSend(this.id, OS.sel_validateUserInterfaceItem_1, item !is null ? item.id : null) !is null; | |
194 } | |
195 | |
196 } |