comparison dwt/widgets/Tracker.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 d8635bb48c7c
comparison
equal deleted inserted replaced
6:b903c16b6f48 7:e831403a80a9
440 } else { 440 } else {
441 NSWindow eventWindow = nsEvent.window(); 441 NSWindow eventWindow = nsEvent.window();
442 location = eventWindow.convertBaseToScreen(location); 442 location = eventWindow.convertBaseToScreen(location);
443 location.y = eventWindow.screen().frame().height - location.y; 443 location.y = eventWindow.screen().frame().height - location.y;
444 } 444 }
445 int newX = (int)location.x, newY = (int)location.y; 445 int newX = cast(int)location.x, newY = cast(int)location.y;
446 if (newX !is oldX || newY !is oldY) { 446 if (newX !is oldX || newY !is oldY) {
447 Rectangle [] oldRectangles = rectangles; 447 Rectangle [] oldRectangles = rectangles;
448 Rectangle [] rectsToErase = new Rectangle [rectangles.length]; 448 Rectangle [] rectsToErase = new Rectangle [rectangles.length];
449 for (int i = 0; i < rectangles.length; i++) { 449 for (int i = 0; i < rectangles.length; i++) {
450 Rectangle current = rectangles [i]; 450 Rectangle current = rectangles [i];
713 */ 713 */
714 public bool open () { 714 public bool open () {
715 checkWidget (); 715 checkWidget ();
716 cancelled = false; 716 cancelled = false;
717 tracking = true; 717 tracking = true;
718 window = (NSWindow)new NSWindow().alloc(); 718 window = cast(NSWindow)new NSWindow().alloc();
719 NSRect frame = NSScreen.mainScreen().frame(); 719 NSRect frame = NSScreen.mainScreen().frame();
720 window = window.initWithContentRect_styleMask_backing_defer_(frame, OS.NSBorderlessWindowMask, OS.NSBackingStoreBuffered, false); 720 window = window.initWithContentRect_styleMask_backing_defer_(frame, OS.NSBorderlessWindowMask, OS.NSBackingStoreBuffered, false);
721 window.setOpaque(false); 721 window.setOpaque(false);
722 window.setContentView(null); 722 window.setContentView(null);
723 NSGraphicsContext context = window.graphicsContext(); 723 NSGraphicsContext context = window.graphicsContext();
765 oldY = cursorPos.y; 765 oldY = cursorPos.y;
766 } 766 }
767 767
768 /* Tracker behaves like a Dialog with its own OS event loop. */ 768 /* Tracker behaves like a Dialog with its own OS event loop. */
769 while (tracking && !cancelled) { 769 while (tracking && !cancelled) {
770 NSAutoreleasePool pool = (NSAutoreleasePool)new NSAutoreleasePool().alloc().init(); 770 NSAutoreleasePool pool = cast(NSAutoreleasePool)new NSAutoreleasePool().alloc().init();
771 NSEvent event = application.nextEventMatchingMask(0, NSDate.distantFuture(), OS.NSDefaultRunLoopMode, true); 771 NSEvent event = application.nextEventMatchingMask(0, NSDate.distantFuture(), OS.NSDefaultRunLoopMode, true);
772 if (event is null) continue; 772 if (event is null) continue;
773 int type = event.type(); 773 int type = event.type();
774 switch (type) { 774 switch (type) {
775 case OS.NSLeftMouseUp: 775 case OS.NSLeftMouseUp: