comparison dwt/widgets/Control.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
653 return display.getSystemColor (DWT.COLOR_WIDGET_BACKGROUND); 653 return display.getSystemColor (DWT.COLOR_WIDGET_BACKGROUND);
654 } 654 }
655 655
656 Font defaultFont () { 656 Font defaultFont () {
657 //TODO - Controls only, does this leak? 657 //TODO - Controls only, does this leak?
658 if (view instanceof NSControl) { 658 if ( null !is cast(NSControl)view ) {
659 NSFont nsFont = (cast(NSControl)view).font (); 659 NSFont nsFont = (cast(NSControl)view).font ();
660 if (nsFont !is null) { 660 if (nsFont !is null) {
661 return Font.cocoa_new (display, nsFont); 661 return Font.cocoa_new (display, nsFont);
662 } 662 }
663 } 663 }
804 gc.dispose (); 804 gc.dispose ();
805 } 805 }
806 806
807 void enableWidget (bool enabled) { 807 void enableWidget (bool enabled) {
808 //TODO - other views 808 //TODO - other views
809 if (view instanceof NSControl) { 809 if ( null !is cast(NSControl)view ) {
810 (cast(NSControl)view).setEnabled(enabled); 810 (cast(NSControl)view).setEnabled(enabled);
811 } 811 }
812 } 812 }
813 813
814 Cursor findCursor () { 814 Cursor findCursor () {
1358 bool isEnabledCursor () { 1358 bool isEnabledCursor () {
1359 return isEnabled (); 1359 return isEnabled ();
1360 } 1360 }
1361 1361
1362 bool isFocusAncestor (Control control) { 1362 bool isFocusAncestor (Control control) {
1363 while (control !is null && control !is this && !(control instanceof Shell)) { 1363 while (control !is null && control !is this && !( null !is cast(Shell)control )) {
1364 control = control.parent; 1364 control = control.parent;
1365 } 1365 }
1366 return control is this; 1366 return control is this;
1367 } 1367 }
1368 1368
2564 setFont (font !is null ? font.handle : defaultFont().handle); 2564 setFont (font !is null ? font.handle : defaultFont().handle);
2565 } 2565 }
2566 2566
2567 void setFont (NSFont font) { 2567 void setFont (NSFont font) {
2568 //TODO - bad cast 2568 //TODO - bad cast
2569 if (view instanceof NSControl) { 2569 if ( null !is cast(NSControl)view ) {
2570 (cast(NSControl)view).setFont(font); 2570 (cast(NSControl)view).setFont(font);
2571 } 2571 }
2572 } 2572 }
2573 2573
2574 /** 2574 /**