comparison org.eclipse.draw2d/src/org/eclipse/draw2d/text/TextLayout.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 dbfb303e8fb0
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.text.TextLayout;
14
15 import java.lang.all;
16
17 import org.eclipse.draw2d.text.FlowFigureLayout;
18 import org.eclipse.draw2d.text.TextFlow;
19 import org.eclipse.draw2d.text.TextFragmentBox;
20
21 /**
22 * @author hudsonr
23 * @since 2.1
24 */
25 public abstract class TextLayout : FlowFigureLayout {
26
27 /**
28 * Creates a new TextLayout with the given TextFlow
29 * @param flow The TextFlow
30 */
31 public this(TextFlow flow) {
32 super(flow);
33 }
34
35 /**
36 * Reuses an existing <code>TextFragmentBox</code>, or creates a new one.
37 * @param i the index
38 * @param fragments the original list of fragments
39 * @return a TextFragmentBox
40 */
41 protected TextFragmentBox getFragment(int i, List fragments) {
42 if (fragments.size() > i)
43 return cast(TextFragmentBox)fragments.get(i);
44 TextFragmentBox box = new TextFragmentBox(cast(TextFlow)getFlowFigure());
45 fragments.add(box);
46 return box;
47 }
48
49 }