comparison dwt/internal/cocoa/NSTreeNode.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.NSTreeNode;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSArray;
18 import dwt.internal.cocoa.NSIndexPath;
19 import dwt.internal.cocoa.NSMutableArray;
20 import dwt.internal.cocoa.NSObject;
21 import dwt.internal.cocoa.OS;
22 import objc = dwt.internal.objc.runtime;
23
24 public class NSTreeNode : NSObject
25 {
26
27 public this ()
28 {
29 super();
30 }
31
32 public this (objc.id id)
33 {
34 super(id);
35 }
36
37 public NSArray childNodes ()
38 {
39 objc.id result = OS.objc_msgSend(this.id, OS.sel_childNodes);
40 return result !is null ? new NSArray(result) : null;
41 }
42
43 public NSTreeNode descendantNodeAtIndexPath (NSIndexPath indexPath)
44 {
45 objc.id result = OS.objc_msgSend(this.id, OS.sel_descendantNodeAtIndexPath_1, indexPath !is null ? indexPath.id : null);
46 return result is this.id ? this : (result !is null ? new NSTreeNode(result) : null);
47 }
48
49 public NSIndexPath indexPath ()
50 {
51 objc.id result = OS.objc_msgSend(this.id, OS.sel_indexPath);
52 return result !is null ? new NSIndexPath(result) : null;
53 }
54
55 public id initWithRepresentedObject (id modelObject)
56 {
57 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithRepresentedObject_1, modelObject !is null ? modelObject.id : null);
58 return result !is null ? new id(result) : null;
59 }
60
61 public bool isLeaf ()
62 {
63 return OS.objc_msgSend(this.id, OS.sel_isLeaf) !is null;
64 }
65
66 public NSMutableArray mutableChildNodes ()
67 {
68 objc.id result = OS.objc_msgSend(this.id, OS.sel_mutableChildNodes);
69 return result !is null ? new NSMutableArray(result) : null;
70 }
71
72 public NSTreeNode parentNode ()
73 {
74 objc.id result = OS.objc_msgSend(this.id, OS.sel_parentNode);
75 return result is this.id ? this : (result !is null ? new NSTreeNode(result) : null);
76 }
77
78 public id representedObject ()
79 {
80 objc.id result = OS.objc_msgSend(this.id, OS.sel_representedObject);
81 return result !is null ? new id(result) : null;
82 }
83
84 public void sortWithSortDescriptors (NSArray sortDescriptors, bool recursively)
85 {
86 OS.objc_msgSend(this.id, OS.sel_sortWithSortDescriptors_1recursively_1, sortDescriptors !is null ? sortDescriptors.id : null, recursively);
87 }
88
89 public static id treeNodeWithRepresentedObject (id modelObject)
90 {
91 objc.id result = OS.objc_msgSend(OS.class_NSTreeNode, OS.sel_treeNodeWithRepresentedObject_1, modelObject !is null ? modelObject.id : null);
92 return result !is null ? new id(result) : null;
93 }
94
95 }