package cnp.ew.util;

import cnp.ew.image.*;
import java.awt.*;

public class CpToolkit {

    public static Font getDefaultFont()
    {
        return CpFonts.dialogPlainTen();
    }

    // This is truly ugly, but we need a component for image loading, and it seems better to use ONE arbitrary component
    public static Component defaultComponent;

    public static void setDefaultComponent(Component component)
    {
        defaultComponent = component;
    }

    public static Component defaultComponent()
    {
        if (defaultComponent == null) {
            defaultComponent = new Panel();
        }
        return defaultComponent;
    }

    public static Image getImage(String fileName)
    {
        return CpImageGetter.getDefault().getImage(defaultComponent(), fileName);
    }

    public static Image getImage(String fileName, boolean searchPackedImages)
    {
        return CpImageGetter.getDefault().getImage(defaultComponent(), fileName, searchPackedImages);
    }

    public static Image getImage(int id)
    {
        return CpImageGetter.getDefault().getImage(defaultComponent(), id);
    }

    public static int registerImageName(String urlString)
    {
        return CpImageGetter.getDefault().registerImageName(urlString);
    }
}