Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSTabView.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 | 62202ce0039f |
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.NSTabView; | 14 module dwt.internal.cocoa.NSTabView; |
15 | 15 |
16 import dwt.internal.cocoa.id; | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.cocoa.NSArray; | 17 import cocoa = dwt.internal.cocoa.id; |
18 import dwt.internal.cocoa.NSCell : NSControlSize, NSControlTint; | |
19 import dwt.internal.cocoa.NSFont; | 18 import dwt.internal.cocoa.NSFont; |
20 import dwt.internal.cocoa.NSInteger; | |
21 import dwt.internal.cocoa.NSPoint; | 19 import dwt.internal.cocoa.NSPoint; |
22 import dwt.internal.cocoa.NSRect; | 20 import dwt.internal.cocoa.NSRect; |
23 import dwt.internal.cocoa.NSSize; | 21 import dwt.internal.cocoa.NSSize; |
24 import dwt.internal.cocoa.NSTabViewItem; | 22 import dwt.internal.cocoa.NSTabViewItem; |
25 import dwt.internal.cocoa.NSView; | 23 import dwt.internal.cocoa.NSView; |
26 import dwt.internal.cocoa.OS; | 24 import dwt.internal.cocoa.OS; |
25 import dwt.internal.objc.cocoa.Cocoa; | |
27 import objc = dwt.internal.objc.runtime; | 26 import objc = dwt.internal.objc.runtime; |
28 | 27 |
29 enum NSTabViewType : NSUInteger | 28 enum NSTabViewType |
30 { | 29 { |
31 NSTopTabsBezelBorder = 0, | 30 NSTopTabsBezelBorder = 0, |
32 NSLeftTabsBezelBorder = 1, | 31 NSLeftTabsBezelBorder = 1, |
33 NSBottomTabsBezelBorder = 2, | 32 NSBottomTabsBezelBorder = 2, |
34 NSRightTabsBezelBorder = 3, | 33 NSRightTabsBezelBorder = 3, |
35 NSNoTabsBezelBorder = 4, | 34 NSNoTabsBezelBorder = 4, |
36 NSNoTabsLineBorder = 5, | 35 NSNoTabsLineBorder = 5, |
37 NSNoTabsNoBorder = 6 | 36 NSNoTabsNoBorder = 6 |
38 } | 37 } |
39 | 38 |
40 alias NSTabViewType.NSTopTabsBezelBorder NSTopTabsBezelBorder; | 39 public class NSTabView : NSView { |
41 alias NSTabViewType.NSLeftTabsBezelBorder NSLeftTabsBezelBorder; | |
42 alias NSTabViewType.NSBottomTabsBezelBorder NSBottomTabsBezelBorder; | |
43 alias NSTabViewType.NSRightTabsBezelBorder NSRightTabsBezelBorder; | |
44 alias NSTabViewType.NSNoTabsBezelBorder NSNoTabsBezelBorder; | |
45 alias NSTabViewType.NSNoTabsLineBorder NSNoTabsLineBorder; | |
46 alias NSTabViewType.NSNoTabsNoBorder NSNoTabsNoBorder; | |
47 | 40 |
48 public class NSTabView : NSView | 41 public this() { |
49 { | 42 super(); |
43 } | |
50 | 44 |
51 public this () | 45 public this(objc.id id) { |
52 { | 46 super(id); |
53 super(); | 47 } |
54 } | |
55 | 48 |
56 public this (objc.id id) | 49 public this(cocoa.id id) { |
57 { | 50 super(id); |
58 super(id); | 51 } |
59 } | |
60 | 52 |
61 public void addTabViewItem (NSTabViewItem tabViewItem) | 53 public void addTabViewItem(NSTabViewItem tabViewItem) { |
62 { | 54 OS.objc_msgSend(this.id, OS.sel_addTabViewItem_, tabViewItem !is null ? tabViewItem.id : null); |
63 OS.objc_msgSend(this.id_, OS.sel_addTabViewItem_1, tabViewItem !is null ? tabViewItem.id_ : null); | 55 } |
64 } | |
65 | 56 |
66 public bool allowsTruncatedLabels () | 57 public NSRect contentRect() { |
67 { | 58 NSRect result = NSRect(); |
68 return OS.objc_msgSend(this.id_, OS.sel_allowsTruncatedLabels) !is null; | 59 OS.objc_msgSend_stret(result, this.id, OS.sel_contentRect); |
69 } | 60 return result; |
61 } | |
70 | 62 |
71 public NSRect contentRect () | 63 public void insertTabViewItem(NSTabViewItem tabViewItem, NSInteger index) { |
72 { | 64 OS.objc_msgSend(this.id, OS.sel_insertTabViewItem_atIndex_, tabViewItem !is null ? tabViewItem.id : null, index); |
73 NSRect result; | 65 } |
74 OS.objc_msgSend_stret(&result, this.id_, OS.sel_contentRect); | |
75 return result; | |
76 } | |
77 | 66 |
78 public NSControlSize controlSize () | 67 public NSSize minimumSize() { |
79 { | 68 NSSize result = NSSize(); |
80 return cast(NSControlSize) OS.objc_msgSend(this.id_, OS.sel_controlSize); | 69 OS.objc_msgSend_stret(result, this.id, OS.sel_minimumSize); |
81 } | 70 return result; |
71 } | |
82 | 72 |
83 public NSControlTint controlTint () | 73 public void removeTabViewItem(NSTabViewItem tabViewItem) { |
84 { | 74 OS.objc_msgSend(this.id, OS.sel_removeTabViewItem_, tabViewItem !is null ? tabViewItem.id : null); |
85 return cast(NSControlTint) OS.objc_msgSend(this.id_, OS.sel_controlTint); | 75 } |
86 } | |
87 | 76 |
88 public id delegatee () | 77 public void selectTabViewItemAtIndex(NSInteger index) { |
89 { | 78 OS.objc_msgSend(this.id, OS.sel_selectTabViewItemAtIndex_, index); |
90 objc.id result = OS.objc_msgSend(this.id_, OS.sel_delegate); | 79 } |
91 return result !is null ? new id(result) : null; | |
92 } | |
93 | 80 |
94 public bool drawsBackground () | 81 public NSTabViewItem selectedTabViewItem() { |
95 { | 82 objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedTabViewItem); |
96 return OS.objc_msgSend(this.id_, OS.sel_drawsBackground) !is null; | 83 return result !is null ? new NSTabViewItem(result) : null; |
97 } | 84 } |
98 | 85 |
99 public NSFont font () | 86 public void setDelegate(cocoa.id anObject) { |
100 { | 87 OS.objc_msgSend(this.id, OS.sel_setDelegate_, anObject !is null ? anObject.id : null); |
101 objc.id result = OS.objc_msgSend(this.id_, OS.sel_font); | 88 } |
102 return result !is null ? new NSFont(result) : null; | |
103 } | |
104 | 89 |
105 public NSInteger indexOfTabViewItem (NSTabViewItem tabViewItem) | 90 public void setFont(NSFont font) { |
106 { | 91 OS.objc_msgSend(this.id, OS.sel_setFont_, font !is null ? font.id : null); |
107 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfTabViewItem_1, tabViewItem !is null ? tabViewItem.id_ : null); | 92 } |
108 } | |
109 | 93 |
110 public NSInteger indexOfTabViewItemWithIdentifier (id identifier) | 94 public void setTabViewType(NSTabViewType tabViewType) { |
111 { | 95 OS.objc_msgSend(this.id, OS.sel_setTabViewType_, tabViewType); |
112 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfTabViewItemWithIdentifier_1, identifier !is null ? identifier.id_ : null); | 96 } |
113 } | |
114 | 97 |
115 public void insertTabViewItem (NSTabViewItem tabViewItem, NSInteger index) | 98 public NSTabViewItem tabViewItemAtPoint(NSPoint point) { |
116 { | 99 objc.id result = OS.objc_msgSend(this.id, OS.sel_tabViewItemAtPoint_, point); |
117 OS.objc_msgSend(this.id_, OS.sel_insertTabViewItem_1atIndex_1, tabViewItem !is null ? tabViewItem.id_ : null, index); | 100 return result !is null ? new NSTabViewItem(result) : null; |
118 } | 101 } |
119 | |
120 public NSSize minimumSize () | |
121 { | |
122 NSSize result; | |
123 OS.objc_msgSend_struct(&result, this.id_, OS.sel_minimumSize); | |
124 return result; | |
125 } | |
126 | |
127 public NSInteger numberOfTabViewItems () | |
128 { | |
129 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfTabViewItems); | |
130 } | |
131 | |
132 public void removeTabViewItem (NSTabViewItem tabViewItem) | |
133 { | |
134 OS.objc_msgSend(this.id_, OS.sel_removeTabViewItem_1, tabViewItem !is null ? tabViewItem.id_ : null); | |
135 } | |
136 | |
137 public void selectFirstTabViewItem (id sender) | |
138 { | |
139 OS.objc_msgSend(this.id_, OS.sel_selectFirstTabViewItem_1, sender !is null ? sender.id_ : null); | |
140 } | |
141 | |
142 public void selectLastTabViewItem (id sender) | |
143 { | |
144 OS.objc_msgSend(this.id_, OS.sel_selectLastTabViewItem_1, sender !is null ? sender.id_ : null); | |
145 } | |
146 | |
147 public void selectNextTabViewItem (id sender) | |
148 { | |
149 OS.objc_msgSend(this.id_, OS.sel_selectNextTabViewItem_1, sender !is null ? sender.id_ : null); | |
150 } | |
151 | |
152 public void selectPreviousTabViewItem (id sender) | |
153 { | |
154 OS.objc_msgSend(this.id_, OS.sel_selectPreviousTabViewItem_1, sender !is null ? sender.id_ : null); | |
155 } | |
156 | |
157 public void selectTabViewItem (NSTabViewItem tabViewItem) | |
158 { | |
159 OS.objc_msgSend(this.id_, OS.sel_selectTabViewItem_1, tabViewItem !is null ? tabViewItem.id_ : null); | |
160 } | |
161 | |
162 public void selectTabViewItemAtIndex (NSInteger index) | |
163 { | |
164 OS.objc_msgSend(this.id_, OS.sel_selectTabViewItemAtIndex_1, index); | |
165 } | |
166 | |
167 public void selectTabViewItemWithIdentifier (id identifier) | |
168 { | |
169 OS.objc_msgSend(this.id_, OS.sel_selectTabViewItemWithIdentifier_1, identifier !is null ? identifier.id_ : null); | |
170 } | |
171 | |
172 public NSTabViewItem selectedTabViewItem () | |
173 { | |
174 objc.id result = OS.objc_msgSend(this.id_, OS.sel_selectedTabViewItem); | |
175 return result !is null ? new NSTabViewItem(result) : null; | |
176 } | |
177 | |
178 public void setAllowsTruncatedLabels (bool allowTruncatedLabels) | |
179 { | |
180 OS.objc_msgSend(this.id_, OS.sel_setAllowsTruncatedLabels_1, allowTruncatedLabels); | |
181 } | |
182 | |
183 public void setControlSize (NSControlSize controlSize) | |
184 { | |
185 OS.objc_msgSend(this.id_, OS.sel_setControlSize_1, controlSize); | |
186 } | |
187 | |
188 public void setControlTint (NSControlTint controlTint) | |
189 { | |
190 OS.objc_msgSend(this.id_, OS.sel_setControlTint_1, controlTint); | |
191 } | |
192 | |
193 public void setDelegate (id anObject) | |
194 { | |
195 OS.objc_msgSend(this.id_, OS.sel_setDelegate_1, anObject !is null ? anObject.id_ : null); | |
196 } | |
197 | |
198 public void setDrawsBackground (bool flag) | |
199 { | |
200 OS.objc_msgSend(this.id_, OS.sel_setDrawsBackground_1, flag); | |
201 } | |
202 | |
203 public void setFont (NSFont font) | |
204 { | |
205 OS.objc_msgSend(this.id_, OS.sel_setFont_1, font !is null ? font.id_ : null); | |
206 } | |
207 | |
208 public void setTabViewType (NSTabViewType tabViewType) | |
209 { | |
210 OS.objc_msgSend(this.id_, OS.sel_setTabViewType_1, tabViewType); | |
211 } | |
212 | |
213 public NSTabViewItem tabViewItemAtIndex (NSInteger index) | |
214 { | |
215 objc.id result = OS.objc_msgSend(this.id_, OS.sel_tabViewItemAtIndex_1, index); | |
216 return result !is null ? new NSTabViewItem(result) : null; | |
217 } | |
218 | |
219 public NSTabViewItem tabViewItemAtPoint (NSPoint point) | |
220 { | |
221 objc.id result = OS.objc_msgSend(this.id_, OS.sel_tabViewItemAtPoint_1, point); | |
222 return result !is null ? new NSTabViewItem(result) : null; | |
223 } | |
224 | |
225 public NSArray tabViewItems () | |
226 { | |
227 objc.id result = OS.objc_msgSend(this.id_, OS.sel_tabViewItems); | |
228 return result !is null ? new NSArray(result) : null; | |
229 } | |
230 | |
231 public NSTabViewType tabViewType () | |
232 { | |
233 return cast(NSTabViewType) OS.objc_msgSend(this.id_, OS.sel_tabViewType); | |
234 } | |
235 | |
236 public void takeSelectedTabViewItemFromSender (id sender) | |
237 { | |
238 OS.objc_msgSend(this.id_, OS.sel_takeSelectedTabViewItemFromSender_1, sender !is null ? sender.id_ : null); | |
239 } | |
240 | 102 |
241 } | 103 } |