﻿// JScript File
Parts.VerticalToolBar = function(id){
    Parts.VerticalToolBar.initializeBase(this, [id]);
    this.initialize();
}

Parts.VerticalToolBar.prototype.initialize = function(){
    //make sure toolbar reflect mode changes done by right-click menu
    Global.EventController().subscribe("evtMapModeChanged", Function.createDelegate(this, this.onMapActionChanged));

    
    //hook up Toolbar actions
    var oElement;
    
    //get image button
    oElement = this.elm("divSelect_ToolBar"); 
    //if image button exists..
    if (oElement) $addHandler(oElement, 'click', Function.createDelegate(this, this.onSelect));
    
    oElement = this.elm("divZoomIn_ToolBar");
    if (oElement) $addHandler(oElement, 'click', Function.createDelegate(this, this.onZoomIn));
    oElement = this.elm("divZoomOut_ToolBar");
    if (oElement) $addHandler(oElement, 'click', Function.createDelegate(this, this.onZoomOut));
    oElement = this.elm("divZoomStart_ToolBar");
    if (oElement) $addHandler(oElement, 'click', Function.createDelegate(this, this.onZoomStart));
    oElement = this.elm("divPan_ToolBar");
    if (oElement) $addHandler(oElement, 'click', Function.createDelegate(this, this.onPan));
    oElement = this.elm("divPrint_ToolBar");
    if (oElement) $addHandler(oElement, 'click', Function.createDelegate(this, this.onPrint));
    oElement = this.elm("divPrintPreview_ToolBar");
    if (oElement) $addHandler(oElement, 'click', Function.createDelegate(this, this.onPrintPreview));
    oElement = this.elm("divPolygonSelect_ToolBar");
    if (oElement) $addHandler(oElement, 'click', Function.createDelegate(this, this.onPolygonSelect));
//    oElement = this.elm("imgFullScreen");
//    if (oElement) $addHandler(oElement, 'click', Function.createDelegate(this, this.onFullScreen));
}


Parts.VerticalToolBar.prototype.selectButton = function(buttonOn){
    var div;
    div = this.elm("divZoomIn_ToolBar");
    if(div) div.className = "ToolBar_clsButton";
    div = this.elm("divZoomOut_ToolBar");
    if(div) div.className = "ToolBar_clsButton";
    div = this.elm("divZoomStart_ToolBar");
    if(div) div.className = "ToolBar_clsButton";
    div = this.elm("divPan_ToolBar");
    if(div) div.className = "ToolBar_clsButton";
    div = this.elm("divSelect_ToolBar");
    if(div) div.className = "ToolBar_clsButton" ;
    div = this.elm("divPrint_ToolBar");
    if(div) div.className = "ToolBar_clsButton";
    div = this.elm("divPrintPreview_ToolBar");
    if(div) div.className = "ToolBar_clsButton";
    div = this.elm("divPolygonSelect_ToolBar");
    if(div) div.className = "ToolBar_clsButton";
    
    if(this.elm(buttonOn)) this.elm("div" + buttonOn.substring(3) + "_ToolBar").className = "ToolBar_clsButtonSelected";
}

Parts.VerticalToolBar.registerClass('Parts.VerticalToolBar', Parts.ToolBar, Sys.IDisposable);


