Mercurial > projects > dwt-mac
annotate dwt/internal/cocoa/NSTableView.d @ 156:969e7de37c3d default tip
Fixes to get dwt to work with dmd and ldc
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Wed, 08 Jul 2009 21:56:44 +0200 |
parents | 63a09873578e |
children |
rev | line source |
---|---|
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
1 /******************************************************************************* |
45 | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
3 * All rights reserved. This program and the accompanying materials |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
5 * which accompanies this distribution, and is available at |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
6 * http://www.eclipse.org/legal/epl-v10.html |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
7 * |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
8 * Contributors: |
45 | 9 * IBM Corporation - initial API and implementation |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
10 * |
13
f565d3a95c0a
Ported dwt.internal
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
1
diff
changeset
|
11 * Port to the D programming language: |
45 | 12 * Jacob Carlborg <doob@me.com> |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
13 *******************************************************************************/ |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
14 module dwt.internal.cocoa.NSTableView; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
15 |
45 | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.c.Carbon; | |
18 import cocoa = dwt.internal.cocoa.id; | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
19 import dwt.internal.cocoa.NSArray; |
45 | 20 import dwt.internal.cocoa.NSIndexSet; |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
21 import dwt.internal.cocoa.NSColor; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
22 import dwt.internal.cocoa.NSControl; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
23 import dwt.internal.cocoa.NSPoint; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
24 import dwt.internal.cocoa.NSRange; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
25 import dwt.internal.cocoa.NSRect; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
26 import dwt.internal.cocoa.NSSize; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
27 import dwt.internal.cocoa.NSTableColumn; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
28 import dwt.internal.cocoa.NSTableHeaderView; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
29 import dwt.internal.cocoa.OS; |
45 | 30 import dwt.internal.objc.cocoa.Cocoa; |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
31 import objc = dwt.internal.objc.runtime; |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
32 |
45 | 33 public class NSTableView : NSControl { |
34 | |
35 public this() { | |
36 super(); | |
37 } | |
38 | |
39 public this(objc.id id) { | |
40 super(id); | |
41 } | |
42 | |
43 public this(cocoa.id id) { | |
44 super(id); | |
45 } | |
46 | |
47 public void addTableColumn(NSTableColumn column) { | |
48 OS.objc_msgSend(this.id, OS.sel_addTableColumn_, column !is null ? column.id : null); | |
49 } | |
50 | |
51 public NSTableViewColumnAutoresizingStyle columnAutoresizingStyle() { | |
52 return cast(NSTableViewColumnAutoresizingStyle) OS.objc_msgSend(this.id, OS.sel_columnAutoresizingStyle); | |
53 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
54 |
45 | 55 public NSIndexSet columnIndexesInRect(NSRect rect) { |
56 objc.id result = OS.objc_msgSend(this.id, OS.sel_columnIndexesInRect_, rect); | |
57 return result !is null ? new NSIndexSet(result) : null; | |
58 } | |
59 | |
60 public NSInteger columnWithIdentifier(cocoa.id identifier) { | |
61 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_columnWithIdentifier_, identifier !is null ? identifier.id : null); | |
62 } | |
63 | |
64 public void deselectAll(cocoa.id sender) { | |
65 OS.objc_msgSend(this.id, OS.sel_deselectAll_, sender !is null ? sender.id : null); | |
66 } | |
67 | |
68 public void deselectRow(NSInteger row) { | |
69 OS.objc_msgSend(this.id, OS.sel_deselectRow_, row); | |
70 } | |
71 | |
72 public NSRect frameOfCellAtColumn(NSInteger column, NSInteger row) { | |
73 NSRect result = NSRect(); | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
74 OS.objc_msgSend_stret(&result, this.id, OS.sel_frameOfCellAtColumn_row_, column, row); |
45 | 75 return result; |
76 } | |
77 | |
78 public NSTableHeaderView headerView() { | |
79 objc.id result = OS.objc_msgSend(this.id, OS.sel_headerView); | |
80 return result !is null ? new NSTableHeaderView(result) : null; | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
81 } |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
82 |
45 | 83 public void highlightSelectionInClipRect(NSRect clipRect) { |
84 OS.objc_msgSend(this.id, OS.sel_highlightSelectionInClipRect_, clipRect); | |
85 } | |
86 | |
87 public NSSize intercellSpacing() { | |
88 NSSize result = NSSize(); | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
89 OS.objc_msgSend_stret(&result, this.id, OS.sel_intercellSpacing); |
45 | 90 return result; |
91 } | |
92 | |
93 public bool isRowSelected(NSInteger row) { | |
94 return OS.objc_msgSend_bool(this.id, OS.sel_isRowSelected_, row); | |
95 } | |
96 | |
97 public void moveColumn(NSInteger column, NSInteger newIndex) { | |
98 OS.objc_msgSend(this.id, OS.sel_moveColumn_toColumn_, column, newIndex); | |
99 } | |
100 | |
101 public void noteNumberOfRowsChanged() { | |
102 OS.objc_msgSend(this.id, OS.sel_noteNumberOfRowsChanged); | |
103 } | |
104 | |
105 public NSInteger numberOfColumns() { | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
106 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfColumns); |
45 | 107 } |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
108 |
45 | 109 public NSInteger numberOfRows() { |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
110 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfRows); |
45 | 111 } |
112 | |
113 public NSInteger numberOfSelectedRows() { | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
114 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfSelectedRows); |
45 | 115 } |
116 | |
117 public NSRect rectOfColumn(NSInteger column) { | |
118 NSRect result = NSRect(); | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
119 OS.objc_msgSend_stret(&result, this.id, OS.sel_rectOfColumn_, column); |
45 | 120 return result; |
121 } | |
122 | |
123 public NSRect rectOfRow(NSInteger row) { | |
124 NSRect result = NSRect(); | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
125 OS.objc_msgSend_stret(&result, this.id, OS.sel_rectOfRow_, row); |
45 | 126 return result; |
127 } | |
128 | |
129 public void reloadData() { | |
130 OS.objc_msgSend(this.id, OS.sel_reloadData); | |
131 } | |
132 | |
133 public void removeTableColumn(NSTableColumn column) { | |
134 OS.objc_msgSend(this.id, OS.sel_removeTableColumn_, column !is null ? column.id : null); | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
135 } |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
136 |
45 | 137 public NSInteger rowAtPoint(NSPoint point) { |
138 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_rowAtPoint_, point); | |
139 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
140 |
45 | 141 public CGFloat rowHeight() { |
142 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_rowHeight); | |
143 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
144 |
45 | 145 public NSRange rowsInRect(NSRect rect) { |
146 NSRange result = NSRange(); | |
60
62202ce0039f
Updated and fixed many modules to 3.514
Jacob Carlborg <doob@me.com>
parents:
45
diff
changeset
|
147 OS.objc_msgSend_stret(&result, this.id, OS.sel_rowsInRect_, rect); |
45 | 148 return result; |
149 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
150 |
45 | 151 public void scrollColumnToVisible(NSInteger column) { |
152 OS.objc_msgSend(this.id, OS.sel_scrollColumnToVisible_, column); | |
153 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
154 |
45 | 155 public void scrollRowToVisible(NSInteger row) { |
156 OS.objc_msgSend(this.id, OS.sel_scrollRowToVisible_, row); | |
157 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
158 |
45 | 159 public void selectAll(cocoa.id sender) { |
160 OS.objc_msgSend(this.id, OS.sel_selectAll_, sender !is null ? sender.id : null); | |
161 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
162 |
45 | 163 public void selectRow(NSInteger row, bool extend) { |
164 OS.objc_msgSend(this.id, OS.sel_selectRow_byExtendingSelection_, row, extend); | |
165 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
166 |
45 | 167 public void selectRowIndexes(NSIndexSet indexes, bool extend) { |
168 OS.objc_msgSend(this.id, OS.sel_selectRowIndexes_byExtendingSelection_, indexes !is null ? indexes.id : null, extend); | |
169 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
170 |
45 | 171 public NSInteger selectedRow() { |
172 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_selectedRow); | |
173 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
174 |
45 | 175 public NSIndexSet selectedRowIndexes() { |
176 objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedRowIndexes); | |
177 return result !is null ? new NSIndexSet(result) : null; | |
178 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
179 |
45 | 180 public void setAllowsColumnReordering(bool flag) { |
181 OS.objc_msgSend(this.id, OS.sel_setAllowsColumnReordering_, flag); | |
182 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
183 |
45 | 184 public void setAllowsMultipleSelection(bool flag) { |
185 OS.objc_msgSend(this.id, OS.sel_setAllowsMultipleSelection_, flag); | |
186 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
187 |
45 | 188 public void setBackgroundColor(NSColor color) { |
189 OS.objc_msgSend(this.id, OS.sel_setBackgroundColor_, color !is null ? color.id : null); | |
190 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
191 |
45 | 192 public void setColumnAutoresizingStyle(NSTableViewColumnAutoresizingStyle style) { |
193 OS.objc_msgSend(this.id, OS.sel_setColumnAutoresizingStyle_, style); | |
194 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
195 |
45 | 196 public void setDataSource(cocoa.id aSource) { |
197 OS.objc_msgSend(this.id, OS.sel_setDataSource_, aSource !is null ? aSource.id : null); | |
198 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
199 |
45 | 200 public void setDelegate(cocoa.id delegate_) { |
201 OS.objc_msgSend(this.id, OS.sel_setDelegate_, delegate_ !is null ? delegate_.id : null); | |
202 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
203 |
45 | 204 public void setDoubleAction(objc.SEL aSelector) { |
205 OS.objc_msgSend(this.id, OS.sel_setDoubleAction_, aSelector); | |
206 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
207 |
45 | 208 public void setHeaderView(NSTableHeaderView headerView) { |
209 OS.objc_msgSend(this.id, OS.sel_setHeaderView_, headerView !is null ? headerView.id : null); | |
210 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
211 |
45 | 212 public void setRowHeight(CGFloat rowHeight) { |
213 OS.objc_msgSend(this.id, OS.sel_setRowHeight_, rowHeight); | |
214 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
215 |
45 | 216 public void setUsesAlternatingRowBackgroundColors(bool useAlternatingRowColors) { |
217 OS.objc_msgSend(this.id, OS.sel_setUsesAlternatingRowBackgroundColors_, useAlternatingRowColors); | |
218 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
219 |
45 | 220 public NSArray tableColumns() { |
221 objc.id result = OS.objc_msgSend(this.id, OS.sel_tableColumns); | |
222 return result !is null ? new NSArray(result) : null; | |
223 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
224 |
45 | 225 public void tile() { |
226 OS.objc_msgSend(this.id, OS.sel_tile); | |
227 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
228 |
45 | 229 public bool usesAlternatingRowBackgroundColors() { |
230 return OS.objc_msgSend_bool(this.id, OS.sel_usesAlternatingRowBackgroundColors); | |
231 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
232 |
45 | 233 public static objc.Class cellClass() { |
234 return cast(objc.Class) OS.objc_msgSend(OS.class_NSTableView, OS.sel_cellClass); | |
235 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
236 |
45 | 237 public static void setCellClass(objc.Class factoryId) { |
238 OS.objc_msgSend(OS.class_NSTableView, OS.sel_setCellClass_, factoryId); | |
239 } | |
0
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
240 |
380af2bdd8e5
Upload of whole dwt tree
Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
parents:
diff
changeset
|
241 } |