define( function() { "use strict"; function Control() { }; Control.prototype.initialize = function( oControlHost, fnDoneInitializing ) { this.m_oControlHost = oControlHost; this.m_sControlName = this.getConfigurationValue( "Control name", "Block1" ); this.m_bVertical = this.getConfigurationValue( "Vertical", false ); fnDoneInitializing(); }; Control.prototype.destroy = function( oControlHost ) { this.m_oControlHost = null; }; Control.prototype.getConfigurationValue = function( sName, sDefaultValue ) { var o = this.m_oControlHost.configuration; return ( o && ( o[sName] !== undefined ) ) ? o[sName] : sDefaultValue; }; Control.prototype.draw = function( oControlHost ) { var elContainer = oControlHost.container; var sUniqueSelector = 'myDisplayButton_' + elContainer.id; var sBorderColor = this.getConfigurationValue( "Border color", null ); var sHoverBackgroundColor = this.getConfigurationValue( "Hover background color", null ); var sHoverColor = this.getConfigurationValue( "Hover foreground color", null ); elContainer.innerHTML = '' + ''; this.m_btn = elContainer.lastChild; this.m_btn.onclick = this.onClick.bind( this ); this.updateButton(); }; Control.prototype.onClick = function() { this.m_oControlHost.page.getControlByName( this.m_sControlName ).toggleDisplay(); this.updateButton(); }; Control.prototype.updateButton = function() { var b = this.m_oControlHost.page.getControlByName( this.m_sControlName ).getDisplay(); this.m_btn.innerHTML = b ? ( this.m_bVertical ? '▼' : '◀' ) : ( this.m_bVertical ? '▲' : '▶' ); this.m_btn.title = b ? 'Hide' : 'Show'; }; return Control; });