forked from verdnatura/hedera-web
45 lines
674 B
JavaScript
45 lines
674 B
JavaScript
|
Htk.Button = new Class
|
||
|
({
|
||
|
Extends: Htk.Field
|
||
|
,Tag: 'htk-button'
|
||
|
,Properties:
|
||
|
{
|
||
|
image:
|
||
|
{
|
||
|
type: String
|
||
|
,set: function (x)
|
||
|
{
|
||
|
this.img.src = x;
|
||
|
}
|
||
|
},
|
||
|
tip:
|
||
|
{
|
||
|
type: String
|
||
|
,set: function (x)
|
||
|
{
|
||
|
if (x)
|
||
|
{
|
||
|
this.node.title = _(x);
|
||
|
this.img.title = _(x);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
,initialize: function (props)
|
||
|
{
|
||
|
this.parent (props);
|
||
|
this.createElement ('button');
|
||
|
this.node.className = 'htk-button';
|
||
|
this.node.addEventListener ('click', this.onClick.bind (this));
|
||
|
|
||
|
this.img = document.createElement ('img');
|
||
|
this.node.appendChild (this.img);
|
||
|
}
|
||
|
|
||
|
,onClick: function ()
|
||
|
{
|
||
|
this.signalEmit ('click', this._form);
|
||
|
}
|
||
|
});
|