Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSIndexSet.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | 10 * |
11 * Port to the D programming language: | 11 * Port to the D programming language: |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <doob@me.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.cocoa.NSIndexSet; | 14 module dwt.internal.cocoa.NSIndexSet; |
15 | 15 |
16 import dwt.internal.cocoa.id; | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.cocoa.NSInteger; | 17 import cocoa = dwt.internal.cocoa.id; |
18 import dwt.internal.cocoa.NSObject; | 18 import dwt.internal.cocoa.NSObject; |
19 import dwt.internal.cocoa.NSRange; | 19 import dwt.internal.cocoa.NSRange; |
20 import dwt.internal.cocoa.OS; | 20 import dwt.internal.cocoa.OS; |
21 import dwt.internal.objc.cocoa.Cocoa; | |
21 import objc = dwt.internal.objc.runtime; | 22 import objc = dwt.internal.objc.runtime; |
22 | 23 |
23 public class NSIndexSet : NSObject | 24 public class NSIndexSet : NSObject { |
24 { | |
25 | 25 |
26 public this () | 26 public this() { |
27 { | 27 super(); |
28 super(); | 28 } |
29 } | |
30 | 29 |
31 public this (objc.id id) | 30 public this(objc.id id) { |
32 { | 31 super(id); |
33 super(id); | 32 } |
34 } | |
35 | 33 |
36 public bool containsIndex (NSUInteger value) | 34 public this(cocoa.id id) { |
37 { | 35 super(id); |
38 return OS.objc_msgSend(this.id_, OS.sel_containsIndex_1, value) !is null; | 36 } |
39 } | |
40 | 37 |
41 public bool containsIndexes (NSIndexSet indexSet) | 38 public NSUInteger count() { |
42 { | 39 return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_count); |
43 return OS.objc_msgSend(this.id_, OS.sel_containsIndexes_1, indexSet !is null ? indexSet.id_ : null) !is null; | 40 } |
44 } | |
45 | 41 |
46 public bool containsIndexesInRange (NSRange range) | 42 public NSUInteger firstIndex() { |
47 { | 43 return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_firstIndex); |
48 return OS.objc_msgSend(this.id_, OS.sel_containsIndexesInRange_1, range) !is null; | 44 } |
49 } | |
50 | 45 |
51 public NSUInteger count () | 46 public NSUInteger getIndexes(NSUInteger* indexBuffer, NSUInteger bufferSize, NSRangePointer range) { |
52 { | 47 return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_getIndexes_maxCount_inIndexRange_, indexBuffer, bufferSize, range); |
53 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_count); | 48 } |
54 } | |
55 | 49 |
56 public NSUInteger countOfIndexesInRange (NSRange range) | 50 public cocoa.id initWithIndex(NSUInteger value) { |
57 { | 51 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIndex_, value); |
58 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_countOfIndexesInRange_1, range); | 52 return result !is null ? new cocoa.id(result) : null; |
59 } | 53 } |
60 | 54 |
61 public NSUInteger firstIndex () | 55 public cocoa.id initWithIndexesInRange(NSRange range) { |
62 { | 56 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIndexesInRange_, range); |
63 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_firstIndex); | 57 return result !is null ? new cocoa.id(result) : null; |
64 } | 58 } |
65 | |
66 public NSUInteger getIndexes (NSUInteger* indexBuffer, NSUInteger bufferSize, NSRangePointer range) | |
67 { | |
68 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_getIndexes_1maxCount_1inIndexRange_1, indexBuffer, bufferSize, range); | |
69 } | |
70 | |
71 public NSUInteger indexGreaterThanIndex (NSUInteger value) | |
72 { | |
73 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_indexGreaterThanIndex_1, value); | |
74 } | |
75 | |
76 public NSUInteger indexGreaterThanOrEqualToIndex (NSUInteger value) | |
77 { | |
78 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_indexGreaterThanOrEqualToIndex_1, value); | |
79 } | |
80 | |
81 public NSUInteger indexLessThanIndex (NSUInteger value) | |
82 { | |
83 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_indexLessThanIndex_1, value); | |
84 } | |
85 | |
86 public NSUInteger indexLessThanOrEqualToIndex (NSUInteger value) | |
87 { | |
88 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_indexLessThanOrEqualToIndex_1, value); | |
89 } | |
90 | |
91 public static id indexSet () | |
92 { | |
93 objc.id result = OS.objc_msgSend(OS.class_NSIndexSet, OS.sel_indexSet); | |
94 return result !is null ? new id(result) : null; | |
95 } | |
96 | |
97 public static id indexSetWithIndex (NSUInteger value) | |
98 { | |
99 objc.id result = OS.objc_msgSend(OS.class_NSIndexSet, OS.sel_indexSetWithIndex_1, value); | |
100 return result !is null ? new id(result) : null; | |
101 } | |
102 | |
103 public static id indexSetWithIndexesInRange (NSRange range) | |
104 { | |
105 objc.id result = OS.objc_msgSend(OS.class_NSIndexSet, OS.sel_indexSetWithIndexesInRange_1, range); | |
106 return result !is null ? new id(result) : null; | |
107 } | |
108 | |
109 public id initWithIndex (NSUInteger value) | |
110 { | |
111 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithIndex_1, value); | |
112 return result !is null ? new id(result) : null; | |
113 } | |
114 | |
115 public id initWithIndexSet (NSIndexSet indexSet) | |
116 { | |
117 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithIndexSet_1, indexSet !is null ? indexSet.id_ : null); | |
118 return result !is null ? new id(result) : null; | |
119 } | |
120 | |
121 public id initWithIndexesInRange (NSRange range) | |
122 { | |
123 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithIndexesInRange_1, range); | |
124 return result !is null ? new id(result) : null; | |
125 } | |
126 | |
127 public bool intersectsIndexesInRange (NSRange range) | |
128 { | |
129 return OS.objc_msgSend(this.id_, OS.sel_intersectsIndexesInRange_1, range) !is null; | |
130 } | |
131 | |
132 public bool isEqualToIndexSet (NSIndexSet indexSet) | |
133 { | |
134 return OS.objc_msgSend(this.id_, OS.sel_isEqualToIndexSet_1, indexSet !is null ? indexSet.id_ : null) !is null; | |
135 } | |
136 | |
137 public NSUInteger lastIndex () | |
138 { | |
139 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_lastIndex); | |
140 } | |
141 | 59 |
142 } | 60 } |