Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSStatusItem.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.NSStatusItem; | 14 module dwt.internal.cocoa.NSStatusItem; |
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 dwt.internal.cocoa.NSAttributedString; | 18 import cocoa = dwt.internal.cocoa.id; |
19 import dwt.internal.cocoa.NSImage; | |
20 import dwt.internal.cocoa.NSInteger; | |
21 import dwt.internal.cocoa.NSMenu; | |
22 import dwt.internal.cocoa.NSObject; | 19 import dwt.internal.cocoa.NSObject; |
23 import dwt.internal.cocoa.NSRect; | 20 import dwt.internal.cocoa.NSRect; |
24 import dwt.internal.cocoa.NSStatusBar; | |
25 import dwt.internal.cocoa.NSString; | |
26 import dwt.internal.cocoa.NSView; | 21 import dwt.internal.cocoa.NSView; |
27 import dwt.internal.cocoa.OS; | 22 import dwt.internal.cocoa.OS; |
28 import objc = dwt.internal.objc.runtime; | 23 import objc = dwt.internal.objc.runtime; |
29 | 24 |
30 public class NSStatusItem : NSObject | 25 public class NSStatusItem : NSObject { |
31 { | |
32 | 26 |
33 public this () | 27 public this() { |
34 { | 28 super(); |
35 super(); | 29 } |
36 } | |
37 | 30 |
38 public this (objc.id id) | 31 public this(objc.id id) { |
39 { | 32 super(id); |
40 super(id); | 33 } |
41 } | |
42 | 34 |
43 public objc.SEL action () | 35 public this(cocoa.id id) { |
44 { | 36 super(id); |
45 return cast(objc.SEL) OS.objc_msgSend(this.id_, OS.sel_action); | 37 } |
46 } | |
47 | 38 |
48 public NSImage alternateImage () | 39 public void drawStatusBarBackgroundInRect(NSRect rect, bool highlight) { |
49 { | 40 OS.objc_msgSend(this.id, OS.sel_drawStatusBarBackgroundInRect_withHighlight_, rect, highlight); |
50 objc.id result = OS.objc_msgSend(this.id_, OS.sel_alternateImage); | 41 } |
51 return result !is null ? new NSImage(result) : null; | |
52 } | |
53 | 42 |
54 public NSAttributedString attributedTitle () | 43 public void setHighlightMode(bool highlightMode) { |
55 { | 44 OS.objc_msgSend(this.id, OS.sel_setHighlightMode_, highlightMode); |
56 objc.id result = OS.objc_msgSend(this.id_, OS.sel_attributedTitle); | 45 } |
57 return result !is null ? new NSAttributedString(result) : null; | |
58 } | |
59 | 46 |
60 public objc.SEL doubleAction () | 47 public void setLength(CGFloat length) { |
61 { | 48 OS.objc_msgSend(this.id, OS.sel_setLength_, length); |
62 return cast(objc.SEL) OS.objc_msgSend(this.id_, OS.sel_doubleAction); | 49 } |
63 } | |
64 | 50 |
65 public void drawStatusBarBackgroundInRect (NSRect rect, bool highlight) | 51 public void setView(NSView view) { |
66 { | 52 OS.objc_msgSend(this.id, OS.sel_setView_, view !is null ? view.id : null); |
67 OS.objc_msgSend(this.id_, OS.sel_drawStatusBarBackgroundInRect_1withHighlight_1, rect, highlight); | 53 } |
68 } | |
69 | |
70 public bool highlightMode () | |
71 { | |
72 return OS.objc_msgSend(this.id_, OS.sel_highlightMode) !is null; | |
73 } | |
74 | |
75 public NSImage image () | |
76 { | |
77 objc.id result = OS.objc_msgSend(this.id_, OS.sel_image); | |
78 return result !is null ? new NSImage(result) : null; | |
79 } | |
80 | |
81 public bool isEnabled () | |
82 { | |
83 return OS.objc_msgSend(this.id_, OS.sel_isEnabled) !is null; | |
84 } | |
85 | |
86 public CGFloat length () | |
87 { | |
88 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_length); | |
89 } | |
90 | |
91 public NSMenu menu () | |
92 { | |
93 objc.id result = OS.objc_msgSend(this.id_, OS.sel_menu); | |
94 return result !is null ? new NSMenu(result) : null; | |
95 } | |
96 | |
97 public void popUpStatusItemMenu (NSMenu menu) | |
98 { | |
99 OS.objc_msgSend(this.id_, OS.sel_popUpStatusItemMenu_1, menu !is null ? menu.id_ : null); | |
100 } | |
101 | |
102 public NSInteger sendActionOn (NSInteger mask) | |
103 { | |
104 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_sendActionOn_1, mask); | |
105 } | |
106 | |
107 public void setAction (objc.SEL action) | |
108 { | |
109 OS.objc_msgSend(this.id_, OS.sel_setAction_1, action); | |
110 } | |
111 | |
112 public void setAlternateImage (NSImage image) | |
113 { | |
114 OS.objc_msgSend(this.id_, OS.sel_setAlternateImage_1, image !is null ? image.id_ : null); | |
115 } | |
116 | |
117 public void setAttributedTitle (NSAttributedString title) | |
118 { | |
119 OS.objc_msgSend(this.id_, OS.sel_setAttributedTitle_1, title !is null ? title.id_ : null); | |
120 } | |
121 | |
122 public void setDoubleAction (objc.SEL action) | |
123 { | |
124 OS.objc_msgSend(this.id_, OS.sel_setDoubleAction_1, action); | |
125 } | |
126 | |
127 public void setEnabled (bool enabled) | |
128 { | |
129 OS.objc_msgSend(this.id_, OS.sel_setEnabled_1, enabled); | |
130 } | |
131 | |
132 public void setHighlightMode (bool highlightMode) | |
133 { | |
134 OS.objc_msgSend(this.id_, OS.sel_setHighlightMode_1, highlightMode); | |
135 } | |
136 | |
137 public void setImage (NSImage image) | |
138 { | |
139 OS.objc_msgSend(this.id_, OS.sel_setImage_1, image !is null ? image.id_ : null); | |
140 } | |
141 | |
142 public void setLength (CGFloat length) | |
143 { | |
144 OS.objc_msgSend(this.id_, OS.sel_setLength_1, length); | |
145 } | |
146 | |
147 public void setMenu (NSMenu menu) | |
148 { | |
149 OS.objc_msgSend(this.id_, OS.sel_setMenu_1, menu !is null ? menu.id_ : null); | |
150 } | |
151 | |
152 public void setTarget (id target) | |
153 { | |
154 OS.objc_msgSend(this.id_, OS.sel_setTarget_1, target !is null ? target.id_ : null); | |
155 } | |
156 | |
157 public void setTitle (NSString title) | |
158 { | |
159 OS.objc_msgSend(this.id_, OS.sel_setTitle_1, title !is null ? title.id_ : null); | |
160 } | |
161 | |
162 public void setToolTip (NSString toolTip) | |
163 { | |
164 OS.objc_msgSend(this.id_, OS.sel_setToolTip_1, toolTip !is null ? toolTip.id_ : null); | |
165 } | |
166 | |
167 public void setView (NSView view) | |
168 { | |
169 OS.objc_msgSend(this.id_, OS.sel_setView_1, view !is null ? view.id_ : null); | |
170 } | |
171 | |
172 public NSStatusBar statusBar () | |
173 { | |
174 objc.id result = OS.objc_msgSend(this.id_, OS.sel_statusBar); | |
175 return result !is null ? new NSStatusBar(result) : null; | |
176 } | |
177 | |
178 public id target () | |
179 { | |
180 objc.id result = OS.objc_msgSend(this.id_, OS.sel_target); | |
181 return result !is null ? new id(result) : null; | |
182 } | |
183 | |
184 public NSString title () | |
185 { | |
186 objc.id result = OS.objc_msgSend(this.id_, OS.sel_title); | |
187 return result !is null ? new NSString(result) : null; | |
188 } | |
189 | |
190 public NSString toolTip () | |
191 { | |
192 objc.id result = OS.objc_msgSend(this.id_, OS.sel_toolTip); | |
193 return result !is null ? new NSString(result) : null; | |
194 } | |
195 | |
196 public NSView view () | |
197 { | |
198 objc.id result = OS.objc_msgSend(this.id_, OS.sel_view); | |
199 return result !is null ? new NSView(result) : null; | |
200 } | |
201 | 54 |
202 } | 55 } |