46 lines
		
	
	
		
			843 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			843 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/**
 | 
						|
 * @file ui_object
 | 
						|
 * @author frtk@tetalab
 | 
						|
 */
 | 
						|
 | 
						|
NPGClient.UIObject = function(name, style) { 
 | 
						|
 | 
						|
    //Object.defineProperty( this, 'id', { value: GT4UI.Object2DIdCount++ });
 | 
						|
    
 | 
						|
    this.name = name !== undefined ? name : '';
 | 
						|
    this.style = style !== undefined ? style : new NPGClient.UIStyle();
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
NPGClient.UIObject.prototype = {
 | 
						|
    
 | 
						|
    constructor: NPGClient.UIObject,
 | 
						|
 | 
						|
    setStyle: function(s) {
 | 
						|
	this.style = s;
 | 
						|
    },
 | 
						|
    
 | 
						|
    hasBorders: function() {
 | 
						|
	return this.style.getBorderMode();
 | 
						|
    },
 | 
						|
 | 
						|
    hasFillStyle: function() {
 | 
						|
	return this.style.getFillMode();
 | 
						|
    },
 | 
						|
    
 | 
						|
    applyStyle: function(ctx) {
 | 
						|
	
 | 
						|
	var self = this;
 | 
						|
	if (self.style.getBorderMode()) {
 | 
						|
	    ctx.lineWidth = self.style.bw;
 | 
						|
	    ctx.strokeStyle = self.style.bc;
 | 
						|
	}
 | 
						|
	
 | 
						|
	if (self.style.getFillMode()) {
 | 
						|
	    ctx.fillStyle = self.style.fc;
 | 
						|
	}
 | 
						|
    }
 | 
						|
    
 | 
						|
};
 | 
						|
 |