package cnp.ew.button;

import cnp.ew.displayer.*;
import cnp.ew.converter.*;
import cnp.ew.layout.*;
import cnp.ew.util.*;
import java.awt.*;
import java.util.*;

public class CpCheckboxLc extends CpLabeledImageTwoStateButtonLc
{
    static int trueId;
    static int falseId;
    static int truePId;
    static int falsePId;

    static {
        trueId = CpToolkit.registerImageName("true.gif");
        falseId = CpToolkit.registerImageName("false.gif");
        truePId = CpToolkit.registerImageName("truep.gif");
        falsePId = CpToolkit.registerImageName("falsep.gif");
    }

    public CpCheckboxLc()
    {
        this("");
    }

    public CpCheckboxLc(String label)
    {
        // This test prevents a label lc from being added; allows for centered empty
        // checkboxes.
        if (label != null && label.length() > 0) {
            setLabel(label);
        }

        setImage(
            CpToolkit.getImage(trueId),
            CpLabeledImageTwoStateButtonLc.IMAGE_TRUE
        );

        setImage(
            CpToolkit.getImage(falseId),
            CpLabeledImageTwoStateButtonLc.IMAGE_FALSE
        );
        setImage(
            CpToolkit.getImage(truePId),
            CpLabeledImageTwoStateButtonLc.IMAGE_TRUE_PRESSING
        );
        setImage(
            CpToolkit.getImage(falsePId),
            CpLabeledImageTwoStateButtonLc.IMAGE_FALSE_PRESSING
        );
        setLabelOrientation(CpLabeledImageButtonLc.LABEL_RIGHT);
        setShouldShiftWhenPressed(false);
        setHighlightWhenOn(false);
        setFillColor(null);
    }

    public boolean isTransparent()
    {
        return true;
    }
}

