Mercurial > projects > dwt-mac
diff dwt/widgets/TrayItem.d @ 37:642f460a0908
Fixed a lot of compile errors, a "hello world" app compiles now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Fri, 10 Oct 2008 12:29:48 +0200 |
parents | db5a898b2119 |
children | d8635bb48c7c |
line wrap: on
line diff
--- a/dwt/widgets/TrayItem.d Tue Oct 07 12:56:18 2008 +0200 +++ b/dwt/widgets/TrayItem.d Fri Oct 10 12:29:48 2008 +0200 @@ -7,6 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.widgets.TrayItem; @@ -29,7 +32,7 @@ import dwt.internal.cocoa.SWTImageView; import dwt.dwthelper.utils; - +import dwt.internal.cocoa.NSView; import dwt.widgets.Item; import dwt.widgets.ToolTip; import dwt.widgets.Tray; @@ -168,7 +171,7 @@ if (item is null) error (DWT.ERROR_NO_HANDLES); item.retain(); item.setHighlightMode(true); - NSRect rect = new NSRect(); + NSRect rect = NSRect(); view = cast(NSImageView)(new SWTImageView()).alloc(); if (view is null) error (DWT.ERROR_NO_HANDLES); view.initWithFrame(rect); @@ -185,7 +188,7 @@ Point getLocation () { NSRect rect = view.frame(); NSRect windowRect = view.window().frame(); - NSPoint pt = new NSPoint(); + NSPoint pt = NSPoint(); pt.x = rect.width / 2; pt.y = rect.height; pt = view.convertPoint_fromView_(pt, null); @@ -429,14 +432,14 @@ _setToolTipText (toolTipText); } -void mouseDown(int event) { +void mouseDown(objc.id event) { NSEvent nsEvent = new NSEvent(event); int mask = nsEvent.modifierFlags() & OS.NSDeviceIndependentModifierFlagsMask; if (mask is OS.NSControlKeyMask) { showMenu(); } else { highlight = true; - view.setNeedsDisplay(true); + (cast(NSView)view).setNeedsDisplay(true); int clickCount = nsEvent.clickCount(); postEvent(clickCount is 2 ? DWT.DefaultSelection : DWT.Selection); } @@ -444,14 +447,14 @@ void mouseUp(int event) { highlight = false; - view.setNeedsDisplay(true); + (cast(NSView)view).setNeedsDisplay(true); } void rightMouseDown(int event) { showMenu(); } -void drawRect(int id, NSRect rect) { +void drawRect(objc.id id, NSRect rect) { item.drawStatusBarBackgroundInRect(rect, highlight); super.drawRect(id, rect); }