comparison dwtx/draw2d/text/FlowFigureLayout.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) 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 dwtx.draw2d.text.FlowFigureLayout;
14
15 import dwt.dwthelper.utils;
16
17 import dwtx.draw2d.IFigure;
18 import dwtx.draw2d.LayoutManager;
19 import dwtx.draw2d.geometry.Dimension;
20 import dwtx.draw2d.text.FlowContext;
21 import dwtx.draw2d.text.FlowFigure;
22
23 /**
24 * A LayoutManager for use with FlowFigure.
25 *
26 * <P>WARNING: This class is not intended to be subclassed by clients.
27 * @author hudsonr
28 * @since 2.1
29 */
30 public abstract class FlowFigureLayout
31 : LayoutManager
32 {
33
34 /**
35 * The flow context in which this LayoutManager exists.
36 */
37 private FlowContext context;
38
39 /**
40 * The figure passed by layout(Figure) is held for convenience.
41 */
42 private final FlowFigure flowFigure;
43
44 /**
45 * Constructs a new FlowFigureLayout with the given FlowFigure.
46 * @param flowfigure the FlowFigure
47 */
48 protected this(FlowFigure flowfigure) {
49 this.flowFigure = flowfigure;
50 }
51
52 /**
53 * Not applicable.
54 * @see dwtx.draw2d.LayoutManager#getConstraint(dwtx.draw2d.IFigure)
55 */
56 public Object getConstraint(IFigure child) {
57 return null;
58 }
59
60 /**
61 * Returns this layout's context or <code>null</code>.
62 * @return <code>null</code> or a context
63 * @since 3.1
64 */
65 protected FlowContext getContext() {
66 return context;
67 }
68
69 /**
70 * @return the FlowFigure
71 */
72 protected FlowFigure getFlowFigure() {
73 return flowFigure;
74 }
75
76 /**
77 * Not applicable.
78 * @see dwtx.draw2d.LayoutManager#getMinimumSize(dwtx.draw2d.IFigure, int, int)
79 */
80 public Dimension getMinimumSize(IFigure container, int wHint, int hHint) {
81 return null;
82 }
83
84 /**
85 * Not applicable.
86 * @see dwtx.draw2d.LayoutManager#getPreferredSize(dwtx.draw2d.IFigure, int, int)
87 */
88 public Dimension getPreferredSize(IFigure container, int wHint, int hHint) {
89 return null;
90 }
91
92 /**
93 * Not applicable.
94 * @see dwtx.draw2d.LayoutManager#invalidate()
95 */
96 public void invalidate() { }
97
98 /**
99 * Called during {@link #layout(IFigure)}.
100 */
101 protected abstract void layout();
102
103 /**
104 * @see dwtx.draw2d.LayoutManager#layout(IFigure)
105 */
106 public final void layout(IFigure figure) {
107 layout ();
108 }
109
110 /**
111 * Not applicable.
112 * @see dwtx.draw2d.LayoutManager#remove(dwtx.draw2d.IFigure)
113 */
114 public void remove(IFigure child) { }
115
116 /**
117 * Not applicable.
118 * @see dwtx.draw2d.LayoutManager#setConstraint(dwtx.draw2d.IFigure, java.lang.Object)
119 */
120 public void setConstraint(IFigure child, Object constraint) { }
121
122 /**
123 * Sets the context for this layout manager.
124 * @param flowContext the context of this layout
125 */
126 public void setFlowContext(FlowContext flowContext) {
127 context = flowContext;
128 }
129
130 }