diff dwtx/draw2d/AbstractBackground.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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/draw2d/AbstractBackground.d	Sun Aug 03 00:52:14 2008 +0200
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.AbstractBackground;
+
+import dwt.dwthelper.utils;
+
+import dwtx.draw2d.geometry.Insets;
+import dwtx.draw2d.AbstractBorder;
+import dwtx.draw2d.IFigure;
+import dwtx.draw2d.Graphics;
+
+/**
+ * A special border which can paint both underneath and on top of a Figure.
+ * Normal borders only paint on top of a figure and its children. A background
+ * has the opportunity to paint both first, and optionally last.
+ * <P>
+ * WARNING: Experimental for 3.3. Clients should help validate the use cases
+ * of this new function.
+ * @since 3.3
+ */
+public class AbstractBackground : AbstractBorder {
+
+    /**
+     * {@inheritDoc}
+     */
+    public Insets getInsets(IFigure figure) {
+        return IFigure_NO_INSETS;
+    }
+
+    /**
+     * {@inheritDoc}
+     * By default, this method is stubbed out for backgrounds which only paint
+     * underneath a figure.
+     */
+    public void paint(IFigure figure, Graphics graphics, Insets insets) {
+    }
+
+    /**
+     * Called when this Background should paint. If the background is being painted
+     * inside another border or background, the insets indicate how far inside the
+     * target figure the background should be painted. In most cases, the insets
+     * will be all zero.
+     * @param figure The figure on which the background is being painted
+     * @param graphics The graphics
+     * @param insets Amount to inset from the figure's bounds
+     * @since 3.2
+     */
+    public void paintBackground(IFigure figure, Graphics graphics, Insets insets) {
+    }
+
+}