Mercurial > projects > dwt-addons
view dwtx/jface/window/SameShellProvider.d @ 7:8a302fdb4140
Jface some window and resource classes
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 28 Mar 2008 23:32:40 +0100 |
parents | |
children |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Port to the D programming language: * Frank Benoit <benoit@tionex.de> *******************************************************************************/ module dwtx.jface.window.SameShellProvider; import dwt.widgets.Control; import dwt.widgets.Shell; import dwtx.jface.window.IShellProvider; import dwt.dwthelper.utils; /** * Standard shell provider that always returns the shell containing the given * control. This will always return the correct shell for the control, even if * the control is reparented. * * @since 3.1 */ public class SameShellProvider : IShellProvider { private Control targetControl; /** * Returns a shell provider that always returns the current * shell for the given control. * * @param targetControl control whose shell will be tracked, or null if getShell() should always * return null */ public this(Control targetControl) { this.targetControl = targetControl; } /* (non-javadoc) * @see IShellProvider#getShell() */ public Shell getShell() { if ( auto res = cast(Shell)targetControl ) { return res; } return targetControl is null? null :targetControl.getShell(); } }