Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSRunLoop.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSRunLoop; | |
15 | |
16 import dwt.internal.cocoa.CFRunLoopRef; | |
17 import dwt.internal.cocoa.id; | |
18 import dwt.internal.cocoa.NSArray; | |
19 import dwt.internal.cocoa.NSDate; | |
20 import dwt.internal.cocoa.NSInteger; | |
21 import dwt.internal.cocoa.NSObject; | |
22 import dwt.internal.cocoa.NSPort; | |
23 import dwt.internal.cocoa.NSString; | |
24 import dwt.internal.cocoa.NSTimer; | |
25 import dwt.internal.cocoa.OS; | |
26 import objc = dwt.internal.objc.runtime; | |
27 | |
28 public class NSRunLoop : NSObject | |
29 { | |
30 | |
31 public this () | |
32 { | |
33 super(); | |
34 } | |
35 | |
36 public this (objc.id id) | |
37 { | |
38 super(id); | |
39 } | |
40 | |
41 public void acceptInputForMode (NSString mode, NSDate limitDate) | |
42 { | |
43 OS.objc_msgSend(this.id, OS.sel_acceptInputForMode_1beforeDate_1, mode !is null ? mode.id : null, limitDate !is null ? limitDate.id : null); | |
44 } | |
45 | |
46 public void addPort (NSPort aPort, NSString mode) | |
47 { | |
48 OS.objc_msgSend(this.id, OS.sel_addPort_1forMode_1, aPort !is null ? aPort.id : null, mode !is null ? mode.id : null); | |
49 } | |
50 | |
51 public void addTimer (NSTimer timer, NSString mode) | |
52 { | |
53 OS.objc_msgSend(this.id, OS.sel_addTimer_1forMode_1, timer !is null ? timer.id : null, mode !is null ? mode.id : null); | |
54 } | |
55 | |
56 public void cancelPerformSelector (objc.SEL aSelector, id target, id arg) | |
57 { | |
58 OS.objc_msgSend(this.id, OS.sel_cancelPerformSelector_1target_1argument_1, aSelector, target !is null ? target.id : null, | |
59 arg !is null ? arg.id : null); | |
60 } | |
61 | |
62 public void cancelPerformSelectorsWithTarget (id target) | |
63 { | |
64 OS.objc_msgSend(this.id, OS.sel_cancelPerformSelectorsWithTarget_1, target !is null ? target.id : null); | |
65 } | |
66 | |
67 public void configureAsServer () | |
68 { | |
69 OS.objc_msgSend(this.id, OS.sel_configureAsServer); | |
70 } | |
71 | |
72 public NSString currentMode () | |
73 { | |
74 objc.id result = OS.objc_msgSend(this.id, OS.sel_currentMode); | |
75 return result !is null ? new NSString(result) : null; | |
76 } | |
77 | |
78 public static NSRunLoop currentRunLoop () | |
79 { | |
80 objc.id result = OS.objc_msgSend(OS.class_NSRunLoop, OS.sel_currentRunLoop); | |
81 return result !is null ? new NSRunLoop(result) : null; | |
82 } | |
83 | |
84 public CFRunLoopRef getCFRunLoop () | |
85 { | |
86 return OS.objc_msgSend(this.id, OS.sel_getCFRunLoop); | |
87 } | |
88 | |
89 public NSDate limitDateForMode (NSString mode) | |
90 { | |
91 objc.id result = OS.objc_msgSend(this.id, OS.sel_limitDateForMode_1, mode !is null ? mode.id : null); | |
92 return result !is null ? new NSDate(result) : null; | |
93 } | |
94 | |
95 public static NSRunLoop mainRunLoop () | |
96 { | |
97 objc.id result = OS.objc_msgSend(OS.class_NSRunLoop, OS.sel_mainRunLoop); | |
98 return result !is null ? new NSRunLoop(result) : null; | |
99 } | |
100 | |
101 public void performSelector (objc.SEL aSelector, id target, id arg, NSUInteger order, NSArray modes) | |
102 { | |
103 OS.objc_msgSend(this.id, OS.sel_performSelector_1target_1argument_1order_1modes_1, aSelector, target !is null ? target.id : null, | |
104 arg !is null ? arg.id : null, order, modes !is null ? modes.id : null); | |
105 } | |
106 | |
107 public void removePort (NSPort aPort, NSString mode) | |
108 { | |
109 OS.objc_msgSend(this.id, OS.sel_removePort_1forMode_1, aPort !is null ? aPort.id : null, mode !is null ? mode.id : null); | |
110 } | |
111 | |
112 public void run () | |
113 { | |
114 OS.objc_msgSend(this.id, OS.sel_run); | |
115 } | |
116 | |
117 public bool runMode (NSString mode, NSDate limitDate) | |
118 { | |
119 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; | |
120 } | |
121 | |
122 public void runUntilDate (NSDate limitDate) | |
123 { | |
124 OS.objc_msgSend(this.id, OS.sel_runUntilDate_1, limitDate !is null ? limitDate.id : null); | |
125 } | |
126 | |
127 } |