1
|
/*******************************************************************************
|
2
|
* Copyright (c) 2000, 2010 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
|
*******************************************************************************/
|
11
|
package org.eclipse.draw2d.text;
|
12
|
|
13
|
/**
|
14
|
* A FlowBox that can contain other FlowBoxes. The contained FlowBoxes are
|
15
|
* called <i>fragments</i>.
|
16
|
*
|
17
|
* @author hudsonr
|
18
|
* @since 2.1
|
19
|
*/
|
20
|
public abstract class CompositeBox extends FlowBox {
|
21
|
|
22
|
int recommendedWidth = -1;
|
23
|
|
24
|
/**
|
25
|
* Adds the given box and updates properties of this composite box.
|
26
|
*
|
27
|
* @param box
|
28
|
* the child being added
|
29
|
*/
|
30
|
public abstract void add(FlowBox box);
|
31
|
|
32
|
abstract int getBottomMargin();
|
33
|
|
34
|
/**
|
35
|
* Returns the recommended width for this CompositeBox.
|
36
|
*
|
37
|
* @return the recommended width
|
38
|
*/
|
39
|
public int getRecommendedWidth() {
|
40
|
return recommendedWidth;
|
41
|
}
|
42
|
|
43
|
abstract int getTopMargin();
|
44
|
|
45
|
/**
|
46
|
* Sets the recommended width for this CompositeBox.
|
47
|
*
|
48
|
* @param w
|
49
|
* the width
|
50
|
*/
|
51
|
public void setRecommendedWidth(int w) {
|
52
|
recommendedWidth = w;
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* Positions the box vertically by setting the y coordinate for the top of
|
57
|
* the content of the line. For internal use only.
|
58
|
*
|
59
|
* @param top
|
60
|
* the y coordinate
|
61
|
* @since 3.1
|
62
|
*/
|
63
|
public abstract void setLineTop(int top);
|
64
|
|
65
|
}
|