CheckBoxFigure=function(title){
if(title){
this.title=title;
}else{
this.title="";
}
Figure.call(this);
this.setProperty("property_1","value_1");
this.setProperty("property_2","value_2");
this.setProperty("property_3","value_3");
};
CheckBoxFigure.prototype=new Figure;
CheckBoxFigure.prototype.type="CheckBoxFigure";
CheckBoxFigure.prototype.createHTMLElement=function(){
var item=Figure.prototype.createHTMLElement.call(this);
item.style.margin="0px";
item.style.padding="0px";
this.ui_element=document.createElement("input");
this.ui_element.type="checkbox";
this.ui_element.style.position="absolute";
this.ui_element.style.left="0px";
this.ui_element.style.top="0px";
this.ui_element.style.margin="0px";
this.ui_element.style.padding="0px";
this.ui_element.style.cursor="move";
this.textNode=document.createElement("div");
this.textNode.innerHTML="checkbox";
this.textNode.style.fontFamily="sans-serif";
this.textNode.style.fontSize="8pt";
this.textNode.style.position="absolute";
this.textNode.style.left="20px";
this.textNode.style.top="0px";
item.appendChild(this.ui_element);
item.appendChild(this.textNode);
return item;
};
CheckBoxFigure.prototype.setDimension=function(w,h){
Figure.prototype.setDimension.call(this,w,20);
};
// Aggiunta di Mario
CheckBoxFigure.prototype.getContextMenu=function(){
var menu=new Menu();
var oThis=this;
menu.appendMenuItem(new MenuItem("Property1: Value_A",null,function(){
oThis.setProperty("property_1","value_A");
oThis.textNode.innerHTML="value_A";
}));
menu.appendMenuItem(new MenuItem("Property2: Value_B",null,function(){
oThis.setProperty("property_2","value_B");
oThis.textNode.innerHTML="value_B";
}));
menu.appendMenuItem(new MenuItem("Property3: Value_C",null,function(){
oThis.setProperty("property_3","value_C");
oThis.textNode.innerHTML="value_C";
}));
menu.appendMenuItem(new MenuItem("Reset properties",null,function(){
oThis.setProperty("property_1","value_1");
oThis.setProperty("property_2","value_2");
oThis.setProperty("property_3","value_3");
oThis.textNode.innerHTML="checkbox";
}));
return menu;
};
// Fine

