comparison dstep/appkit/NSRuleEditor.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents
children b9de51448c6b
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Sep 24, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.appkit.NSRuleEditor;
8
9 import dstep.appkit.AppKitDefines;
10 import dstep.appkit.NSControl;
11 import dstep.appkit.NSView;
12 import dstep.applicationservices.coregraphics.CGBase;
13 import dstep.foundation.NSArray;
14 import dstep.foundation.NSDictionary;
15 import dstep.foundation.NSIndexSet;
16 import dstep.foundation.NSObjCRuntime;
17 import dstep.foundation.NSPredicate;
18 import dstep.foundation.NSString;
19 import dstep.foundation.NSTimer;
20 import dstep.objc.bridge.Bridge;
21 import dstep.objc.objc;
22
23 import bindings = dstep.appkit.NSRuleEditor_bindings;
24
25 alias NSUInteger NSRuleEditorNestingMode;
26 alias NSUInteger NSRuleEditorRowType;
27
28 private
29 {
30 NSString NSRuleEditorPredicateLeftExpression_;
31 NSString NSRuleEditorPredicateRightExpression_;
32 NSString NSRuleEditorPredicateComparisonModifier_;
33 NSString NSRuleEditorPredicateOptions_;
34 NSString NSRuleEditorPredicateOperatorType_;
35 NSString NSRuleEditorPredicateCustomSelector_;
36 NSString NSRuleEditorPredicateCompoundType_;
37 NSString NSRuleEditorRowsDidChangeNotification_;
38 }
39
40 NSString NSRuleEditorPredicateLeftExpression ()
41 {
42 if (NSRuleEditorPredicateLeftExpression_)
43 return NSRuleEditorPredicateLeftExpression_;
44
45 return NSRuleEditorPredicateLeftExpression_ = new NSString(bindings.NSRuleEditorPredicateLeftExpression);
46 }
47
48 NSString NSRuleEditorPredicateRightExpression ()
49 {
50 if (NSRuleEditorPredicateRightExpression_)
51 return NSRuleEditorPredicateRightExpression_;
52
53 return NSRuleEditorPredicateRightExpression_ = new NSString(bindings.NSRuleEditorPredicateRightExpression);
54 }
55
56 NSString NSRuleEditorPredicateComparisonModifier ()
57 {
58 if (NSRuleEditorPredicateComparisonModifier_)
59 return NSRuleEditorPredicateComparisonModifier_;
60
61 return NSRuleEditorPredicateComparisonModifier_ = new NSString(bindings.NSRuleEditorPredicateComparisonModifier);
62 }
63
64 NSString NSRuleEditorPredicateOptions ()
65 {
66 if (NSRuleEditorPredicateOptions_)
67 return NSRuleEditorPredicateOptions_;
68
69 return NSRuleEditorPredicateOptions_ = new NSString(bindings.NSRuleEditorPredicateOptions);
70 }
71
72 NSString NSRuleEditorPredicateOperatorType ()
73 {
74 if (NSRuleEditorPredicateOperatorType_)
75 return NSRuleEditorPredicateOperatorType_;
76
77 return NSRuleEditorPredicateOperatorType_ = new NSString(bindings.NSRuleEditorPredicateOperatorType);
78 }
79
80 NSString NSRuleEditorPredicateCustomSelector ()
81 {
82 if (NSRuleEditorPredicateCustomSelector_)
83 return NSRuleEditorPredicateCustomSelector_;
84
85 return NSRuleEditorPredicateCustomSelector_ = new NSString(bindings.NSRuleEditorPredicateCustomSelector);
86 }
87
88 NSString NSRuleEditorPredicateCompoundType ()
89 {
90 if (NSRuleEditorPredicateCompoundType_)
91 return NSRuleEditorPredicateCompoundType_;
92
93 return NSRuleEditorPredicateCompoundType_ = new NSString(bindings.NSRuleEditorPredicateCompoundType);
94 }
95
96 NSString NSRuleEditorRowsDidChangeNotification ()
97 {
98 if (NSRuleEditorRowsDidChangeNotification_)
99 return NSRuleEditorRowsDidChangeNotification_;
100
101 return NSRuleEditorRowsDidChangeNotification_ = new NSString(bindings.NSRuleEditorRowsDidChangeNotification);
102 }
103
104 enum
105 {
106 NSRuleEditorNestingModeSingle,
107 NSRuleEditorNestingModeList,
108 NSRuleEditorNestingModeCompound,
109 NSRuleEditorNestingModeSimple
110 }
111
112 enum
113 {
114 NSRuleEditorRowTypeSimple,
115 NSRuleEditorRowTypeCompound
116 }
117
118 class NSRuleEditor : NSControl
119 {
120 mixin (ObjcWrap);
121
122 void setDelegate (Object arg0)
123 {
124 return invokeObjcSelf!(void, "setDelegate:", Object)(arg0);
125 }
126
127 Object delegate_ ()
128 {
129 return invokeObjcSelf!(Object, "delegate");
130 }
131
132 void setFormattingStringsFilename (NSString stringsFilename)
133 {
134 return invokeObjcSelf!(void, "setFormattingStringsFilename:", NSString)(stringsFilename);
135 }
136
137 NSString formattingStringsFilename ()
138 {
139 return invokeObjcSelf!(NSString, "formattingStringsFilename");
140 }
141
142 void setFormattingDictionary (NSDictionary dictionary)
143 {
144 return invokeObjcSelf!(void, "setFormattingDictionary:", NSDictionary)(dictionary);
145 }
146
147 NSDictionary formattingDictionary ()
148 {
149 return invokeObjcSelf!(NSDictionary, "formattingDictionary");
150 }
151
152 void reloadCriteria ()
153 {
154 return invokeObjcSelf!(void, "reloadCriteria");
155 }
156
157 void setNestingMode (uint mode)
158 {
159 return invokeObjcSelf!(void, "setNestingMode:", uint)(mode);
160 }
161
162 uint nestingMode ()
163 {
164 return invokeObjcSelf!(uint, "nestingMode");
165 }
166
167 void setRowHeight (CGFloat height)
168 {
169 return invokeObjcSelf!(void, "setRowHeight:", CGFloat)(height);
170 }
171
172 CGFloat rowHeight ()
173 {
174 return invokeObjcSelf!(CGFloat, "rowHeight");
175 }
176
177 void setEditable (bool editable)
178 {
179 return invokeObjcSelf!(void, "setEditable:", bool)(editable);
180 }
181
182 bool isEditable ()
183 {
184 return invokeObjcSelf!(bool, "isEditable");
185 }
186
187 void setCanRemoveAllRows (bool val)
188 {
189 return invokeObjcSelf!(void, "setCanRemoveAllRows:", bool)(val);
190 }
191
192 bool canRemoveAllRows ()
193 {
194 return invokeObjcSelf!(bool, "canRemoveAllRows");
195 }
196
197 NSPredicate predicate ()
198 {
199 return invokeObjcSelf!(NSPredicate, "predicate");
200 }
201
202 void reloadPredicate ()
203 {
204 return invokeObjcSelf!(void, "reloadPredicate");
205 }
206
207 NSPredicate predicateForRow (NSInteger row)
208 {
209 return invokeObjcSelf!(NSPredicate, "predicateForRow:", NSInteger)(row);
210 }
211
212 NSInteger numberOfRows ()
213 {
214 return invokeObjcSelf!(NSInteger, "numberOfRows");
215 }
216
217 NSIndexSet subrowIndexesForRow (NSInteger rowIndex)
218 {
219 return invokeObjcSelf!(NSIndexSet, "subrowIndexesForRow:", NSInteger)(rowIndex);
220 }
221
222 NSArray criteriaForRow (NSInteger row)
223 {
224 return invokeObjcSelf!(NSArray, "criteriaForRow:", NSInteger)(row);
225 }
226
227 NSArray displayValuesForRow (NSInteger row)
228 {
229 return invokeObjcSelf!(NSArray, "displayValuesForRow:", NSInteger)(row);
230 }
231
232 NSInteger rowForDisplayValue (Object displayValue)
233 {
234 return invokeObjcSelf!(NSInteger, "rowForDisplayValue:", Object)(displayValue);
235 }
236
237 uint rowTypeForRow (NSInteger rowIndex)
238 {
239 return invokeObjcSelf!(uint, "rowTypeForRow:", NSInteger)(rowIndex);
240 }
241
242 NSInteger parentRowForRow (NSInteger rowIndex)
243 {
244 return invokeObjcSelf!(NSInteger, "parentRowForRow:", NSInteger)(rowIndex);
245 }
246
247 void addRow (Object sender)
248 {
249 return invokeObjcSelf!(void, "addRow:", Object)(sender);
250 }
251
252 void insertRowAtIndex (NSInteger rowIndex, uint rowType, NSInteger parentRow, bool shouldAnimate)
253 {
254 return invokeObjcSelf!(void, "insertRowAtIndex:withType:asSubrowOfRow:animate:", NSInteger, uint, NSInteger, bool)(rowIndex, rowType, parentRow, shouldAnimate);
255 }
256
257 void setCriteria (NSArray criteria, NSArray values, NSInteger rowIndex)
258 {
259 return invokeObjcSelf!(void, "setCriteria:andDisplayValues:forRowAtIndex:", NSArray, NSArray, NSInteger)(criteria, values, rowIndex);
260 }
261
262 void removeRowAtIndex (NSInteger rowIndex)
263 {
264 return invokeObjcSelf!(void, "removeRowAtIndex:", NSInteger)(rowIndex);
265 }
266
267 void removeRowsAtIndexes (NSIndexSet rowIndexes, bool includeSubrows)
268 {
269 return invokeObjcSelf!(void, "removeRowsAtIndexes:includeSubrows:", NSIndexSet, bool)(rowIndexes, includeSubrows);
270 }
271
272 NSIndexSet selectedRowIndexes ()
273 {
274 return invokeObjcSelf!(NSIndexSet, "selectedRowIndexes");
275 }
276
277 void selectRowIndexes (NSIndexSet indexes, bool extend)
278 {
279 return invokeObjcSelf!(void, "selectRowIndexes:byExtendingSelection:", NSIndexSet, bool)(indexes, extend);
280 }
281
282 void setRowClass (Class rowClass)
283 {
284 return invokeObjcSelf!(void, "setRowClass:", Class)(rowClass);
285 }
286
287 Class rowClass ()
288 {
289 return invokeObjcSelf!(Class, "rowClass");
290 }
291
292 void setRowTypeKeyPath (NSString keyPath)
293 {
294 return invokeObjcSelf!(void, "setRowTypeKeyPath:", NSString)(keyPath);
295 }
296
297 NSString rowTypeKeyPath ()
298 {
299 return invokeObjcSelf!(NSString, "rowTypeKeyPath");
300 }
301
302 void setSubrowsKeyPath (NSString keyPath)
303 {
304 return invokeObjcSelf!(void, "setSubrowsKeyPath:", NSString)(keyPath);
305 }
306
307 NSString subrowsKeyPath ()
308 {
309 return invokeObjcSelf!(NSString, "subrowsKeyPath");
310 }
311
312 void setCriteriaKeyPath (NSString keyPath)
313 {
314 return invokeObjcSelf!(void, "setCriteriaKeyPath:", NSString)(keyPath);
315 }
316
317 NSString criteriaKeyPath ()
318 {
319 return invokeObjcSelf!(NSString, "criteriaKeyPath");
320 }
321
322 void setDisplayValuesKeyPath (NSString keyPath)
323 {
324 return invokeObjcSelf!(void, "setDisplayValuesKeyPath:", NSString)(keyPath);
325 }
326
327 NSString displayValuesKeyPath ()
328 {
329 return invokeObjcSelf!(NSString, "displayValuesKeyPath");
330 }
331 }
332
333 const TNSRuleEditorDelegateMethods = `
334
335 NSInteger ruleEditor (NSRuleEditor editor, Object criterion, uint rowType)
336 {
337 return invokeObjcSelf!(NSInteger, "ruleEditor:numberOfChildrenForCriterion:withRowType:", NSRuleEditor, Object, uint)(editor, criterion, rowType);
338 }
339
340 Object ruleEditor (NSRuleEditor editor, NSInteger index, Object criterion, uint rowType)
341 {
342 return invokeObjcSelf!(Object, "ruleEditor:child:forCriterion:withRowType:", NSRuleEditor, NSInteger, Object, uint)(editor, index, criterion, rowType);
343 }
344
345 Object ruleEditor (NSRuleEditor editor, Object criterion, NSInteger row)
346 {
347 return invokeObjcSelf!(Object, "ruleEditor:displayValueForCriterion:inRow:", NSRuleEditor, Object, NSInteger)(editor, criterion, row);
348 }
349
350 NSDictionary ruleEditor (NSRuleEditor editor, Object criterion, Object value, NSInteger row)
351 {
352 return invokeObjcSelf!(NSDictionary, "ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow:", NSRuleEditor, Object, Object, NSInteger)(editor, criterion, value, row);
353 }
354
355 void ruleEditorRowsDidChange (NSNotification notification)
356 {
357 return invokeObjcSelf!(void, "ruleEditorRowsDidChange:", NSNotification)(notification);
358 }
359
360 //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:numberOfChildrenForCriterion:withRowType:");
361 //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:child:forCriterion:withRowType:");
362 //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:displayValueForCriterion:inRow:");
363 //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow:");
364 //mixin ObjcBindMethod!(ruleEditorRowsDidChange, "ruleEditorRowsDidChange:");
365
366 `;
367