Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSIndexPath.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.NSIndexPath; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSComparisonResult; | |
18 import dwt.internal.cocoa.NSInteger; | |
19 import dwt.internal.cocoa.NSObject; | |
20 import dwt.internal.cocoa.OS; | |
21 import objc = dwt.internal.objc.runtime; | |
22 | |
23 public class NSIndexPath : NSObject | |
24 { | |
25 | |
26 public this () | |
27 { | |
28 super(); | |
29 } | |
30 | |
31 public this (objc.id id) | |
32 { | |
33 super(id); | |
34 } | |
35 | |
36 public NSComparisonResult compare (NSIndexPath otherObject) | |
37 { | |
38 return OS.objc_msgSend(this.id, OS.sel_compare_1, otherObject !is null ? otherObject.id : null); | |
39 } | |
40 | |
41 public void getIndexes (NSUInteger* indexes) | |
42 { | |
43 OS.objc_msgSend(this.id, OS.sel_getIndexes_1, indexes); | |
44 } | |
45 | |
46 public NSUInteger indexAtPosition (NSUInteger position) | |
47 { | |
48 return OS.objc_msgSend(this.id, OS.sel_indexAtPosition_1, position); | |
49 } | |
50 | |
51 public NSIndexPath indexPathByAddingIndex (NSUInteger index) | |
52 { | |
53 objc.id result = OS.objc_msgSend(this.id, OS.sel_indexPathByAddingIndex_1, index); | |
54 return result is this.id ? this : (result !is null ? new NSIndexPath(result) : null); | |
55 } | |
56 | |
57 public NSIndexPath indexPathByRemovingLastIndex () | |
58 { | |
59 objc.id result = OS.objc_msgSend(this.id, OS.sel_indexPathByRemovingLastIndex); | |
60 return result is this.id ? this : (result !is null ? new NSIndexPath(result) : null); | |
61 } | |
62 | |
63 public static id indexPathWithIndex (NSUInteger index) | |
64 { | |
65 objc.id result = OS.objc_msgSend(OS.class_NSIndexPath, OS.sel_indexPathWithIndex_1, index); | |
66 return result !is null ? new id(result) : null; | |
67 } | |
68 | |
69 public static id indexPathWithIndexes (NSUInteger* indexes, NSUInteger length) | |
70 { | |
71 objc.id result = OS.objc_msgSend(OS.class_NSIndexPath, OS.sel_indexPathWithIndexes_1length_1, indexes, length); | |
72 return result !is null ? new id(result) : null; | |
73 } | |
74 | |
75 public id initWithIndex (NSUInteger index) | |
76 { | |
77 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIndex_1, index); | |
78 return result !is null ? new id(result) : null; | |
79 } | |
80 | |
81 public id initWithIndexes (NSUInteger* indexes, NSUInteger length) | |
82 { | |
83 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIndexes_1length_1, indexes, length); | |
84 return result !is null ? new id(result) : null; | |
85 } | |
86 | |
87 public NSUInteger length () | |
88 { | |
89 return OS.objc_msgSend(this.id, OS.sel_length); | |
90 } | |
91 | |
92 } |