
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2011 Adobe Systems Incorporated
*  All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any.  The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
*
* $DateTime:  $
*
* Adobe Output Module 4.0
*
* MediaGallery Originally Written by Quality Process Incorporated, Enhanced by
* Adobe Systems China. Contact Sheet written by Adobe Systems China.
* 
*
**************************************************************************/
AOM.CustomCheckbox = function(checkbox) {
	this.initialize(checkbox);
}

AOM.CustomCheckbox.prototype.initialize = function(checkbox) {
	if (checkbox == undefined)  {
		return false;
	}

	//add mouse event listener
    checkbox.addEventListener ('mousedown', AOM.CustomCheckbox.doDown, false);
    
    // Change the text width
    if (checkbox.title != undefined)
    {
        var agfx = checkbox.graphics;
        var textSize = agfx.measureString(checkbox.title,  agfx.font);
        checkbox.preferredSize.width = textSize.width + AOM.BOX_WIDTH + AOM.BOX_SPACE;
    }

	return true;
}

AOM.CustomCheckbox.doDown = function(event) {
     var checkbox = event.target;
     if (!checkbox.enabled) return;
	 
     checkbox.checked = !checkbox.checked;
     checkbox.onMouseDown();
     checkbox.notify("onDraw");
}


