define('application/widgets/button', [
'application/widgets/pointerfocusablebutton',
'rofl/widgets/label'
], function (
PointerFocusableButton,
Label
) {
'use strict';
return PointerFocusableButton.extend({
/**
* Initialises the button.
*
* @param {string} text - The button text.
* @param {string} [id] - The id. Optional.
*/
init: function init (text, id) {
init.base.call(this, id);
this.addClass('kpn-button');
this._build(text);
},
/**
* Builds the widget.
*
* @param {string} text - The text to set.
* @private
*/
_build: function (text) {
var label = this._label = new Label({ text: text || '' });
this.appendChildWidget(label);
},
/**
* Return button label.
*
* @returns {Label} Label of this button.
*/
getLabel: function () {
return this._label;
},
/**
* Return button text.
*
* @returns {string} Text of this button.
*/
getText: function () {
return this._label.getText();
}
});
});