Mercurial > projects > dwt-mac
diff dwt/widgets/Shell.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 | fba856099f87 |
line wrap: on
line diff
--- a/dwt/widgets/Shell.d Wed Aug 27 14:10:03 2008 +0200 +++ b/dwt/widgets/Shell.d Wed Aug 27 14:30:35 2008 +0200 @@ -142,7 +142,7 @@ /** * Constructs a new instance of this class. This is equivalent - * to calling <code>Shell((Display) null)</code>. + * to calling <code>Shell(cast(Display) null)</code>. * * @exception DWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> @@ -150,13 +150,13 @@ * </ul> */ public this () { - this ((Display) null); + this (cast(Display) null); } /** * Constructs a new instance of this class given only the style * value describing its behavior and appearance. This is equivalent - * to calling <code>Shell((Display) null, style)</code>. + * to calling <code>Shell(cast(Display) null, style)</code>. * <p> * The style value is either one of the style constants defined in * class <code>DWT</code> which is applicable to instances of this @@ -189,7 +189,7 @@ * @see DWT#SYSTEM_MODAL */ public this (int style) { - this ((Display) null, style); + this (cast(Display) null, style); } /** @@ -457,7 +457,7 @@ rect.width = trim.width; rect.height = trim.height; rect = NSWindow.static_frameRectForContentRect_styleMask_(rect, window.styleMask()); - return new Rectangle ((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); + return new Rectangle (cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); } void createHandle () { @@ -466,9 +466,9 @@ view = window.contentView(); return; } else { - SWTWindow swtWindow = (SWTWindow) new SWTWindow ().alloc (); + SWTWindow swtWindow = cast(SWTWindow) new SWTWindow ().alloc (); swtWindow.setTag(jniRef); - window = (NSWindow)swtWindow; + window = cast(NSWindow)swtWindow; NSRect rect = new NSRect(); Monitor monitor = getMonitor (); Rectangle clientArea = monitor.getClientArea (); @@ -492,7 +492,7 @@ createHandle (null); window.setContentView (topView()); - windowDelegate = (SWTWindowDelegate)new SWTWindowDelegate().alloc().init(); + windowDelegate = cast(SWTWindowDelegate)new SWTWindowDelegate().alloc().init(); windowDelegate.setTag(jniRef); window.setDelegate(windowDelegate); } @@ -586,27 +586,27 @@ public int getAlpha () { checkWidget (); - return (int)(window.alphaValue() * 255); + return cast(int)(window.alphaValue() * 255); } public Rectangle getBounds () { checkWidget(); NSRect frame = window.frame (); - return new Rectangle ((int)frame.x, (int) frame.y, (int) frame.width, (int) frame.height); + return new Rectangle (cast(int)frame.x, cast(int) frame.y, cast(int) frame.width, cast(int) frame.height); } public Rectangle getClientArea () { checkWidget(); //TODO why super implementation fails NSRect rect = window.contentRectForFrameRect_(window.frame()); - int width = (int)rect.width, height = (int)rect.height; + int width = cast(int)rect.width, height = cast(int)rect.height; if (scrollView !is null) { NSSize size = new NSSize(); size.width = width; size.height = height; size = NSScrollView.contentSizeForFrameSize(size, (style & DWT.H_SCROLL) !is 0, (style & DWT.V_SCROLL) !is 0, OS.NSNoBorder); - width = (int)size.width; - height = (int)size.height; + width = cast(int)size.width; + height = cast(int)size.height; } return new Rectangle (0, 0, width, height); } @@ -646,7 +646,7 @@ public Point getLocation () { checkWidget(); NSRect frame = window.frame (); - return new Point ((int) frame.x, (int) frame.y); + return new Point (cast(int) frame.x, cast(int) frame.y); } public bool getMaximized () { @@ -683,8 +683,8 @@ // OS.GetWindowStructureWidths (shellHandle, rect); // CGPoint inMinLimits = new CGPoint (), inMaxLimits = new CGPoint (); // OS.GetWindowResizeLimits (shellHandle, inMinLimits, inMaxLimits); -// int width = Math.max (1, (int) inMinLimits.x + (rect.left + rect.right)); -// int height = Math.max (1, (int) inMinLimits.y + (rect.top + rect.bottom)); +// int width = Math.max (1, cast(int) inMinLimits.x + (rect.left + rect.right)); +// int height = Math.max (1, cast(int) inMinLimits.y + (rect.top + rect.bottom)); // return new Point (width, height); return null; } @@ -757,7 +757,7 @@ public Point getSize () { checkWidget(); NSRect frame = window.frame (); - return new Point ((int) frame.width, (int) frame.height); + return new Point (cast(int) frame.width, cast(int) frame.height); } bool hasBorder () { @@ -972,7 +972,7 @@ NSRect rect = new NSRect (); rect.x = x; //TODO - get the screen for the point - int screenHeight = (int) window.screen().frame().height; + int screenHeight = cast(int) window.screen().frame().height; rect.y = screenHeight - y; rect.width = width; rect.height = height; @@ -982,7 +982,7 @@ NSPoint point = new NSPoint(); point.x = x; //TODO - get the screen for the point - int screenHeight = (int) window.screen().frame().height; + int screenHeight = cast(int) window.screen().frame().height; point.y = screenHeight - y; window.setFrameTopLeftPoint (point); } else { @@ -1022,8 +1022,8 @@ // screen.y += rect.top; // } // Rect rect = new Rect (); -// OS.SetRect (rect, (short) screen.x, (short) screen.y, (short) (screen.x + screen.width), (short) (screen.y + screen.height)); -// OS.SetWindowBounds (shellHandle, (short) OS.kWindowStructureRgn, rect); +// OS.SetRect (rect, cast(short) screen.x, cast(short) screen.y, cast(short) (screen.x + screen.width), cast(short) (screen.y + screen.height)); +// OS.SetWindowBounds (shellHandle, cast(short) OS.kWindowStructureRgn, rect); // } else { // int attributes = 0; // if ((style & DWT.RESIZE) !is 0) { @@ -1044,8 +1044,8 @@ // setMaximized (true); // } else { // Rect rect = new Rect (); -// if (normalBounds !is null) OS.SetRect (rect, (short) normalBounds.x, (short) normalBounds.y, (short) (normalBounds.x + normalBounds.width), (short) (normalBounds.y + normalBounds.height)); -// OS.SetWindowBounds (shellHandle, (short) OS.kWindowStructureRgn, rect); +// if (normalBounds !is null) OS.SetRect (rect, cast(short) normalBounds.x, cast(short) normalBounds.y, cast(short) (normalBounds.x + normalBounds.width), cast(short) (normalBounds.y + normalBounds.height)); +// OS.SetWindowBounds (shellHandle, cast(short) OS.kWindowStructureRgn, rect); // } // normalBounds = null; // } @@ -1087,10 +1087,10 @@ // Rect rect = new Rect (); // int gdevice = OS.GetMainDevice (); // OS.GetAvailableWindowPositioningBounds (gdevice, rect); -// pt.h = (short) (rect.right - rect.left); -// pt.v = (short) (rect.bottom - rect.top); +// pt.h = cast(short) (rect.right - rect.left); +// pt.v = cast(short) (rect.bottom - rect.top); // } -// short inPartCode = (short) (maximized ? OS.inZoomOut : OS.inZoomIn); +// short inPartCode = cast(short) (maximized ? OS.inZoomOut : OS.inZoomIn); // OS.ZoomWindowIdeal (shellHandle, inPartCode, pt); } @@ -1193,8 +1193,8 @@ // } else { // if (rgnRect is null) { // rgnRect = new Rect (); -// OS.GetWindowBounds (shellHandle, (short) OS.kWindowStructureRgn, rgnRect); -// OS.SetRect (rgnRect, (short) 0, (short) 0, (short) (rgnRect.right - rgnRect.left), (short) (rgnRect.bottom - rgnRect.top)); +// OS.GetWindowBounds (shellHandle, cast(short) OS.kWindowStructureRgn, rgnRect); +// OS.SetRect (rgnRect, cast(short) 0, cast(short) 0, cast(short) (rgnRect.right - rgnRect.left), cast(short) (rgnRect.bottom - rgnRect.top)); // } // } // this.region = region; @@ -1288,7 +1288,7 @@ isActive = true; break; } - current = (Shell) current.parent; + current = cast(Shell) current.parent; } if (!isActive) return; // if (fullScreen) {