view 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
line wrap: on
line source

/*******************************************************************************
 * Copyright (c) 2004, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 * Port to the D programming language:
 *     Frank Benoit <benoit@tionex.de>
 *******************************************************************************/
module dwtx.draw2d.text.ContentBox;

import dwt.dwthelper.utils;
import dwtx.draw2d.text.FlowBox;
import dwtx.draw2d.text.LineRoot;

/**
 * FlowBoxes that are leaf nodes.
 *
 * @author Pratik Shah
 * @since 3.1
 */
public abstract class ContentBox : FlowBox {

private int bidiLevel = -1;
private LineRoot lineRoot;

/**
 * @see FlowBox#getBaseline()
 */
public int getBaseline() {
    return lineRoot.getBaseline();
}

/**
 * @return the Bidi level of this box, if one has been set; -1 otherwise
 * @see #setBidiLevel(int)
 */
public int getBidiLevel() {
    return bidiLevel;
}

/**
 * @see dwtx.draw2d.text.FlowBox#getLineRoot()
 */
LineRoot getLineRoot() {
    return lineRoot;
}

/**
 * Returns <code>true</code> if the bidi level for this box is specified, and is not the
 * default level (0).
 * @see dwtx.draw2d.text.FlowBox#requiresBidi()
 */
public bool requiresBidi() {
    return bidiLevel > 0;
}

/**
 * Sets the Bidi level of this fragment.  It is used to rearrange fragments as defined
 * by the Unicode Bi-directional algorithm.  Valid values are -1 (meaning no Bidi level),
 * or any non-negative integer less than 62.
 * @param newLevel the new BidiLevel
 * @see #getBidiLevel()
 */
public void setBidiLevel(int newLevel) {
    bidiLevel = newLevel;
}

void setLineRoot(LineRoot root) {
    this.lineRoot = root;
}

}