﻿//if (typeof(ytb)!=='undefined'){
        
yGenericTool =
{   
    info : 
    {
        name : 'YGenericTool',
        description : 'YToolBox Generic Script is the base for adding tools.',
        version : '0.1a',
        status : "alpha",
        url : 'yorchnet.com'
    },
    resources :
    {
        img : new File('../header.png')
    },
    gui_preferences :
    {
        buttonWidth : 76,
        buttonHeight : 30
    },
    toolbox :
    {
        buttons :
        "btn_" + this.info.name + ": Button\
        {\
            preferredSize: ['" + this.gui_preferences.buttonWidth + "','" + this.gui_preferences.buttonHeight + "'],\
            text:'" + this.info.name + "',\
            helpTip:'" + this.info.description + "'\
        }",
        gui :
        "window\
        {\
            type:'palette',\
            text:'" + this.info.name + ' ' + this.info.version + " " + this.info.status + "',\
            info: Group\
            {\
                alignment:['center','bottom'],\
                icon: Image\
                {\
                    icon:'" + String( this.resources.img.path + "/" + this.resources.img.name ) + "',\
                    preferredSize: [15, 18]\
                },\
                website: StaticText\
                {\
                    text:'" + this.info.url + "',\
                    alignment:['fill','center'] \
                }\
            }\
        }"
    },
    getInfo : function getInfo( info_request )
    {
        var info = null ;
        
        switch (info_request)
        {
            case "name":
                info = this.name;
                break;
            case "description":
                info = this.description;
                break;
            case "version":
                info = this.version;
                break;
            case "status":
                info = this.status;
                break;
            case "url":
                info = this.url;
                break;
        }
        return info;
    },
    getInfo : function getInfo( resource_request )
    {
        var resource = null ;
        
        switch ( resource_request )
        {
            case "img":
                resource = this.img;
                break;
        }
        return info;
    },
    getToolBoxButtons : function getToolBoxButtons()
    {
        return this.toolbox.buttons;
    },
    getToolBoxGui : function getToolBoxGui()
    {
        return this.toolbox.gui;
    },
    buildUI : function buildUI()
    {      
        this.window = new Window ( this.toolbox.gui , {resizable:true});
        this.window.show();
    },
    addToBox : function addToBox()
    {
        ytb.addTool(this);
    },  
    init : function init()
    {
        if ( typeof ytb !== "undefined" )
        {
            this.addToBox();
        }
        this.buildUI();
    }
}

yGenericTool.init()

