// Decompiled by DJ v2.6.6.51 Copyright 2000 Atanas Neshkov  Date: 6/15/2001 17:42:05
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   com/macromedia/generator/api/Text

package com.macromedia.generator.api;

import com.macromedia.generator.api.peer.TextPeer;

// Referenced classes of package com.macromedia.generator.api:
//            GenObject, GeneratorApiException, Rect, Color, 
//            Font

public class Text extends GenObject
{

    public Text()
        throws GeneratorApiException
    {
        peer = TextPeer.New();
        if(peer == 0)
            throw new GeneratorApiException("unable to create peer");
        else
            return;
    }

    protected Text(int i)
        throws GeneratorApiException
    {
        peer = i;
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        else
            return;
    }

    protected void finalize()
        throws Throwable
    {
        if(peer != 0)
            TextPeer.Release(peer);
        peer = 0;
    }

    public Rect getBounds()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = TextPeer.GetBounds(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting bounds");
        else
            return new Rect(ai[0]);
    }

    public void release()
    {
        if(peer != 0)
            TextPeer.Release(peer);
        peer = 0;
    }

    public void setAlignment(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = TextPeer.SetAlignment(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting text alignment");
        else
            return;
    }

    public void setCenter(int i, int j)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int k = TextPeer.SetCenter(peer, i, j);
        if(k == 0)
            throw new GeneratorApiException("error setting center");
        else
            return;
    }

    public void setColor(Color color)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = TextPeer.SetColor(peer, color.peer);
        if(i == 0)
            throw new GeneratorApiException("error setting color");
        else
            return;
    }

    public void setFont(Font font)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = TextPeer.SetFont(peer, font.peer);
        if(i == 0)
            throw new GeneratorApiException("error setting font");
        else
            return;
    }

    public void setIndent(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = TextPeer.SetIndent(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting text indent");
        else
            return;
    }

    public void setLeading(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = TextPeer.SetLeading(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting text leading");
        else
            return;
    }

    public void setLeftMargin(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = TextPeer.SetLeftMargin(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting text left margin");
        else
            return;
    }

    public void setLineWidth(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = TextPeer.SetLineWidth(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting line width");
        else
            return;
    }

    public void setPosition(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = TextPeer.SetPosition(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting text position");
        else
            return;
    }

    public void setRgb(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = TextPeer.SetRgb(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting rgb color");
        else
            return;
    }

    public void setRightMargin(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = TextPeer.SetRightMargin(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting text right margin");
        else
            return;
    }

    public void setSize(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = TextPeer.SetSize(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting text size");
        else
            return;
    }

    public void setSpacing(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = TextPeer.SetSpacing(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting text spacing");
        else
            return;
    }

    public void setString(String s)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        if(s == null)
            throw new GeneratorApiException("null string");
        int i = TextPeer.SetString(peer, s);
        if(i == 0)
            throw new GeneratorApiException("error setting text string");
        else
            return;
    }
}