define( function() {
"use strict";
return function()
{
return {
initialize : function( oControlHost, fnDoneInitializing )
{
var o = oControlHost.configuration;
this.m_sBlockName = o ? o.blockName : "Block1";
fnDoneInitializing();
},
draw : function( oControlHost )
{
var elContainer = oControlHost.container;
elContainer.innerHTML =
'' +
'';
this.m_btn = elContainer.lastChild;
this.m_btn.onclick = this.onClick.bind( this, oControlHost );
this.updateButton( oControlHost );
},
onClick : function( oControlHost )
{
oControlHost.page.getControlByName( this.m_sBlockName ).toggleDisplay();
this.updateButton( oControlHost );
},
updateButton : function( oControlHost )
{
var b = oControlHost.page.getControlByName( this.m_sBlockName ).getDisplay();
this.m_btn.innerHTML = b ? '◀' : '▶';
this.m_btn.title = b ? 'Hide' : 'Show';
}
}
}
});