comparison dstep/appkit/NSStatusItem.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents
children b9de51448c6b
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Sep 24, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.appkit.NSStatusItem;
8
9 import dstep.appkit.NSAttributedString;
10 import dstep.appkit.NSImage;
11 import dstep.appkit.NSMenu;
12 import dstep.appkit.NSStatusBar;
13 import dstep.appkit.NSView;
14 import dstep.appkit.NSWindow;
15 import dstep.applicationservices.coregraphics.CGBase;
16 import dstep.foundation.NSAttributedString;
17 import dstep.foundation.NSGeometry;
18 import dstep.foundation.NSObjCRuntime;
19 import dstep.foundation.NSObject;
20 import dstep.foundation.NSString;
21 import dstep.objc.bridge.Bridge;
22 import dstep.objc.objc;
23
24 const TNSStatusItemView = `
25
26 NSView view ()
27 {
28 return invokeObjcSelf!(NSView, "view");
29 }
30
31 void setView (NSView view)
32 {
33 return invokeObjcSelf!(void, "setView:", NSView)(view);
34 }
35
36 //mixin ObjcBindMethod!(view, "view");
37 //mixin ObjcBindMethod!(setView, "setView:");
38
39 `;
40
41 const TNSStatusItemCommon = `
42
43 SEL action ()
44 {
45 return invokeObjcSelf!(SEL, "action");
46 }
47
48 void setAction (SEL action)
49 {
50 return invokeObjcSelf!(void, "setAction:", SEL)(action);
51 }
52
53 SEL doubleAction ()
54 {
55 return invokeObjcSelf!(SEL, "doubleAction");
56 }
57
58 void setDoubleAction (SEL action)
59 {
60 return invokeObjcSelf!(void, "setDoubleAction:", SEL)(action);
61 }
62
63 Object target ()
64 {
65 return invokeObjcSelf!(Object, "target");
66 }
67
68 void setTarget (Object target)
69 {
70 return invokeObjcSelf!(void, "setTarget:", Object)(target);
71 }
72
73 NSString title ()
74 {
75 return invokeObjcSelf!(NSString, "title");
76 }
77
78 void setTitle (NSString title)
79 {
80 return invokeObjcSelf!(void, "setTitle:", NSString)(title);
81 }
82
83 NSAttributedString attributedTitle ()
84 {
85 return invokeObjcSelf!(NSAttributedString, "attributedTitle");
86 }
87
88 void setAttributedTitle (NSAttributedString title)
89 {
90 return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(title);
91 }
92
93 NSImage image ()
94 {
95 return invokeObjcSelf!(NSImage, "image");
96 }
97
98 void setImage (NSImage image)
99 {
100 return invokeObjcSelf!(void, "setImage:", NSImage)(image);
101 }
102
103 NSImage alternateImage ()
104 {
105 return invokeObjcSelf!(NSImage, "alternateImage");
106 }
107
108 void setAlternateImage (NSImage image)
109 {
110 return invokeObjcSelf!(void, "setAlternateImage:", NSImage)(image);
111 }
112
113 NSMenu menu ()
114 {
115 return invokeObjcSelf!(NSMenu, "menu");
116 }
117
118 void setMenu (NSMenu menu)
119 {
120 return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu);
121 }
122
123 bool isEnabled ()
124 {
125 return invokeObjcSelf!(bool, "isEnabled");
126 }
127
128 void setEnabled (bool enabled)
129 {
130 return invokeObjcSelf!(void, "setEnabled:", bool)(enabled);
131 }
132
133 NSString toolTip ()
134 {
135 return invokeObjcSelf!(NSString, "toolTip");
136 }
137
138 void setToolTip (NSString toolTip)
139 {
140 return invokeObjcSelf!(void, "setToolTip:", NSString)(toolTip);
141 }
142
143 void setHighlightMode (bool highlightMode)
144 {
145 return invokeObjcSelf!(void, "setHighlightMode:", bool)(highlightMode);
146 }
147
148 bool highlightMode ()
149 {
150 return invokeObjcSelf!(bool, "highlightMode");
151 }
152
153 NSInteger sendActionOn (NSInteger mask)
154 {
155 return invokeObjcSelf!(NSInteger, "sendActionOn:", NSInteger)(mask);
156 }
157
158 void popUpStatusItemMenu (NSMenu menu)
159 {
160 return invokeObjcSelf!(void, "popUpStatusItemMenu:", NSMenu)(menu);
161 }
162
163 void drawStatusBarBackgroundInRect (NSRect rect, bool highlight)
164 {
165 return invokeObjcSelf!(void, "drawStatusBarBackgroundInRect:withHighlight:", NSRect, bool)(rect, highlight);
166 }
167
168 //mixin ObjcBindMethod!(action, "action");
169 //mixin ObjcBindMethod!(setAction, "setAction:");
170 //mixin ObjcBindMethod!(doubleAction, "doubleAction");
171 //mixin ObjcBindMethod!(setDoubleAction, "setDoubleAction:");
172 //mixin ObjcBindMethod!(target, "target");
173 //mixin ObjcBindMethod!(setTarget, "setTarget:");
174 //mixin ObjcBindMethod!(title, "title");
175 //mixin ObjcBindMethod!(setTitle, "setTitle:");
176 //mixin ObjcBindMethod!(attributedTitle, "attributedTitle");
177 //mixin ObjcBindMethod!(setAttributedTitle, "setAttributedTitle:");
178 //mixin ObjcBindMethod!(image, "image");
179 //mixin ObjcBindMethod!(setImage, "setImage:");
180 //mixin ObjcBindMethod!(alternateImage, "alternateImage");
181 //mixin ObjcBindMethod!(setAlternateImage, "setAlternateImage:");
182 //mixin ObjcBindMethod!(menu, "menu");
183 //mixin ObjcBindMethod!(setMenu, "setMenu:");
184 //mixin ObjcBindMethod!(isEnabled, "isEnabled");
185 //mixin ObjcBindMethod!(setEnabled, "setEnabled:");
186 //mixin ObjcBindMethod!(toolTip, "toolTip");
187 //mixin ObjcBindMethod!(setToolTip, "setToolTip:");
188 //mixin ObjcBindMethod!(setHighlightMode, "setHighlightMode:");
189 //mixin ObjcBindMethod!(highlightMode, "highlightMode");
190 //mixin ObjcBindMethod!(sendActionOn, "sendActionOn:");
191 //mixin ObjcBindMethod!(popUpStatusItemMenu, "popUpStatusItemMenu:");
192 //mixin ObjcBindMethod!(drawStatusBarBackgroundInRect, "drawStatusBarBackgroundInRect:withHighlight:");
193
194 `;
195
196 class NSStatusItem : NSObject
197 {
198 mixin (ObjcWrap);
199
200 NSStatusBar statusBar ()
201 {
202 return invokeObjcSelf!(NSStatusBar, "statusBar");
203 }
204
205 CGFloat length ()
206 {
207 return invokeObjcSelf!(CGFloat, "length");
208 }
209
210 void setLength (CGFloat length)
211 {
212 return invokeObjcSelf!(void, "setLength:", CGFloat)(length);
213 }
214
215 // NSStatusItemView
216 NSView view ()
217 {
218 return invokeObjcSelf!(NSView, "view");
219 }
220
221 void setView (NSView view)
222 {
223 return invokeObjcSelf!(void, "setView:", NSView)(view);
224 }
225
226 // NSStatusItemCommon
227 SEL action ()
228 {
229 return invokeObjcSelf!(SEL, "action");
230 }
231
232 void setAction (SEL action)
233 {
234 return invokeObjcSelf!(void, "setAction:", SEL)(action);
235 }
236
237 SEL doubleAction ()
238 {
239 return invokeObjcSelf!(SEL, "doubleAction");
240 }
241
242 void setDoubleAction (SEL action)
243 {
244 return invokeObjcSelf!(void, "setDoubleAction:", SEL)(action);
245 }
246
247 Object target ()
248 {
249 return invokeObjcSelf!(Object, "target");
250 }
251
252 void setTarget (Object target)
253 {
254 return invokeObjcSelf!(void, "setTarget:", Object)(target);
255 }
256
257 NSString title ()
258 {
259 return invokeObjcSelf!(NSString, "title");
260 }
261
262 void setTitle (NSString title)
263 {
264 return invokeObjcSelf!(void, "setTitle:", NSString)(title);
265 }
266
267 NSAttributedString attributedTitle ()
268 {
269 return invokeObjcSelf!(NSAttributedString, "attributedTitle");
270 }
271
272 void setAttributedTitle (NSAttributedString title)
273 {
274 return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(title);
275 }
276
277 NSImage image ()
278 {
279 return invokeObjcSelf!(NSImage, "image");
280 }
281
282 void setImage (NSImage image)
283 {
284 return invokeObjcSelf!(void, "setImage:", NSImage)(image);
285 }
286
287 NSImage alternateImage ()
288 {
289 return invokeObjcSelf!(NSImage, "alternateImage");
290 }
291
292 void setAlternateImage (NSImage image)
293 {
294 return invokeObjcSelf!(void, "setAlternateImage:", NSImage)(image);
295 }
296
297 NSMenu menu ()
298 {
299 return invokeObjcSelf!(NSMenu, "menu");
300 }
301
302 void setMenu (NSMenu menu)
303 {
304 return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu);
305 }
306
307 bool isEnabled ()
308 {
309 return invokeObjcSelf!(bool, "isEnabled");
310 }
311
312 void setEnabled (bool enabled)
313 {
314 return invokeObjcSelf!(void, "setEnabled:", bool)(enabled);
315 }
316
317 NSString toolTip ()
318 {
319 return invokeObjcSelf!(NSString, "toolTip");
320 }
321
322 void setToolTip (NSString toolTip)
323 {
324 return invokeObjcSelf!(void, "setToolTip:", NSString)(toolTip);
325 }
326
327 void setHighlightMode (bool highlightMode)
328 {
329 return invokeObjcSelf!(void, "setHighlightMode:", bool)(highlightMode);
330 }
331
332 bool highlightMode ()
333 {
334 return invokeObjcSelf!(bool, "highlightMode");
335 }
336
337 NSInteger sendActionOn (NSInteger mask)
338 {
339 return invokeObjcSelf!(NSInteger, "sendActionOn:", NSInteger)(mask);
340 }
341
342 void popUpStatusItemMenu (NSMenu menu)
343 {
344 return invokeObjcSelf!(void, "popUpStatusItemMenu:", NSMenu)(menu);
345 }
346
347 void drawStatusBarBackgroundInRect (NSRect rect, bool highlight)
348 {
349 return invokeObjcSelf!(void, "drawStatusBarBackgroundInRect:withHighlight:", NSRect, bool)(rect, highlight);
350 }
351 }