Mercurial > projects > dwt-addons
view dwtx/draw2d/AbstractBorder.d @ 98:95307ad235d9
Added Draw2d code, still work in progress
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 03 Aug 2008 00:52:14 +0200 |
parents | |
children | 2d6540440fe6 |
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.draw2d.AbstractBorder; import dwt.dwthelper.utils; import dwtx.draw2d.Border; import dwtx.draw2d.IFigure; import dwtx.draw2d.geometry.Dimension; import dwtx.draw2d.geometry.Insets; import dwtx.draw2d.geometry.Rectangle; /** * Provides generic support for borders. * @author hudsonr */ public abstract class AbstractBorder : Border { private static const Dimension EMPTY; /** A temporary Rectangle*/ protected static Rectangle tempRect; static this(){ EMPTY = new Dimension(); tempRect = new Rectangle(); } /** * Returns a temporary rectangle representing the figure's bounds cropped by the specified * insets. This method exists for convenience and performance; the method does not new * any Objects and returns a rectangle which the caller can manipulate. * @since 2.0 * @param figure Figure for which the paintable rectangle is needed * @param insets The insets * @return The paintable region on the Figure f */ protected static final Rectangle getPaintRectangle(IFigure figure, Insets insets) { tempRect.setBounds(figure.getBounds()); return tempRect.crop(insets); } /** * @see dwtx.draw2d.Border#getPreferredSize(IFigure) */ public Dimension getPreferredSize(IFigure f) { return EMPTY; } /** * @see dwtx.draw2d.Border#isOpaque() */ public bool isOpaque() { return false; } }