Mercurial > projects > dwt2
comparison org.eclipse.draw2d/src/org/eclipse/draw2d/Border.d @ 12:bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 14 Mar 2009 18:23:29 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
11:43904fec5dca | 12:bc29606a740c |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2005 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module org.eclipse.draw2d.Border; | |
14 | |
15 import java.lang.all; | |
16 | |
17 import org.eclipse.draw2d.geometry.Dimension; | |
18 import org.eclipse.draw2d.geometry.Insets; | |
19 import org.eclipse.draw2d.geometry.Rectangle; | |
20 import org.eclipse.draw2d.IFigure; | |
21 import org.eclipse.draw2d.Graphics; | |
22 | |
23 /** | |
24 * A decoration on a Figure. A border may paint itself within the bounds of a figure, and | |
25 * it may provide Insets which can affect how the figures children are posiiton and | |
26 * painted. | |
27 * <P> | |
28 * A border instance may be used with multiple figure instances. | |
29 */ | |
30 public interface Border { | |
31 | |
32 /** | |
33 * Returns the Insets for this Border for the given Figure. | |
34 * @param figure The figure this border belongs to | |
35 * @return The insets | |
36 */ | |
37 Insets getInsets(IFigure figure); | |
38 | |
39 /** | |
40 * Returns the preferred width and height that this border would like to display itself | |
41 * properly. | |
42 * @param figure The figure | |
43 * @return The preferred size | |
44 */ | |
45 Dimension getPreferredSize(IFigure figure); | |
46 | |
47 /** | |
48 * Returns <code>true</code> if the Border completely fills the region defined in | |
49 * {@link #paint(IFigure, Graphics, Insets)}. | |
50 * @return <code>true</code> if this border is opaque | |
51 */ | |
52 bool isOpaque(); | |
53 | |
54 /** | |
55 * Paints the border. The border should paint inside figure's {@link IFigure#getBounds()}, | |
56 * inset by the parameter <i>insets</i>. The border generally should not paint inside its | |
57 * own insets. More specifically, Border <i>b</i> should paint inside the rectangle: | |
58 * figure.getBounds().getCropped(insets) and outside of the rectangle: | |
59 * figure.getBounds().getCropped(insets).getCropped(getInsets()) where <i>inside</i> is | |
60 * defined as {@link Rectangle#contains(int, int)}. | |
61 * | |
62 * @param figure The figure this border belongs to | |
63 * @param graphics The graphics object used for painting | |
64 * @param insets The insets | |
65 */ | |
66 void paint(IFigure figure, Graphics graphics, Insets insets); | |
67 | |
68 | |
69 } |