comparison dwtx/draw2d/text/AbstractFlowBorder.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
comparison
equal deleted inserted replaced
96:b492ba44e44d 98:95307ad235d9
1 /*******************************************************************************
2 * Copyright (c) 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 dwtx.draw2d.text.AbstractFlowBorder;
14
15 import dwt.dwthelper.utils;
16
17 import dwtx.draw2d.AbstractBorder;
18 import dwtx.draw2d.Border;
19 import dwtx.draw2d.Graphics;
20 import dwtx.draw2d.IFigure;
21 import dwtx.draw2d.geometry.Insets;
22 import dwtx.draw2d.geometry.Rectangle;
23 import dwtx.draw2d.text.FlowBorder;
24 import dwtx.draw2d.text.FlowFigure;
25
26 /**
27 * A basis for implementing {@link FlowBorder}. Subclassing this class will possibly
28 * guarantee compatibility with future changes to the FlowBorder interface. This class
29 * also returns default values for many of the required methods as a convenience.
30 * @since 3.1
31 */
32 public abstract class AbstractFlowBorder
33 : AbstractBorder
34 , FlowBorder
35 {
36 /**
37 * @see FlowBorder#getBottomMargin()
38 */
39 public int getBottomMargin() {
40 return 0;
41 }
42
43 /**
44 * @see Border#getInsets(IFigure)
45 */
46 public Insets getInsets(IFigure figure) {
47 return IFigure_NO_INSETS;
48 }
49
50 /**
51 * @see FlowBorder#getLeftMargin()
52 */
53 public int getLeftMargin() {
54 return 0;
55 }
56
57 /**
58 * @see FlowBorder#getRightMargin()
59 */
60 public int getRightMargin() {
61 return 0;
62 }
63
64 /**
65 * @see FlowBorder#getTopMargin()
66 */
67 public int getTopMargin() {
68 return 0;
69 }
70
71 /**
72 * This method is not called on FlowBorders. For this reason it is
73 * implemented here and made <code>final</code> so that clients override the correct
74 * method.
75 * @param figure the figure
76 * @param graphics the graphics
77 * @param insets the insets
78 * @see FlowBorder#paint(FlowFigure, Graphics, Rectangle, int)
79 */
80 public final void paint(IFigure figure, Graphics graphics, Insets insets) { }
81
82 /**
83 * Subclasses should override this method to paint each box's border.
84 * @see FlowBorder#paint(FlowFigure, Graphics, Rectangle, int)
85 */
86 public void paint(FlowFigure figure, Graphics g, Rectangle where, int sides) { }
87
88 }