// Decompiled by DJ v2.6.6.51 Copyright 2000 Atanas Neshkov  Date: 6/15/2001 17:41:55
// 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/EditText

package com.macromedia.generator.api;

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

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

public class EditText extends GenObject
{

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

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

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

    public int getAlignment()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = EditTextPeer.GetAlignment(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting alignment");
        else
            return ai[0];
    }

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

    public int getHeight()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = EditTextPeer.GetHeight(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting height");
        else
            return ai[0];
    }

    public int getIndent()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = EditTextPeer.GetIndent(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting indentation");
        else
            return ai[0];
    }

    public int getLeading()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = EditTextPeer.GetLeading(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting leading");
        else
            return ai[0];
    }

    public int getLeftMargin()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = EditTextPeer.GetLeftMargin(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting left margin");
        else
            return ai[0];
    }

    public int getMaxLength()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = EditTextPeer.GetMaxLength(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting max length");
        else
            return ai[0];
    }

    public boolean getProperty(int i)
        throws GeneratorApiException
    {
        boolean aflag[] = new boolean[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = EditTextPeer.GetProperty(peer, i, aflag);
        if(j == 0)
            throw new GeneratorApiException("error getting property");
        else
            return aflag[0];
    }

    public int getRightMargin()
        throws GeneratorApiException
    {
        int ai[] = new int[1];
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = EditTextPeer.GetRightMargin(peer, ai);
        if(i == 0)
            throw new GeneratorApiException("error getting right margin");
        else
            return ai[0];
    }

    public String getString()
    {
        String as[] = new String[1];
        if(peer == 0)
            throw new GeneratorApiRuntimeException("invalid peer");
        int i = EditTextPeer.GetString(peer, as);
        if(i == 0)
            as[0] = null;
        return as[0];
    }

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

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

    public void setBounds(Rect rect)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int i = EditTextPeer.SetBounds(peer, rect.getPeer());
        if(i == 0)
            throw new GeneratorApiException("error getting bounds");
        else
            return;
    }

    public void setColor(int i, int j, int k)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int l = EditTextPeer.SetColor(peer, i, j, k);
        if(l == 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 = EditTextPeer.SetFont(peer, font.peer);
        if(i == 0)
            throw new GeneratorApiException("error setting font");
        else
            return;
    }

    public void setHeight(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = EditTextPeer.SetHeight(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting edit text height");
        else
            return;
    }

    public void setIndent(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = EditTextPeer.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 = EditTextPeer.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 = EditTextPeer.SetLeftMargin(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting text left margin");
        else
            return;
    }

    public void setMaxLength(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = EditTextPeer.SetMaxLength(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting max length");
        else
            return;
    }

    public void setProperty(int i, boolean flag)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = EditTextPeer.SetProperty(peer, i, flag);
        if(j == 0)
            throw new GeneratorApiException("error setting property");
        else
            return;
    }

    public void setRightMargin(int i)
        throws GeneratorApiException
    {
        if(peer == 0)
            throw new GeneratorApiException("invalid peer");
        int j = EditTextPeer.SetRightMargin(peer, i);
        if(j == 0)
            throw new GeneratorApiException("error setting text right margin");
        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 = EditTextPeer.SetString(peer, s);
        if(i == 0)
            throw new GeneratorApiException("error setting text string");
        else
            return;
    }

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

    public static final int PROP_READONLY = 8;
    public static final int PROP_PASSWORD = 16;
    public static final int PROP_MULTILINE = 32;
    public static final int PROP_USEOUTLINES = 256;
    public static final int PROP_WORDWRAP = 64;
    public static final int PROP_BORDER = 2048;
    public static final int PROP_NOSELECT = 4096;
    public static final int PROP_MAXLENGTH = 2;
    public static final int ALIGN_LEFT = 0;
    public static final int ALIGN_RIGHT = 1;
    public static final int ALIGN_CENTER = 2;
    public static final int ALIGN_JUSTIFY = 3;
}