module.exports = new Class ({ Extends: Htk.Field ,Tag: 'htk-button' ,Properties: { image: { type: String ,set: function (x) { this.img.src = x; } }, icon: { type: String ,set: function (x) { this.img.src = 'image/icon/light/'+ x +'.svg'; } }, tip: { type: String ,set: function (x) { if (x) { this.node.title = _(x); this.img.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.img = this.createElement ('img'); node.appendChild (this.img); } ,renderContent: function () { if (this._textNode) Vn.Node.remove (this._textNode); if (this._showText && this.node.title) { this._textNode = this.createElement ('span'); this._textNode.appendChild (this.createTextNode (this.node.title)); this.node.appendChild (this._textNode); } } ,onClick: function () { this.signalEmit ('click', this._form); } });