Mercurial > projects > dwt-addons
diff dwtx/ui/internal/forms/widgets/SWTUtil.d @ 77:26c6c9dfd13c
ui.forms compile, just FormTextModel with xml reimpl left todo
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 24 May 2008 06:59:31 +0200 |
parents | 5d489b9f966c |
children |
line wrap: on
line diff
--- a/dwtx/ui/internal/forms/widgets/SWTUtil.d Sat May 24 06:18:55 2008 +0200 +++ b/dwtx/ui/internal/forms/widgets/SWTUtil.d Sat May 24 06:59:31 2008 +0200 @@ -22,7 +22,7 @@ import dwt.widgets.Widget; /** - * Utility class to simplify access to some DWT resources. + * Utility class to simplify access to some DWT resources. */ public class SWTUtil { @@ -42,22 +42,22 @@ /** * Returns the shell for the given widget. If the widget doesn't represent * a DWT object that manage a shell, <code>null</code> is returned. - * + * * @return the shell for the given widget */ public static Shell getShell(Widget widget) { - if (widget instanceof Control) - return ((Control) widget).getShell(); - if (widget instanceof Caret) - return ((Caret) widget).getParent().getShell(); - if (widget instanceof DragSource) - return ((DragSource) widget).getControl().getShell(); - if (widget instanceof DropTarget) - return ((DropTarget) widget).getControl().getShell(); - if (widget instanceof Menu) - return ((Menu) widget).getParent().getShell(); - if (widget instanceof ScrollBar) - return ((ScrollBar) widget).getParent().getShell(); + if (null !is cast(Control)widget ) + return (cast(Control) widget).getShell(); + if (null !is cast(Caret)widget ) + return (cast(Caret) widget).getParent().getShell(); + if (null !is cast(DragSource)widget ) + return (cast(DragSource) widget).getControl().getShell(); + if (null !is cast(DropTarget)widget ) + return (cast(DropTarget) widget).getControl().getShell(); + if (null !is cast(Menu)widget ) + return (cast(Menu) widget).getParent().getShell(); + if (null !is cast(ScrollBar)widget ) + return (cast(ScrollBar) widget).getParent().getShell(); return null; }