Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSThread.d @ 1:8b48be5454ce
The internal cocoa classes compile now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Tue, 19 Aug 2008 17:35:17 +0200 |
parents | 380af2bdd8e5 |
children | f565d3a95c0a |
comparison
equal
deleted
inserted
replaced
0:380af2bdd8e5 | 1:8b48be5454ce |
---|---|
42 return result !is null ? new NSArray(result) : null; | 42 return result !is null ? new NSArray(result) : null; |
43 } | 43 } |
44 | 44 |
45 public void cancel () | 45 public void cancel () |
46 { | 46 { |
47 OS.objc_msgSend(this.id, OS.sel_cancel); | 47 OS.objc_msgSend(this.id_, OS.sel_cancel); |
48 } | 48 } |
49 | 49 |
50 public static NSThread currentThread () | 50 public static NSThread currentThread () |
51 { | 51 { |
52 objc.id result = OS.objc_msgSend(OS.class_NSThread, OS.sel_currentThread); | 52 objc.id result = OS.objc_msgSend(OS.class_NSThread, OS.sel_currentThread); |
53 return result !is null ? new NSThread(result) : null; | 53 return result !is null ? new NSThread(result) : null; |
54 } | 54 } |
55 | 55 |
56 public static void detachNewThreadSelector (objc.SEL selector, id target, id argument) | 56 public static void detachNewThreadSelector (objc.SEL selector, id target, id argument) |
57 { | 57 { |
58 OS.objc_msgSend(OS.class_NSThread, OS.sel_detachNewThreadSelector_1toTarget_1withObject_1, selector, target !is null ? target.id : null, | 58 OS.objc_msgSend(OS.class_NSThread, OS.sel_detachNewThreadSelector_1toTarget_1withObject_1, selector, target !is null ? target.id_ : null, |
59 argument !is null ? argument.id : null); | 59 argument !is null ? argument.id_ : null); |
60 } | 60 } |
61 | 61 |
62 public static void exit () | 62 public static void exit () |
63 { | 63 { |
64 OS.objc_msgSend(OS.class_NSThread, OS.sel_exit); | 64 OS.objc_msgSend(OS.class_NSThread, OS.sel_exit); |
65 } | 65 } |
66 | 66 |
67 public id initWithTarget (id target, objc.SEL selector, id argument) | 67 public id initWithTarget (id target, objc.SEL selector, id argument) |
68 { | 68 { |
69 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithTarget_1selector_1object_1, target !is null ? target.id : null, selector, | 69 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithTarget_1selector_1object_1, target !is null ? target.id_ : null, selector, |
70 argument !is null ? argument.id : null); | 70 argument !is null ? argument.id_ : null); |
71 return result !is null ? new id(result) : null; | 71 return result !is null ? new id(result) : null; |
72 } | 72 } |
73 | 73 |
74 public bool isCancelled () | 74 public bool isCancelled () |
75 { | 75 { |
76 return OS.objc_msgSend(this.id, OS.sel_isCancelled) !is null; | 76 return OS.objc_msgSend(this.id_, OS.sel_isCancelled) !is null; |
77 } | 77 } |
78 | 78 |
79 public bool isExecuting () | 79 public bool isExecuting () |
80 { | 80 { |
81 return OS.objc_msgSend(this.id, OS.sel_isExecuting) !is null; | 81 return OS.objc_msgSend(this.id_, OS.sel_isExecuting) !is null; |
82 } | 82 } |
83 | 83 |
84 public bool isFinished () | 84 public bool isFinished () |
85 { | 85 { |
86 return OS.objc_msgSend(this.id, OS.sel_isFinished) !is null; | 86 return OS.objc_msgSend(this.id_, OS.sel_isFinished) !is null; |
87 } | 87 } |
88 | 88 |
89 public static bool static_isMainThread () | 89 public static bool static_isMainThread () |
90 { | 90 { |
91 return OS.objc_msgSend(OS.class_NSThread, OS.sel_isMainThread) !is null; | 91 return OS.objc_msgSend(OS.class_NSThread, OS.sel_isMainThread) !is null; |
92 } | 92 } |
93 | 93 |
94 public bool isMainThread () | 94 public bool isMainThread () |
95 { | 95 { |
96 return OS.objc_msgSend(this.id, OS.sel_isMainThread) !is null; | 96 return OS.objc_msgSend(this.id_, OS.sel_isMainThread) !is null; |
97 } | 97 } |
98 | 98 |
99 public static bool isMultiThreaded () | 99 public static bool isMultiThreaded () |
100 { | 100 { |
101 return OS.objc_msgSend(OS.class_NSThread, OS.sel_isMultiThreaded) !is null; | 101 return OS.objc_msgSend(OS.class_NSThread, OS.sel_isMultiThreaded) !is null; |
102 } | 102 } |
103 | 103 |
104 public void main () | 104 public void main () |
105 { | 105 { |
106 OS.objc_msgSend(this.id, OS.sel_main); | 106 OS.objc_msgSend(this.id_, OS.sel_main); |
107 } | 107 } |
108 | 108 |
109 public static NSThread mainThread () | 109 public static NSThread mainThread () |
110 { | 110 { |
111 objc.id result = OS.objc_msgSend(OS.class_NSThread, OS.sel_mainThread); | 111 objc.id result = OS.objc_msgSend(OS.class_NSThread, OS.sel_mainThread); |
112 return result !is null ? new NSThread(result) : null; | 112 return result !is null ? new NSThread(result) : null; |
113 } | 113 } |
114 | 114 |
115 public NSString name () | 115 public NSString name () |
116 { | 116 { |
117 objc.id result = OS.objc_msgSend(this.id, OS.sel_name); | 117 objc.id result = OS.objc_msgSend(this.id_, OS.sel_name); |
118 return result !is null ? new NSString(result) : null; | 118 return result !is null ? new NSString(result) : null; |
119 } | 119 } |
120 | 120 |
121 public void setName (NSString n) | 121 public void setName (NSString n) |
122 { | 122 { |
123 OS.objc_msgSend(this.id, OS.sel_setName_1, n !is null ? n.id : null); | 123 OS.objc_msgSend(this.id_, OS.sel_setName_1, n !is null ? n.id_ : null); |
124 } | 124 } |
125 | 125 |
126 public void setStackSize (NSUInteger s) | 126 public void setStackSize (NSUInteger s) |
127 { | 127 { |
128 OS.objc_msgSend(this.id, OS.sel_setStackSize_1, s); | 128 OS.objc_msgSend(this.id_, OS.sel_setStackSize_1, s); |
129 } | 129 } |
130 | 130 |
131 public static bool setThreadPriority (double p) | 131 public static bool setThreadPriority (double p) |
132 { | 132 { |
133 return OS.objc_msgSend(OS.class_NSThread, OS.sel_setThreadPriority_1, p) !is null; | 133 return OS.objc_msgSend(OS.class_NSThread, OS.sel_setThreadPriority_1, p) !is null; |
138 OS.objc_msgSend(OS.class_NSThread, OS.sel_sleepForTimeInterval_1, ti); | 138 OS.objc_msgSend(OS.class_NSThread, OS.sel_sleepForTimeInterval_1, ti); |
139 } | 139 } |
140 | 140 |
141 public static void sleepUntilDate (NSDate date) | 141 public static void sleepUntilDate (NSDate date) |
142 { | 142 { |
143 OS.objc_msgSend(OS.class_NSThread, OS.sel_sleepUntilDate_1, date !is null ? date.id : null); | 143 OS.objc_msgSend(OS.class_NSThread, OS.sel_sleepUntilDate_1, date !is null ? date.id_ : null); |
144 } | 144 } |
145 | 145 |
146 public NSUInteger stackSize () | 146 public NSUInteger stackSize () |
147 { | 147 { |
148 return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_stackSize); | 148 return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_stackSize); |
149 } | 149 } |
150 | 150 |
151 public void start () | 151 public void start () |
152 { | 152 { |
153 OS.objc_msgSend(this.id, OS.sel_start); | 153 OS.objc_msgSend(this.id_, OS.sel_start); |
154 } | 154 } |
155 | 155 |
156 public NSMutableDictionary threadDictionary () | 156 public NSMutableDictionary threadDictionary () |
157 { | 157 { |
158 objc.id result = OS.objc_msgSend(this.id, OS.sel_threadDictionary); | 158 objc.id result = OS.objc_msgSend(this.id_, OS.sel_threadDictionary); |
159 return result !is null ? new NSMutableDictionary(result) : null; | 159 return result !is null ? new NSMutableDictionary(result) : null; |
160 } | 160 } |
161 | 161 |
162 public static double threadPriority () | 162 public static double threadPriority () |
163 { | 163 { |