Show:

File: ia\ui\PrintBar.js

/**
 * <code>ia.PrintBar</code>.
 *
 * @author J Clare
 * @class ia.PrintBar
 * @constructor
 * @param {ia.Report} report The associated report object.
 */
ia.PrintBar = function(report)
{
	// The this._report object.
	this._report = report;
	
	// Calculate width / height this._ratio.
	this._ratio = this._report.container.height() / this._report.container.width();
	
	// Create the container element.
	this.container = $j('<div class="ia-print-bar"></div>');
};
	
/**
 * The container that holds the object.
 * 
 * @property container
 * @type JQUERY Element
 */
ia.PrintBar.prototype.container;

/** 
 * Adds the this.container.
 *
 * @method render
 */
ia.PrintBar.prototype.render = function() 
{
	this.container.empty();
	
	// Print button 
	var printBtn = $j('<div class="ia-ui-item ia-ui-item-align-center ia-list-item ia-ui-item-table-cell ia-print-btn"></div>').html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
	this.container.append(printBtn);
	printBtn.bind(ia.CLICK_TYPE, function(e)  
	{
		e.stopPropagation();
		e.preventDefault();
		window.print();
	});
	
	// Minus button 
	var me = this;
	var minusBtn = $j('<div class="ia-ui-item ia-ui-item-align-center ia-list-item ia-ui-item-table-cell ia-minus-btn"></div>').html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
	this.container.append(minusBtn);
	minusBtn.bind(ia.CLICK_TYPE, function(e)  
	{
		e.stopPropagation();
		e.preventDefault();

		var w = me._report.container.width() - 10;
		var h = w * me._ratio;
		me._report.container.css({width: w+"px",height: h+"px"});
	});
	
	// Plus button 
	var plusBtn = $j('<div class="ia-ui-item ia-ui-item-align-center ia-list-item ia-ui-item-table-cell ia-plus-btn"></div>').html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
	this.container.append(plusBtn);
	plusBtn.bind(ia.CLICK_TYPE, function(e)  
	{
		e.stopPropagation();
		e.preventDefault();

		var w = me._report.container.width() + 10;
		var h = w * me._ratio;
		me._report.container.css({width: w+"px",height: h+"px"});
	});
};