Mercurial > projects > dwt-addons
comparison dwtx/draw2d/text/ContentBox.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) 2004, 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.ContentBox; | |
14 | |
15 import dwt.dwthelper.utils; | |
16 import dwtx.draw2d.text.FlowBox; | |
17 import dwtx.draw2d.text.LineRoot; | |
18 | |
19 /** | |
20 * FlowBoxes that are leaf nodes. | |
21 * | |
22 * @author Pratik Shah | |
23 * @since 3.1 | |
24 */ | |
25 public abstract class ContentBox : FlowBox { | |
26 | |
27 private int bidiLevel = -1; | |
28 private LineRoot lineRoot; | |
29 | |
30 /** | |
31 * @see FlowBox#getBaseline() | |
32 */ | |
33 public int getBaseline() { | |
34 return lineRoot.getBaseline(); | |
35 } | |
36 | |
37 /** | |
38 * @return the Bidi level of this box, if one has been set; -1 otherwise | |
39 * @see #setBidiLevel(int) | |
40 */ | |
41 public int getBidiLevel() { | |
42 return bidiLevel; | |
43 } | |
44 | |
45 /** | |
46 * @see dwtx.draw2d.text.FlowBox#getLineRoot() | |
47 */ | |
48 LineRoot getLineRoot() { | |
49 return lineRoot; | |
50 } | |
51 | |
52 /** | |
53 * Returns <code>true</code> if the bidi level for this box is specified, and is not the | |
54 * default level (0). | |
55 * @see dwtx.draw2d.text.FlowBox#requiresBidi() | |
56 */ | |
57 public bool requiresBidi() { | |
58 return bidiLevel > 0; | |
59 } | |
60 | |
61 /** | |
62 * Sets the Bidi level of this fragment. It is used to rearrange fragments as defined | |
63 * by the Unicode Bi-directional algorithm. Valid values are -1 (meaning no Bidi level), | |
64 * or any non-negative integer less than 62. | |
65 * @param newLevel the new BidiLevel | |
66 * @see #getBidiLevel() | |
67 */ | |
68 public void setBidiLevel(int newLevel) { | |
69 bidiLevel = newLevel; | |
70 } | |
71 | |
72 void setLineRoot(LineRoot root) { | |
73 this.lineRoot = root; | |
74 } | |
75 | |
76 } |