comparison dwt/custom/ScrolledComposite.d @ 8:a9ab4c738ed8

Fix: instanceof
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 14:32:39 +0200
parents e831403a80a9
children 6337764516f1
comparison
equal deleted inserted replaced
7:e831403a80a9 8:a9ab4c738ed8
168 } 168 }
169 }; 169 };
170 170
171 filter = new Listener() { 171 filter = new Listener() {
172 public void handleEvent(Event event) { 172 public void handleEvent(Event event) {
173 if (event.widget instanceof Control) { 173 if ( null !is cast(Control)event.widget ) {
174 Control control = cast(Control) event.widget; 174 Control control = cast(Control) event.widget;
175 if (contains(control)) showControl(control); 175 if (contains(control)) showControl(control);
176 } 176 }
177 } 177 }
178 }; 178 };
191 191
192 bool contains(Control control) { 192 bool contains(Control control) {
193 if (control is null || control.isDisposed()) return false; 193 if (control is null || control.isDisposed()) return false;
194 194
195 Composite parent = control.getParent(); 195 Composite parent = control.getParent();
196 while (parent !is null && !(parent instanceof Shell)) { 196 while (parent !is null && !( null !is cast(Shell)parent )) {
197 if (this is parent) return true; 197 if (this is parent) return true;
198 parent = parent.getParent(); 198 parent = parent.getParent();
199 } 199 }
200 return false; 200 return false;
201 } 201 }