hedera-web/js/htk/icon.js

64 lines
817 B
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
var Widget = require ('./widget');
module.exports = new Class
({
Extends: Widget
,Tag: 'htk-icon'
,Properties:
{
icon:
{
type: String
,set: function (x)
{
this._icon = x;
2016-10-16 14:16:08 +00:00
this._setIcon ();
2016-09-26 09:28:47 +00:00
}
,get: function ()
{
return this._icon;
}
},
theme:
{
type: String
,set: function (x)
{
this._theme = x;
2016-10-16 14:16:08 +00:00
this._setIcon ();
2016-09-26 09:28:47 +00:00
}
,get: function ()
{
return this._theme;
}
},
alt:
{
type: String
,set: function (x)
{
this.node.alt = x;
}
,get: function ()
{
return this.node.alt;
}
}
}
,_icon: null
2016-10-16 14:16:08 +00:00
,render: function ()
2016-09-26 09:28:47 +00:00
{
2016-10-16 14:16:08 +00:00
this.createRoot ('img');
2016-09-26 09:28:47 +00:00
}
2016-10-16 14:16:08 +00:00
,_setIcon: function ()
2016-09-26 09:28:47 +00:00
{
var theme = this._theme ? this._theme : 'light';
this.node.src = 'image/icon/'+ theme +'/'+ this._icon +'.svg';
}
});