diff dwt/internal/cocoa/NSRunLoop.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSRunLoop.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSRunLoop.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,127 +1,52 @@
 /*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- *     IBM Corporation - initial API and implementation
+ *    IBM Corporation - initial API and implementation
  *     
  * Port to the D programming language:
- *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *    Jacob Carlborg <doob@me.com>
  *******************************************************************************/
 module dwt.internal.cocoa.NSRunLoop;
 
-import dwt.internal.cocoa.CFRunLoopRef;
-import dwt.internal.cocoa.id;
-import dwt.internal.cocoa.NSArray;
+import dwt.dwthelper.utils;
+import cocoa = dwt.internal.cocoa.id;
 import dwt.internal.cocoa.NSDate;
-import dwt.internal.cocoa.NSInteger;
 import dwt.internal.cocoa.NSObject;
-import dwt.internal.cocoa.NSPort;
 import dwt.internal.cocoa.NSString;
-import dwt.internal.cocoa.NSTimer;
 import dwt.internal.cocoa.OS;
 import objc = dwt.internal.objc.runtime;
 
-public class NSRunLoop : NSObject
-{
-
-    public this ()
-    {
-        super();
-    }
+public class NSRunLoop : NSObject {
 
-    public this (objc.id id)
-    {
-        super(id);
-    }
-
-    public void acceptInputForMode (NSString mode, NSDate limitDate)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_acceptInputForMode_1beforeDate_1, mode !is null ? mode.id_ : null, limitDate !is null ? limitDate.id_ : null);
-    }
+public this() {
+    super();
+}
 
-    public void addPort (NSPort aPort, NSString mode)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_addPort_1forMode_1, aPort !is null ? aPort.id_ : null, mode !is null ? mode.id_ : null);
-    }
-
-    public void addTimer (NSTimer timer, NSString mode)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_addTimer_1forMode_1, timer !is null ? timer.id_ : null, mode !is null ? mode.id_ : null);
-    }
+public this(objc.id id) {
+    super(id);
+}
 
-    public void cancelPerformSelector (objc.SEL aSelector, id target, id arg)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_cancelPerformSelector_1target_1argument_1, aSelector, target !is null ? target.id_ : null,
-                arg !is null ? arg.id_ : null);
-    }
-
-    public void cancelPerformSelectorsWithTarget (id target)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_cancelPerformSelectorsWithTarget_1, target !is null ? target.id_ : null);
-    }
-
-    public void configureAsServer ()
-    {
-        OS.objc_msgSend(this.id_, OS.sel_configureAsServer);
-    }
+public this(cocoa.id id) {
+    super(id);
+}
 
-    public NSString currentMode ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_currentMode);
-        return result !is null ? new NSString(result) : null;
-    }
-
-    public static NSRunLoop currentRunLoop ()
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSRunLoop, OS.sel_currentRunLoop);
-        return result !is null ? new NSRunLoop(result) : null;
-    }
-
-    public CFRunLoopRef getCFRunLoop ()
-    {
-        return cast(CFRunLoopRef) OS.objc_msgSend(this.id_, OS.sel_getCFRunLoop);
-    }
-
-    public NSDate limitDateForMode (NSString mode)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_limitDateForMode_1, mode !is null ? mode.id_ : null);
-        return result !is null ? new NSDate(result) : null;
-    }
+public static NSRunLoop currentRunLoop() {
+    objc.id result = OS.objc_msgSend(OS.class_NSRunLoop, OS.sel_currentRunLoop);
+    return result !is null ? new NSRunLoop(result) : null;
+}
 
-    public static NSRunLoop mainRunLoop ()
-    {
-        objc.id result = OS.objc_msgSend(OS.class_NSRunLoop, OS.sel_mainRunLoop);
-        return result !is null ? new NSRunLoop(result) : null;
-    }
-
-    public void performSelector (objc.SEL aSelector, id target, id arg, NSUInteger order, NSArray modes)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_performSelector_1target_1argument_1order_1modes_1, aSelector, target !is null ? target.id_ : null,
-                arg !is null ? arg.id_ : null, order, modes !is null ? modes.id_ : null);
-    }
+public static NSRunLoop mainRunLoop() {
+    objc.id result = OS.objc_msgSend(OS.class_NSRunLoop, OS.sel_mainRunLoop);
+    return result !is null ? new NSRunLoop(result) : null;
+}
 
-    public void removePort (NSPort aPort, NSString mode)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_removePort_1forMode_1, aPort !is null ? aPort.id_ : null, mode !is null ? mode.id_ : null);
-    }
-
-    public void run ()
-    {
-        OS.objc_msgSend(this.id_, OS.sel_run);
-    }
-
-    public bool runMode (NSString mode, NSDate limitDate)
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_runMode_1beforeDate_1, mode !is null ? mode.id_ : null, limitDate !is null ? limitDate.id_ : null) !is null;
-    }
-
-    public void runUntilDate (NSDate limitDate)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_runUntilDate_1, limitDate !is null ? limitDate.id_ : null);
-    }
+public bool runMode(NSString mode, NSDate limitDate) {
+    return OS.objc_msgSend_bool(this.id, OS.sel_runMode_beforeDate_, mode !is null ? mode.id : null, limitDate !is null ? limitDate.id : null);
+}
 
 }