comparison dwt/widgets/Menu.d @ 7:e831403a80a9

Add 'cast' to casts
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 14:30:35 +0200
parents 1a8b3cb347e0
children a9ab4c738ed8
comparison
equal deleted inserted replaced
6:b903c16b6f48 7:e831403a80a9
206 location.x = shellCoord.x; 206 location.x = shellCoord.x;
207 location.y = topView.frame().height - shellCoord.y; 207 location.y = topView.frame().height - shellCoord.y;
208 } else { 208 } else {
209 location = window.mouseLocationOutsideOfEventStream(); 209 location = window.mouseLocationOutsideOfEventStream();
210 } 210 }
211 NSEvent nsEvent = NSEvent.otherEventWithType(OS.NSApplicationDefined, location, 0, 0.0, window.windowNumber(), window.graphicsContext(), (short)0, 0, 0); 211 NSEvent nsEvent = NSEvent.otherEventWithType(OS.NSApplicationDefined, location, 0, 0.0, window.windowNumber(), window.graphicsContext(), cast(short)0, 0, 0);
212 NSMenu.static_popUpContextMenu_withEvent_forView_ (nsMenu, nsEvent, shell.view); 212 NSMenu.static_popUpContextMenu_withEvent_forView_ (nsMenu, nsEvent, shell.view);
213 } else { 213 } else {
214 nsMenu.cancelTracking (); 214 nsMenu.cancelTracking ();
215 } 215 }
216 } 216 }
268 addListener (DWT.Show,typedListener); 268 addListener (DWT.Show,typedListener);
269 } 269 }
270 270
271 void createHandle () { 271 void createHandle () {
272 // display.addMenu (this); 272 // display.addMenu (this);
273 SWTMenu widget = (SWTMenu)new SWTMenu().alloc(); 273 SWTMenu widget = cast(SWTMenu)new SWTMenu().alloc();
274 widget.initWithTitle(NSString.stringWith("")); 274 widget.initWithTitle(NSString.stringWith(""));
275 widget.setAutoenablesItems(false); 275 widget.setAutoenablesItems(false);
276 widget.setTag(jniRef); 276 widget.setTag(jniRef);
277 widget.setDelegate(widget); 277 widget.setDelegate(widget);
278 nsMenu = widget; 278 nsMenu = widget;
284 NSMenuItem nsItem = null; 284 NSMenuItem nsItem = null;
285 if ((item.style & DWT.SEPARATOR) !is 0) { 285 if ((item.style & DWT.SEPARATOR) !is 0) {
286 nsItem = NSMenuItem.separatorItem(); 286 nsItem = NSMenuItem.separatorItem();
287 nsItem.retain(); 287 nsItem.retain();
288 } else { 288 } else {
289 nsItem = (NSMenuItem)new SWTMenuItem().alloc(); 289 nsItem = cast(NSMenuItem)new SWTMenuItem().alloc();
290 nsItem.initWithTitle(NSString.stringWith(""), 0, NSString.stringWith("")); 290 nsItem.initWithTitle(NSString.stringWith(""), 0, NSString.stringWith(""));
291 nsItem.setTarget(nsItem); 291 nsItem.setTarget(nsItem);
292 nsItem.setAction(OS.sel_sendSelection); 292 nsItem.setAction(OS.sel_sendSelection);
293 item.createJNIRef(); 293 item.createJNIRef();
294 nsItem.setTag(item.jniRef); 294 nsItem.setTag(item.jniRef);
639 void menu_willHighlightItem(int menu, int itemID) { 639 void menu_willHighlightItem(int menu, int itemID) {
640 int jniRef = OS.objc_msgSend(itemID, OS.sel_tag); 640 int jniRef = OS.objc_msgSend(itemID, OS.sel_tag);
641 if (jniRef !is -1 && jniRef !is 0) { 641 if (jniRef !is -1 && jniRef !is 0) {
642 Object object = OS.JNIGetObject(jniRef); 642 Object object = OS.JNIGetObject(jniRef);
643 if (object instanceof MenuItem) { 643 if (object instanceof MenuItem) {
644 MenuItem item = (MenuItem)object; 644 MenuItem item = cast(MenuItem)object;
645 item.sendEvent (DWT.Arm); 645 item.sendEvent (DWT.Arm);
646 } 646 }
647 } 647 }
648 } 648 }
649 649
800 */ 800 */
801 public void setEnabled (bool enabled) { 801 public void setEnabled (bool enabled) {
802 checkWidget(); 802 checkWidget();
803 if (enabled) { 803 if (enabled) {
804 state &= ~DISABLED; 804 state &= ~DISABLED;
805 //OS.EnableMenuItem (handle, (short)0); 805 //OS.EnableMenuItem (handle, cast(short)0);
806 } else { 806 } else {
807 state |= DISABLED; 807 state |= DISABLED;
808 //OS.DisableMenuItem (handle, (short)0); 808 //OS.DisableMenuItem (handle, cast(short)0);
809 } 809 }
810 } 810 }
811 811
812 /** 812 /**
813 * Sets the location of the receiver, which must be a popup, 813 * Sets the location of the receiver, which must be a popup,