
ICore.controls = {};

ICore.controls.Control = function (container) {
	if (container) {
		this.container = ICore.util.object(container);
	}
	
	this.afterConstruction();
	
	if (this.container) {
		this.setup();
	} else {
		ICore.onLoad.addListener(this, function () {
			this.setup();
		});
	}
};

ICore.controls.Control.prototype.installed = false;
ICore.controls.Control.prototype.container = null;

ICore.controls.Control.prototype.setup = function () {
	if (!this.installed) {
		this.container = ICore.util.object(this.container);
		
		if (!this.container) {
			throw new Error('Container não encontrado.');
		}
		
		this.installed = true;
	}
};

ICore.controls.Control.prototype.getContainer = function () {
	return this.container;
};

ICore.controls.Control.prototype.afterConstruction = function () {
};
