/* Copyright (C) Edward M. Kagan - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited
 * Proprietary and confidential
 * Written by Edward M. Kagan <atman@idp-crew.com>, 2015
 */
package org.idp.laf;

import java.awt.Font;
import javax.swing.UIDefaults;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.metal.MetalTheme;

/**
 * @author Edward M. Kagan <atman@idp-crew.com>
 */
public class TitanTheme  extends MetalTheme {

    private static ColorUIResource primary1   = new ColorUIResource( 128, 128, 128);
    private static ColorUIResource primary2   = new ColorUIResource( 64 , 64,  64 );
    private static ColorUIResource primary3   = new ColorUIResource( 128, 128, 128);
    private static ColorUIResource secondary1 = new ColorUIResource( 208, 208, 208);
    private static ColorUIResource secondary2 = new ColorUIResource( 96 , 96 ,  96);
    private static ColorUIResource secondary3 = new ColorUIResource( 64 , 64 , 64 );
    private static ColorUIResource black      = new ColorUIResource( 255  , 255  , 255 );
    private static ColorUIResource white      = new ColorUIResource( 0  , 0  , 0  );
    

    @Override
    public void addCustomEntriesToTable(UIDefaults table) {
        super.addCustomEntriesToTable(table); //To change body of generated methods, choose Tools | Templates.
        table.put( "nb.imageicon.filter", new DarkIconFilter() ); //NOI18N
    }
    
    private final static FontUIResource DEFAULT_FONT = new FontUIResource("Dialog", Font.PLAIN, 11); //NOI18N
    
    
    
    public static void self_tuneup (Color[] color_scheme_loaded)
    {
        for (int i = 0; i < color_scheme_loaded.length; i ++)
        {
            grep_needed (color_scheme_loaded[i]);
        }
    }
    
    private static void grep_needed (Color c)
    {
        if      (c.getName().equals("primary1"))   primary1   = (ColorUIResource) c.getObject();
        else if (c.getName().equals("primary2"))   primary2   = (ColorUIResource) c.getObject();
        else if (c.getName().equals("primary3"))   primary3   = (ColorUIResource) c.getObject();
        else if (c.getName().equals("secondary1")) secondary1 = (ColorUIResource) c.getObject();
        else if (c.getName().equals("secondary2")) secondary2 = (ColorUIResource) c.getObject();
        else if (c.getName().equals("secondary3")) secondary3 = (ColorUIResource) c.getObject();
        else if (c.getName().equals("black"))      black      = (ColorUIResource) c.getObject();
        else if (c.getName().equals("white"))      white      = (ColorUIResource) c.getObject();
    }
    
    @Override
    public String getName() {
        return "[idP!] Titan"; //NOI18N
    }

    // FUCKERS - it's not obligatory to override this - IDIOTS!!!
    @Override
    protected ColorUIResource getWhite() {
        return white;
    }

    @Override
    protected ColorUIResource getBlack() {
        return black;
    }

    
    @Override
    protected ColorUIResource getPrimary1() {
        return primary1;
    }

    @Override
    protected ColorUIResource getPrimary2() {
        return primary2;
    }

    @Override
    protected ColorUIResource getPrimary3() {
        return primary3;
    }

    @Override
    protected ColorUIResource getSecondary1() {
        return secondary1;
    }

    @Override
    protected ColorUIResource getSecondary2() {
        return secondary2;
    }

    @Override
    protected ColorUIResource getSecondary3() {
        return secondary3;
    }

    @Override
    public FontUIResource getControlTextFont() {
        return DEFAULT_FONT;
    }

    @Override
    public FontUIResource getSystemTextFont() {
        return DEFAULT_FONT;
    }

    @Override
    public FontUIResource getUserTextFont() {
        return DEFAULT_FONT;
    }

    @Override
    public FontUIResource getMenuTextFont() {
        return DEFAULT_FONT;
    }

    @Override
    public FontUIResource getWindowTitleFont() {
        return DEFAULT_FONT;
    }

    @Override
    public FontUIResource getSubTextFont() {
        return DEFAULT_FONT;
    }
    
}
