module.exports = new Class({ Extends: Htk.Field ,Tag: 'htk-button' ,Properties: { image: { type: String ,set: function(x) { this.iconNode.name = x; } }, icon: { type: String ,set: function(x) { this.iconNode.name = x; } }, tip: { type: String ,set: function(x) { if (x) { this.node.title = _(x); this.iconNode.title = _(x); } this.renderContent(); } ,get: function() { return this.node.title; } }, showText: { type: Boolean ,set: function(x) { this._showText = x; this.renderContent(); } ,get: function() { return this._showText; } } } ,_showText: false ,render: function() { var node = this.createRoot('button'); node.className = 'htk-button'; node.addEventListener('click', this.onClick.bind(this)); this.iconNode = new Htk.Icon(); node.appendChild(this.iconNode.node); } ,renderContent: function() { if (this._textNode) Vn.Node.remove(this._textNode); if (this._showText && this.node.title) { this._textNode = this.createElement('span'); this._textNode.className = 'text'; this._textNode.appendChild(this.createTextNode(this.node.title)); this.node.appendChild(this._textNode); } } ,onClick: function() { this.signalEmit('click', this._form); } });