Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSTableColumn.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.NSTableColumn; | 14 module dwt.internal.cocoa.NSTableColumn; |
15 | 15 |
16 import dwt.internal.cocoa.CGFloat; | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.cocoa.id; | 17 import dwt.internal.c.Carbon; |
18 import cocoa = dwt.internal.cocoa.id; | |
18 import dwt.internal.cocoa.NSCell; | 19 import dwt.internal.cocoa.NSCell; |
19 import dwt.internal.cocoa.NSInteger; | |
20 import dwt.internal.cocoa.NSObject; | 20 import dwt.internal.cocoa.NSObject; |
21 import dwt.internal.cocoa.NSSortDescriptor; | |
22 import dwt.internal.cocoa.NSString; | |
23 import dwt.internal.cocoa.NSTableHeaderCell; | 21 import dwt.internal.cocoa.NSTableHeaderCell; |
24 import dwt.internal.cocoa.NSTableView; | |
25 import dwt.internal.cocoa.OS; | 22 import dwt.internal.cocoa.OS; |
23 import dwt.internal.objc.cocoa.Cocoa; | |
26 import objc = dwt.internal.objc.runtime; | 24 import objc = dwt.internal.objc.runtime; |
27 | 25 |
28 public class NSTableColumn : NSObject | 26 public class NSTableColumn : NSObject { |
29 { | |
30 | 27 |
31 public this () | 28 public this() { |
32 { | 29 super(); |
33 super(); | 30 } |
34 } | |
35 | 31 |
36 public this (objc.id id) | 32 public this(objc.id id) { |
37 { | 33 super(id); |
38 super(id); | 34 } |
39 } | |
40 | 35 |
41 public id dataCell () | 36 public this(cocoa.id id) { |
42 { | 37 super(id); |
43 objc.id result = OS.objc_msgSend(this.id_, OS.sel_dataCell); | 38 } |
44 return result !is null ? new id(result) : null; | |
45 } | |
46 | 39 |
47 public id dataCellForRow (NSInteger row) | 40 public NSTableHeaderCell headerCell() { |
48 { | 41 objc.id result = OS.objc_msgSend(this.id, OS.sel_headerCell); |
49 objc.id result = OS.objc_msgSend(this.id_, OS.sel_dataCellForRow_1, row); | 42 return result !is null ? new NSTableHeaderCell(result) : null; |
50 return result !is null ? new id(result) : null; | 43 } |
51 } | |
52 | 44 |
53 public NSTableHeaderCell headerCell () | 45 public cocoa.id initWithIdentifier(cocoa.id identifier) { |
54 { | 46 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIdentifier_, identifier !is null ? identifier.id : null); |
55 objc.id result = OS.objc_msgSend(this.id_, OS.sel_headerCell); | 47 return result !is null ? new cocoa.id(result) : null; |
56 return result !is null ? new NSTableHeaderCell(result) : null; | 48 } |
57 } | |
58 | 49 |
59 public NSString headerToolTip () | 50 public NSUInteger resizingMask() { |
60 { | 51 return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_resizingMask); |
61 objc.id result = OS.objc_msgSend(this.id_, OS.sel_headerToolTip); | 52 } |
62 return result !is null ? new NSString(result) : null; | |
63 } | |
64 | 53 |
65 public id identifier () | 54 public void setDataCell(NSCell cell) { |
66 { | 55 OS.objc_msgSend(this.id, OS.sel_setDataCell_, cell !is null ? cell.id : null); |
67 objc.id result = OS.objc_msgSend(this.id_, OS.sel_identifier); | 56 } |
68 return result !is null ? new id(result) : null; | |
69 } | |
70 | 57 |
71 public NSTableColumn initWithIdentifier (id identifier) | 58 public void setEditable(bool flag) { |
72 { | 59 OS.objc_msgSend(this.id, OS.sel_setEditable_, flag); |
73 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithIdentifier_1, identifier !is null ? identifier.id_ : null); | 60 } |
74 return result !is null ? this : null; | |
75 } | |
76 | 61 |
77 public bool isEditable () | 62 public void setHeaderCell(NSCell cell) { |
78 { | 63 OS.objc_msgSend(this.id, OS.sel_setHeaderCell_, cell !is null ? cell.id : null); |
79 return OS.objc_msgSend(this.id_, OS.sel_isEditable) !is null; | 64 } |
80 } | |
81 | 65 |
82 public bool isHidden () | 66 public void setIdentifier(cocoa.id identifier) { |
83 { | 67 OS.objc_msgSend(this.id, OS.sel_setIdentifier_, identifier !is null ? identifier.id : null); |
84 return OS.objc_msgSend(this.id_, OS.sel_isHidden) !is null; | 68 } |
85 } | |
86 | 69 |
87 public bool isResizable () | 70 public void setMinWidth(CGFloat minWidth) { |
88 { | 71 OS.objc_msgSend(this.id, OS.sel_setMinWidth_, minWidth); |
89 return OS.objc_msgSend(this.id_, OS.sel_isResizable) !is null; | 72 } |
90 } | |
91 | 73 |
92 public CGFloat maxWidth () | 74 public void setResizingMask(NSUInteger resizingMask) { |
93 { | 75 OS.objc_msgSend(this.id, OS.sel_setResizingMask_, resizingMask); |
94 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_maxWidth); | 76 } |
95 } | |
96 | 77 |
97 public CGFloat minWidth () | 78 public void setWidth(CGFloat width) { |
98 { | 79 OS.objc_msgSend(this.id, OS.sel_setWidth_, width); |
99 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_minWidth); | 80 } |
100 } | |
101 | 81 |
102 public NSUInteger resizingMask () | 82 public CGFloat width() { |
103 { | 83 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_width); |
104 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_resizingMask); | 84 } |
105 } | |
106 | |
107 public void setDataCell (NSCell cell) | |
108 { | |
109 OS.objc_msgSend(this.id_, OS.sel_setDataCell_1, cell !is null ? cell.id_ : null); | |
110 } | |
111 | |
112 public void setEditable (bool flag) | |
113 { | |
114 OS.objc_msgSend(this.id_, OS.sel_setEditable_1, flag); | |
115 } | |
116 | |
117 public void setHeaderCell (NSCell cell) | |
118 { | |
119 OS.objc_msgSend(this.id_, OS.sel_setHeaderCell_1, cell !is null ? cell.id_ : null); | |
120 } | |
121 | |
122 public void setHeaderToolTip (NSString string) | |
123 { | |
124 OS.objc_msgSend(this.id_, OS.sel_setHeaderToolTip_1, string !is null ? string.id_ : null); | |
125 } | |
126 | |
127 public void setHidden (bool hidden) | |
128 { | |
129 OS.objc_msgSend(this.id_, OS.sel_setHidden_1, hidden); | |
130 } | |
131 | |
132 public void setIdentifier (id identifier) | |
133 { | |
134 OS.objc_msgSend(this.id_, OS.sel_setIdentifier_1, identifier !is null ? identifier.id_ : null); | |
135 } | |
136 | |
137 public void setMaxWidth (CGFloat maxWidth) | |
138 { | |
139 OS.objc_msgSend(this.id_, OS.sel_setMaxWidth_1, maxWidth); | |
140 } | |
141 | |
142 public void setMinWidth (CGFloat minWidth) | |
143 { | |
144 OS.objc_msgSend(this.id_, OS.sel_setMinWidth_1, minWidth); | |
145 } | |
146 | |
147 public void setResizable (bool flag) | |
148 { | |
149 OS.objc_msgSend(this.id_, OS.sel_setResizable_1, flag); | |
150 } | |
151 | |
152 public void setResizingMask (NSUInteger resizingMask) | |
153 { | |
154 OS.objc_msgSend(this.id_, OS.sel_setResizingMask_1, resizingMask); | |
155 } | |
156 | |
157 public void setSortDescriptorPrototype (NSSortDescriptor sortDescriptor) | |
158 { | |
159 OS.objc_msgSend(this.id_, OS.sel_setSortDescriptorPrototype_1, sortDescriptor !is null ? sortDescriptor.id_ : null); | |
160 } | |
161 | |
162 public void setTableView (NSTableView tableView) | |
163 { | |
164 OS.objc_msgSend(this.id_, OS.sel_setTableView_1, tableView !is null ? tableView.id_ : null); | |
165 } | |
166 | |
167 public void setWidth (CGFloat width) | |
168 { | |
169 OS.objc_msgSend(this.id_, OS.sel_setWidth_1, width); | |
170 } | |
171 | |
172 public void sizeToFit () | |
173 { | |
174 OS.objc_msgSend(this.id_, OS.sel_sizeToFit); | |
175 } | |
176 | |
177 public NSSortDescriptor sortDescriptorPrototype () | |
178 { | |
179 objc.id result = OS.objc_msgSend(this.id_, OS.sel_sortDescriptorPrototype); | |
180 return result !is null ? new NSSortDescriptor(result) : null; | |
181 } | |
182 | |
183 public NSTableView tableView () | |
184 { | |
185 objc.id result = OS.objc_msgSend(this.id_, OS.sel_tableView); | |
186 return result !is null ? new NSTableView(result) : null; | |
187 } | |
188 | |
189 public CGFloat width () | |
190 { | |
191 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_width); | |
192 } | |
193 | 85 |
194 } | 86 } |