"use strict";

UI.ProgressBar = Entity.Geometry.extend
({
	init: function(texture, fillTexture) 
	{
		var fill = new Entity.Geometry(fillTexture);
		this.attach(fill);
	},

	set min(value) 
	{
		if(this._min === value) { return; }

		this._min = value;
		this.updateElement();
	},

	set max(value) 
	{
		if(this._max === value) { return; }

		this._max = value;
		this.updateElement();
	},

	set value(value) 
	{
		if(this._value === value) { return; }

		this._value = value;
		this.updateElement();
	},


	get min() { return this._min; },
	get max() { return this._max; },
	get value() { return this._value; },


	set fillTexture(fillTexture) {
		this.children[0].texture = fillTexture;
	},

	get fillTexture() { return this.children[0].texture; },	


	//
	_min: 0,
	_max: 100,
	_value: 0
});

@@ -160,16 +160,284 @@
 h(fill);
+%09%09%0A%09%09this.updateUnits();%0A%09%7D,%0A%0A%09updateProgress: function()%0A%09%7B%0A%09%09console.log(this._fillWidth);%0A%09%09var units = this._fillWidth %0A%09%7D,%0A%0A%09updateUnits: function()%0A%09%7B%0A%09%09var texture = this.children%5B0%5D._texture;%0A%0A%09%09if(texture._loaded) %7B%0A%09%09%09this._fillWidth = texture.fullWidth%0A%09%09%7D%0A
 %0A%09%7D,%0A%0A%09s
@@ -519,39 +519,40 @@
 e;%0A%09%09this.update
-Element
+Progress
 ();%0A%09%7D,%0A%0A%09set ma
@@ -629,39 +629,40 @@
 e;%0A%09%09this.update
-Element
+Progress
 ();%0A%09%7D,%0A%0A%09set va
@@ -757,25 +757,111 @@
 date
-Element()
+Progress();%0A%09%7D,%0A%0A%09set percents(value) %7B%0A%09%09this.children%5B0%5D.width = this._fillWidth / 100 * value
 ;%0A%09%7D,%0A%0A
-%0A
 %09get
@@ -962,16 +962,60 @@
 lue; %7D,%0A
+%09get percents() %7B return this._percents; %7D,%0A
 %0A%0A%09set f
@@ -1082,16 +1082,41 @@
 exture;%0A
+%09%09this.updateProgress();%0A
 %09%7D,%0A%0A%09ge
@@ -1153,24 +1153,25 @@
 children%5B0%5D.
+_
 texture; %7D,%09
@@ -1209,13 +1209,40 @@
 value: 0
+,%0A%09_unit: 1,%0A%09_fillWidth: 1
 %0A%7D);%0A

Update for UI.ProgressBar