comparison dstep/appkit/NSTreeNode.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.NSTreeNode;
8
9 import dstep.foundation.NSArray;
10 import dstep.appkit.NSTreeController;
11 import dstep.foundation.NSIndexPath;
12 import dstep.foundation.NSObject;
13 import dstep.objc.bridge.Bridge;
14 import dstep.objc.objc;
15
16 class NSTreeNode : NSObject
17 {
18 mixin (ObjcWrap);
19
20 static Object treeNodeWithRepresentedObject (Object modelObject)
21 {
22 return invokeObjcSelfClass!(Object, "treeNodeWithRepresentedObject:", Object)(modelObject);
23 }
24
25 NSTreeNode initWithRepresentedObject (Object modelObject)
26 {
27 id result = invokeObjcSelf!(id, "initWithRepresentedObject:", Object)(modelObject);
28 return result is this.objcObject ? this : (result !is null ? new NSTreeNode(result) : null);
29 }
30
31 this (Object modelObject)
32 {
33 super(NSTreeNode.alloc.initWithRepresentedObject(modelObject).objcObject);
34 }
35
36 Object representedObject ()
37 {
38 return invokeObjcSelf!(Object, "representedObject");
39 }
40
41 NSIndexPath indexPath ()
42 {
43 return invokeObjcSelf!(NSIndexPath, "indexPath");
44 }
45
46 bool isLeaf ()
47 {
48 return invokeObjcSelf!(bool, "isLeaf");
49 }
50
51 NSArray childNodes ()
52 {
53 return invokeObjcSelf!(NSArray, "childNodes");
54 }
55
56 NSMutableArray mutableChildNodes ()
57 {
58 return invokeObjcSelf!(NSMutableArray, "mutableChildNodes");
59 }
60
61 NSTreeNode descendantNodeAtIndexPath (NSIndexPath indexPath)
62 {
63 id result = invokeObjcSelf!(id, "descendantNodeAtIndexPath:", NSIndexPath)(indexPath);
64 return result is this.objcObject ? this : (result !is null ? new NSTreeNode(result) : null);
65 }
66
67 NSTreeNode parentNode ()
68 {
69 id result = invokeObjcSelf!(id, "parentNode");
70 return result is this.objcObject ? this : (result !is null ? new NSTreeNode(result) : null);
71 }
72
73 void sortWithSortDescriptors (NSArray sortDescriptors, bool recursively)
74 {
75 return invokeObjcSelf!(void, "sortWithSortDescriptors:recursively:", NSArray, bool)(sortDescriptors, recursively);
76 }
77 }
78