1 |
/* |
/* |
2 |
HBox.java |
HBox.java |
3 |
* |
* |
4 |
* Copyright (c) 2000-2001, Ted Nelson and Tuomas Lukka |
* Copyright (c) 2000-2001, Ted Nelson and Tuomas Lukka |
5 |
* |
* |
6 |
* You may use and distribute under the terms of either the GNU Lesser |
* You may use and distribute under the terms of either the GNU Lesser |
8 |
* at your choice, any later version. Alternatively, you may use and |
* at your choice, any later version. Alternatively, you may use and |
9 |
* distribute under the terms of the XPL. |
* distribute under the terms of the XPL. |
10 |
* |
* |
11 |
* See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of |
* See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of |
12 |
* the licenses. |
* the licenses. |
13 |
* |
* |
14 |
* This software is distributed in the hope that it will be useful, |
* This software is distributed in the hope that it will be useful, |
23 |
package gzz.vob; |
package gzz.vob; |
24 |
import java.util.*; |
import java.util.*; |
25 |
|
|
26 |
/** An interface for linebreaking. A box knows how wide it is at |
/** A box that knows its size at different scales. |
27 |
* different scales. |
* Used for linebreaking with billowing, where we need to layout |
28 |
|
* pieces at different sizes depending on which line they fall on. |
29 |
* <p> |
* <p> |
30 |
* As for ScalableFont, the "normal" size is scale=1000. |
* The "normal" size is scale=1. |
31 |
*/ |
*/ |
32 |
|
|
33 |
public interface HBox { |
public interface HBox { |
43 |
*/ |
*/ |
44 |
float getDepth(float scale); |
float getDepth(float scale); |
45 |
|
|
46 |
/** Return a vob for the contents of this box at the given scale. |
/** Place the contents of this box into a given coordsys. |
47 |
* This function <strong>may</strong> change |
* This function <strong>may</strong> change |
48 |
* this HBox and return: |
* this HBox and place it into the coordsys: |
49 |
* the following is a legal implementation: |
* the following is a legal implementation: |
50 |
* <pre> |
* <pre> |
51 |
* public class FooBox extends Vob implements HBox { |
* public class FooBox extends Vob implements HBox { |
52 |
* int scale; |
* float scale; |
53 |
* ... |
* ... |
54 |
* ... |
* ... |
55 |
* public Vob getVob(int scale) { |
* public void place(VobScene vs, int cs, float scale) { |
56 |
* this.scale = scale; |
* this.scale = scale; |
57 |
* return this; |
* vs.map.put(this, cs); |
58 |
* } |
* } |
59 |
* } |
* } |
60 |
* </pre> |
* </pre> |
61 |
*/ |
*/ |
62 |
Vob getVob(float scale); |
void place(VobScene vs, int coordsys, float scale); |
63 |
|
|
64 |
/** Get the key for this vob. |
/** The key for this HBox. XXX */ |
|
* XXX WHAT is the meaning of key? |
|
|
*/ |
|
65 |
Object getKey(); |
Object getKey(); |
66 |
|
|
67 |
/** Set the preceding HBox. |
/** Set the preceding HBox. |
74 |
public float getWidth(float scale) { return 0; } |
public float getWidth(float scale) { return 0; } |
75 |
public float getHeight(float scale) { return 0; } |
public float getHeight(float scale) { return 0; } |
76 |
public float getDepth(float scale) { return 0; } |
public float getDepth(float scale) { return 0; } |
77 |
public Vob getVob(float scale) { return null; } |
public void place(VobScene vs, int cs, float scale) {} |
78 |
public Object getKey() { return null; } |
public Object getKey() { return null; } |
79 |
public void setPrev(HBox b) { } |
public void setPrev(HBox b) { } |
80 |
} |
} |
86 |
protected float scale = 0; |
protected float scale = 0; |
87 |
public float getScale() { return scale; } |
public float getScale() { return scale; } |
88 |
|
|
89 |
public Vob getVob(float scale) { |
public void place(VobScene vs, int cs, float scale) { |
90 |
this.scale = scale; |
this.scale = scale; |
91 |
return this; |
vs.map.put(this, cs); |
92 |
} |
} |
93 |
public Object getKey() { return null; /* XXX */ } |
public Object getKey() { return null; /* XXX */ } |
94 |
|
|