Htk.Widget = new Class
({
	Extends: Vn.Object
	,Properties:
	{
		class:
		{
			type: String
			,set: function (x)
			{
				this.node.className = x +' '+ this.node.className;
			}
			,get: function ()
			{
				return this.node.className;
			}
		}
	}

	/** Main HTML node that represents the widget **/
	,node: null
	,builder: null
	
	,builderInit: function (path)
	{
		this.builder = new Vn.Builder ();
		this.builder.signalData = this;
		this.builder.loadXml (Vn.getXml (path));
		this.node = this.builder.get ('main');
	}
	
	,createElement: function (tagName)
	{
		this.node = document.createElement (tagName);
		return this.node;
	}

	,getNode: function ()
	{
		return this.node;
	}

	,$: function (id)
	{
		if (this.builder)
			return this.builder.get (id);
			
		return null;
	}
	
	,remove: function ()
	{
		Vn.Node.remove (this.node);
	}

	,_destroy: function ()
	{
		if (this.builder)
			this.builder.unref ();

		this.parent ();
	}
});
