comparison dwt/internal/cocoa/NSTabViewItem.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.NSTabViewItem;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSColor;
18 import dwt.internal.cocoa.NSObject;
19 import dwt.internal.cocoa.NSRect;
20 import dwt.internal.cocoa.NSSize;
21 import dwt.internal.cocoa.NSString;
22 import dwt.internal.cocoa.NSTabView;
23 import dwt.internal.cocoa.NSView;
24 import dwt.internal.cocoa.OS;
25 import objc = dwt.internal.objc.runtime;
26
27 enum NSTabState
28 {
29 NSSelectedTab = 0,
30 NSBackgroundTab = 1,
31 NSPressedTab = 2
32 }
33
34 alias NSTabState.NSSelectedTab NSSelectedTab;
35 alias NSTabState.NSBackgroundTab NSBackgroundTab;
36 alias NSTabState.NSPressedTab NSPressedTab;
37
38 public class NSTabViewItem : NSObject
39 {
40
41 public this ()
42 {
43 super();
44 }
45
46 public this (objc.id id)
47 {
48 super(id);
49 }
50
51 public NSColor color ()
52 {
53 objc.id result = OS.objc_msgSend(this.id, OS.sel_color);
54 return result !is null ? new NSColor(result) : null;
55 }
56
57 public void drawLabel (bool shouldTruncateLabel, NSRect labelRect)
58 {
59 OS.objc_msgSend(this.id, OS.sel_drawLabel_1inRect_1, shouldTruncateLabel, labelRect);
60 }
61
62 public id identifier ()
63 {
64 objc.id result = OS.objc_msgSend(this.id, OS.sel_identifier);
65 return result !is null ? new id(result) : null;
66 }
67
68 public NSTabViewItem initWithIdentifier (id identifier)
69 {
70 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIdentifier_1, identifier !is null ? identifier.id : null);
71 return result !is null ? this : null;
72 }
73
74 public NSTabViewItem initialFirstResponder ()
75 {
76 objc.id result = OS.objc_msgSend(this.id, OS.sel_initialFirstResponder);
77 return result !is null ? this : null;
78 }
79
80 public NSString label ()
81 {
82 objc.id result = OS.objc_msgSend(this.id, OS.sel_label);
83 return result !is null ? new NSString(result) : null;
84 }
85
86 public void setColor (NSColor color)
87 {
88 OS.objc_msgSend(this.id, OS.sel_setColor_1, color !is null ? color.id : null);
89 }
90
91 public void setIdentifier (id identifier)
92 {
93 OS.objc_msgSend(this.id, OS.sel_setIdentifier_1, identifier !is null ? identifier.id : null);
94 }
95
96 public void setInitialFirstResponder (NSView view)
97 {
98 OS.objc_msgSend(this.id, OS.sel_setInitialFirstResponder_1, view !is null ? view.id : null);
99 }
100
101 public void setLabel (NSString label)
102 {
103 OS.objc_msgSend(this.id, OS.sel_setLabel_1, label !is null ? label.id : null);
104 }
105
106 public void setView (NSView view)
107 {
108 OS.objc_msgSend(this.id, OS.sel_setView_1, view !is null ? view.id : null);
109 }
110
111 public NSSize sizeOfLabel (bool computeMin)
112 {
113 NSSize result;
114 OS.objc_msgSend_stret(result, this.id, OS.sel_sizeOfLabel_1, computeMin);
115 return result;
116 }
117
118 public NSTabState tabState ()
119 {
120 return cast(NSTabState) OS.objc_msgSend(this.id, OS.sel_tabState);
121 }
122
123 public NSTabView tabView ()
124 {
125 objc.id result = OS.objc_msgSend(this.id, OS.sel_tabView);
126 return result !is null ? new NSTabView(result) : null;
127 }
128
129 public id view ()
130 {
131 objc.id result = OS.objc_msgSend(this.id, OS.sel_view);
132 return result !is null ? new id(result) : null;
133 }
134
135 }