2015-01-23 13:09:30 +00:00
|
|
|
Htk.Widget = new Class
|
|
|
|
({
|
|
|
|
Extends: Vn.Object
|
2015-03-06 23:33:54 +00:00
|
|
|
,Properties:
|
|
|
|
{
|
|
|
|
class:
|
|
|
|
{
|
|
|
|
type: String
|
|
|
|
,set: function (x)
|
|
|
|
{
|
|
|
|
this.node.className = x +' '+ this.node.className;
|
|
|
|
}
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
return this.node.className;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
/** Main HTML node that represents the widget **/
|
|
|
|
,node: null
|
2015-03-06 23:33:54 +00:00
|
|
|
,builder: null
|
|
|
|
|
|
|
|
,builderInit: function (path)
|
|
|
|
{
|
|
|
|
this.builder = new Vn.Builder ();
|
|
|
|
this.builder.loadXml (Vn.getXml (path));
|
|
|
|
this.node = this.builder.get ('main');
|
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
,createElement: function (tagName)
|
|
|
|
{
|
|
|
|
this.node = document.createElement (tagName);
|
|
|
|
return this.node;
|
|
|
|
}
|
|
|
|
|
|
|
|
,getNode: function ()
|
|
|
|
{
|
|
|
|
return this.node;
|
|
|
|
}
|
2015-03-06 23:33:54 +00:00
|
|
|
|
|
|
|
,ui: function (uiFile)
|
|
|
|
{
|
|
|
|
this.builder = new Vn.Builder ();
|
|
|
|
this.builder.load (uiFile, this.onUiReady.bind (this));
|
|
|
|
}
|
|
|
|
|
|
|
|
,onUiReady: function ()
|
|
|
|
{
|
|
|
|
this.node = this.builder.getNode ();
|
|
|
|
this.uiReady ();
|
|
|
|
}
|
|
|
|
|
|
|
|
,$: function (id)
|
|
|
|
{
|
|
|
|
if (this.builder)
|
|
|
|
return this.builder.get (id);
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Virtual method that shoud be implemented by all widgets using the ui
|
|
|
|
* builder.
|
|
|
|
**/
|
|
|
|
,uiReady: function () {}
|
2015-01-23 13:09:30 +00:00
|
|
|
});
|