Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSMenuItem.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.NSMenuItem; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSAttributedString; | |
18 import dwt.internal.cocoa.NSImage; | |
19 import dwt.internal.cocoa.NSInteger; | |
20 import dwt.internal.cocoa.NSMenu; | |
21 import dwt.internal.cocoa.NSObject; | |
22 import dwt.internal.cocoa.NSString; | |
23 import dwt.internal.cocoa.NSView; | |
24 import dwt.internal.cocoa.OS; | |
25 import objc = dwt.internal.objc.runtime; | |
26 | |
27 public class NSMenuItem : NSObject | |
28 { | |
29 | |
30 public this () | |
31 { | |
32 super(); | |
33 } | |
34 | |
35 public this (objc.id id) | |
36 { | |
37 super(id); | |
38 } | |
39 | |
40 public objc.SEL action () | |
41 { | |
42 return OS.objc_msgSend(this.id, OS.sel_action); | |
43 } | |
44 | |
45 public NSAttributedString attributedTitle () | |
46 { | |
47 objc.id result = OS.objc_msgSend(this.id, OS.sel_attributedTitle); | |
48 return result !is null ? new NSAttributedString(result) : null; | |
49 } | |
50 | |
51 public bool hasSubmenu () | |
52 { | |
53 return OS.objc_msgSend(this.id, OS.sel_hasSubmenu) !is null; | |
54 } | |
55 | |
56 public NSImage image () | |
57 { | |
58 objc.id result = OS.objc_msgSend(this.id, OS.sel_image); | |
59 return result !is null ? new NSImage(result) : null; | |
60 } | |
61 | |
62 public NSInteger indentationLevel () | |
63 { | |
64 return OS.objc_msgSend(this.id, OS.sel_indentationLevel); | |
65 } | |
66 | |
67 public NSMenuItem initWithTitle (NSString aString, objc.SEL aSelector, NSString charCode) | |
68 { | |
69 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithTitle_1action_1keyEquivalent_1, aString !is null ? aString.id : null, aSelector, | |
70 charCode !is null ? charCode.id : null); | |
71 return result !is null ? this : null; | |
72 } | |
73 | |
74 public bool isAlternate () | |
75 { | |
76 return OS.objc_msgSend(this.id, OS.sel_isAlternate) !is null; | |
77 } | |
78 | |
79 public bool isEnabled () | |
80 { | |
81 return OS.objc_msgSend(this.id, OS.sel_isEnabled) !is null; | |
82 } | |
83 | |
84 public bool isHidden () | |
85 { | |
86 return OS.objc_msgSend(this.id, OS.sel_isHidden) !is null; | |
87 } | |
88 | |
89 public bool isHiddenOrHasHiddenAncestor () | |
90 { | |
91 return OS.objc_msgSend(this.id, OS.sel_isHiddenOrHasHiddenAncestor) !is null; | |
92 } | |
93 | |
94 public bool isHighlighted () | |
95 { | |
96 return OS.objc_msgSend(this.id, OS.sel_isHighlighted) !is null; | |
97 } | |
98 | |
99 public bool isSeparatorItem () | |
100 { | |
101 return OS.objc_msgSend(this.id, OS.sel_isSeparatorItem) !is null; | |
102 } | |
103 | |
104 public NSString keyEquivalent () | |
105 { | |
106 objc.id result = OS.objc_msgSend(this.id, OS.sel_keyEquivalent); | |
107 return result !is null ? new NSString(result) : null; | |
108 } | |
109 | |
110 public NSUInteger keyEquivalentModifierMask () | |
111 { | |
112 return OS.objc_msgSend(this.id, OS.sel_keyEquivalentModifierMask); | |
113 } | |
114 | |
115 public NSMenu menu () | |
116 { | |
117 objc.id result = OS.objc_msgSend(this.id, OS.sel_menu); | |
118 return result !is null ? new NSMenu(result) : null; | |
119 } | |
120 | |
121 public NSImage mixedStateImage () | |
122 { | |
123 objc.id result = OS.objc_msgSend(this.id, OS.sel_mixedStateImage); | |
124 return result !is null ? new NSImage(result) : null; | |
125 } | |
126 | |
127 public NSString mnemonic () | |
128 { | |
129 objc.id result = OS.objc_msgSend(this.id, OS.sel_mnemonic); | |
130 return result !is null ? new NSString(result) : null; | |
131 } | |
132 | |
133 public NSUInteger mnemonicLocation () | |
134 { | |
135 return OS.objc_msgSend(this.id, OS.sel_mnemonicLocation); | |
136 } | |
137 | |
138 public NSImage offStateImage () | |
139 { | |
140 objc.id result = OS.objc_msgSend(this.id, OS.sel_offStateImage); | |
141 return result !is null ? new NSImage(result) : null; | |
142 } | |
143 | |
144 public NSImage onStateImage () | |
145 { | |
146 objc.id result = OS.objc_msgSend(this.id, OS.sel_onStateImage); | |
147 return result !is null ? new NSImage(result) : null; | |
148 } | |
149 | |
150 public id representedObject () | |
151 { | |
152 objc.id result = OS.objc_msgSend(this.id, OS.sel_representedObject); | |
153 return result !is null ? new id(result) : null; | |
154 } | |
155 | |
156 public static NSMenuItem separatorItem () | |
157 { | |
158 objc.id result = OS.objc_msgSend(OS.class_NSMenuItem, OS.sel_separatorItem); | |
159 return result !is null ? new NSMenuItem(result) : null; | |
160 } | |
161 | |
162 public void setAction (objc.SEL aSelector) | |
163 { | |
164 OS.objc_msgSend(this.id, OS.sel_setAction_1, aSelector); | |
165 } | |
166 | |
167 public void setAlternate (bool isAlternate) | |
168 { | |
169 OS.objc_msgSend(this.id, OS.sel_setAlternate_1, isAlternate); | |
170 } | |
171 | |
172 public void setAttributedTitle (NSAttributedString string) | |
173 { | |
174 OS.objc_msgSend(this.id, OS.sel_setAttributedTitle_1, string !is null ? string.id : null); | |
175 } | |
176 | |
177 public void setEnabled (bool flag) | |
178 { | |
179 OS.objc_msgSend(this.id, OS.sel_setEnabled_1, flag); | |
180 } | |
181 | |
182 public void setHidden (bool hidden) | |
183 { | |
184 OS.objc_msgSend(this.id, OS.sel_setHidden_1, hidden); | |
185 } | |
186 | |
187 public void setImage (NSImage menuImage) | |
188 { | |
189 OS.objc_msgSend(this.id, OS.sel_setImage_1, menuImage !is null ? menuImage.id : null); | |
190 } | |
191 | |
192 public void setIndentationLevel (NSInteger indentationLevel) | |
193 { | |
194 OS.objc_msgSend(this.id, OS.sel_setIndentationLevel_1, indentationLevel); | |
195 } | |
196 | |
197 public void setKeyEquivalent (NSString aKeyEquivalent) | |
198 { | |
199 OS.objc_msgSend(this.id, OS.sel_setKeyEquivalent_1, aKeyEquivalent !is null ? aKeyEquivalent.id : null); | |
200 } | |
201 | |
202 public void setKeyEquivalentModifierMask (NSUInteger mask) | |
203 { | |
204 OS.objc_msgSend(this.id, OS.sel_setKeyEquivalentModifierMask_1, mask); | |
205 } | |
206 | |
207 public void setMenu (NSMenu menu) | |
208 { | |
209 OS.objc_msgSend(this.id, OS.sel_setMenu_1, menu !is null ? menu.id : null); | |
210 } | |
211 | |
212 public void setMixedStateImage (NSImage image) | |
213 { | |
214 OS.objc_msgSend(this.id, OS.sel_setMixedStateImage_1, image !is null ? image.id : null); | |
215 } | |
216 | |
217 public void setMnemonicLocation (NSUInteger location) | |
218 { | |
219 OS.objc_msgSend(this.id, OS.sel_setMnemonicLocation_1, location); | |
220 } | |
221 | |
222 public void setOffStateImage (NSImage image) | |
223 { | |
224 OS.objc_msgSend(this.id, OS.sel_setOffStateImage_1, image !is null ? image.id : null); | |
225 } | |
226 | |
227 public void setOnStateImage (NSImage image) | |
228 { | |
229 OS.objc_msgSend(this.id, OS.sel_setOnStateImage_1, image !is null ? image.id : null); | |
230 } | |
231 | |
232 public void setRepresentedObject (id anObject) | |
233 { | |
234 OS.objc_msgSend(this.id, OS.sel_setRepresentedObject_1, anObject !is null ? anObject.id : null); | |
235 } | |
236 | |
237 public void setState (NSInteger state) | |
238 { | |
239 OS.objc_msgSend(this.id, OS.sel_setState_1, state); | |
240 } | |
241 | |
242 public void setSubmenu (NSMenu submenu) | |
243 { | |
244 OS.objc_msgSend(this.id, OS.sel_setSubmenu_1, submenu !is null ? submenu.id : null); | |
245 } | |
246 | |
247 public void setTag (NSInteger anInt) | |
248 { | |
249 OS.objc_msgSend(this.id, OS.sel_setTag_1, anInt); | |
250 } | |
251 | |
252 public void setTarget (id anObject) | |
253 { | |
254 OS.objc_msgSend(this.id, OS.sel_setTarget_1, anObject !is null ? anObject.id : null); | |
255 } | |
256 | |
257 public void setTitle (NSString aString) | |
258 { | |
259 OS.objc_msgSend(this.id, OS.sel_setTitle_1, aString !is null ? aString.id : null); | |
260 } | |
261 | |
262 public void setTitleWithMnemonic (NSString stringWithAmpersand) | |
263 { | |
264 OS.objc_msgSend(this.id, OS.sel_setTitleWithMnemonic_1, stringWithAmpersand !is null ? stringWithAmpersand.id : null); | |
265 } | |
266 | |
267 public void setToolTip (NSString toolTip) | |
268 { | |
269 OS.objc_msgSend(this.id, OS.sel_setToolTip_1, toolTip !is null ? toolTip.id : null); | |
270 } | |
271 | |
272 public static void setUsesUserKeyEquivalents (bool flag) | |
273 { | |
274 OS.objc_msgSend(OS.class_NSMenuItem, OS.sel_setUsesUserKeyEquivalents_1, flag); | |
275 } | |
276 | |
277 public void setView (NSView view) | |
278 { | |
279 OS.objc_msgSend(this.id, OS.sel_setView_1, view !is null ? view.id : null); | |
280 } | |
281 | |
282 public NSInteger state () | |
283 { | |
284 return OS.objc_msgSend(this.id, OS.sel_state); | |
285 } | |
286 | |
287 public NSMenu submenu () | |
288 { | |
289 objc.id result = OS.objc_msgSend(this.id, OS.sel_submenu); | |
290 return result !is null ? new NSMenu(result) : null; | |
291 } | |
292 | |
293 public NSInteger tag () | |
294 { | |
295 return OS.objc_msgSend(this.id, OS.sel_tag); | |
296 } | |
297 | |
298 public id target () | |
299 { | |
300 objc.id result = OS.objc_msgSend(this.id, OS.sel_target); | |
301 return result !is null ? new id(result) : null; | |
302 } | |
303 | |
304 public NSString title () | |
305 { | |
306 objc.id result = OS.objc_msgSend(this.id, OS.sel_title); | |
307 return result !is null ? new NSString(result) : null; | |
308 } | |
309 | |
310 public NSString toolTip () | |
311 { | |
312 objc.id result = OS.objc_msgSend(this.id, OS.sel_toolTip); | |
313 return result !is null ? new NSString(result) : null; | |
314 } | |
315 | |
316 public NSString userKeyEquivalent () | |
317 { | |
318 objc.id result = OS.objc_msgSend(this.id, OS.sel_userKeyEquivalent); | |
319 return result !is null ? new NSString(result) : null; | |
320 } | |
321 | |
322 public static bool usesUserKeyEquivalents () | |
323 { | |
324 return OS.objc_msgSend(OS.class_NSMenuItem, OS.sel_usesUserKeyEquivalents) !is null; | |
325 } | |
326 | |
327 public NSView view () | |
328 { | |
329 objc.id result = OS.objc_msgSend(this.id, OS.sel_view); | |
330 return result !is null ? new NSView(result) : null; | |
331 } | |
332 | |
333 } |