comparison dwt/widgets/Display.d @ 8:a9ab4c738ed8

Fix: instanceof
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 14:32:39 +0200
parents e831403a80a9
children 5b53d338c709
comparison
equal deleted inserted replaced
7:e831403a80a9 8:a9ab4c738ed8
767 checkDevice (); 767 checkDevice ();
768 if (handle !is 0 && OS.objc_msgSend(handle, OS.sel_respondsToSelector_1, OS.sel_tag) !is 0) { 768 if (handle !is 0 && OS.objc_msgSend(handle, OS.sel_respondsToSelector_1, OS.sel_tag) !is 0) {
769 int tag = OS.objc_msgSend(handle, OS.sel_tag); 769 int tag = OS.objc_msgSend(handle, OS.sel_tag);
770 if (tag !is -1) { 770 if (tag !is -1) {
771 Object object = OS.JNIGetObject(tag); 771 Object object = OS.JNIGetObject(tag);
772 if (object instanceof Widget) { 772 if ( null !is cast(Widget)object ) {
773 return cast(Widget)object; 773 return cast(Widget)object;
774 } 774 }
775 } 775 }
776 } 776 }
777 return null; 777 return null;
867 NSView view = window.contentView(); 867 NSView view = window.contentView();
868 if (view !is null && view.respondsToSelector(OS.sel_tag)) { 868 if (view !is null && view.respondsToSelector(OS.sel_tag)) {
869 int tag = OS.objc_msgSend(view.id, OS.sel_tag); 869 int tag = OS.objc_msgSend(view.id, OS.sel_tag);
870 if (tag !is -1) { 870 if (tag !is -1) {
871 Object object = OS.JNIGetObject(tag); 871 Object object = OS.JNIGetObject(tag);
872 if (object instanceof Shell) { 872 if ( null !is cast(Shell)object ) {
873 return cast(Shell)object; 873 return cast(Shell)object;
874 } 874 }
875 } 875 }
876 } 876 }
877 } 877 }
1117 NSResponder view = window.firstResponder(); 1117 NSResponder view = window.firstResponder();
1118 if (view !is null && view.respondsToSelector(OS.sel_tag)) { 1118 if (view !is null && view.respondsToSelector(OS.sel_tag)) {
1119 int tag = OS.objc_msgSend(view.id, OS.sel_tag); 1119 int tag = OS.objc_msgSend(view.id, OS.sel_tag);
1120 if (tag !is -1) { 1120 if (tag !is -1) {
1121 Object object = OS.JNIGetObject(tag); 1121 Object object = OS.JNIGetObject(tag);
1122 if (object instanceof Control) { 1122 if ( null !is cast(Control)object ) {
1123 //TODO go up hierarchy 1123 //TODO go up hierarchy
1124 return cast(Control)object; 1124 return cast(Control)object;
1125 } 1125 }
1126 } else { 1126 } else {
1127 /* 1127 /*
1136 NSObject delegate = new NSObject(delegateId.id); 1136 NSObject delegate = new NSObject(delegateId.id);
1137 if (delegate.respondsToSelector(OS.sel_tag)) { 1137 if (delegate.respondsToSelector(OS.sel_tag)) {
1138 tag = OS.objc_msgSend(delegate.id, OS.sel_tag); 1138 tag = OS.objc_msgSend(delegate.id, OS.sel_tag);
1139 if (tag !is 0 && tag !is -1) { 1139 if (tag !is 0 && tag !is -1) {
1140 Object object = OS.JNIGetObject(tag); 1140 Object object = OS.JNIGetObject(tag);
1141 if (object instanceof Control) { 1141 if ( null !is cast(Control)object ) {
1142 return cast(Control)object; 1142 return cast(Control)object;
1143 } 1143 }
1144 } 1144 }
1145 } 1145 }
1146 } 1146 }
1330 NSView view = window.contentView(); 1330 NSView view = window.contentView();
1331 if (view !is null) { 1331 if (view !is null) {
1332 int jniRef = OS.objc_msgSend(view.id, OS.sel_tag); 1332 int jniRef = OS.objc_msgSend(view.id, OS.sel_tag);
1333 if (jniRef !is 0 && jniRef !is -1) { 1333 if (jniRef !is 0 && jniRef !is -1) {
1334 Object object = OS.JNIGetObject(jniRef); 1334 Object object = OS.JNIGetObject(jniRef);
1335 if (object instanceof Shell) { 1335 if ( null !is cast(Shell)object ) {
1336 result[index++] = cast(Shell)object; 1336 result[index++] = cast(Shell)object;
1337 } 1337 }
1338 } 1338 }
1339 } 1339 }
1340 } 1340 }
3112 FontDialog dialog = cast(FontDialog)OS.JNIGetObject(jniRef); 3112 FontDialog dialog = cast(FontDialog)OS.JNIGetObject(jniRef);
3113 if (dialog is null) return 0; 3113 if (dialog is null) return 0;
3114 dialog.changeFont(arg0); 3114 dialog.changeFont(arg0);
3115 } else if (sel is OS.sel_windowWillClose_1) { 3115 } else if (sel is OS.sel_windowWillClose_1) {
3116 Object object = OS.JNIGetObject(jniRef); 3116 Object object = OS.JNIGetObject(jniRef);
3117 if (object instanceof FontDialog) { 3117 if ( null !is cast(FontDialog)object ) {
3118 (cast(FontDialog)object).windowWillClose(arg0); 3118 (cast(FontDialog)object).windowWillClose(arg0);
3119 } else if (object instanceof ColorDialog) { 3119 } else if ( null !is cast(ColorDialog)object ) {
3120 (cast(ColorDialog)object).windowWillClose(arg0); 3120 (cast(ColorDialog)object).windowWillClose(arg0);
3121 } 3121 }
3122 } 3122 }
3123 return 0; 3123 return 0;
3124 } 3124 }