2011-02-01 18:45:22 +00:00
|
|
|
GUI.FunctionController = function() {
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
this.type = "function";
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
var _this = this;
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
GUI.Controller.apply(this, arguments);
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
this.domElement.addEventListener('click', function() {
|
|
|
|
_this.fire();
|
|
|
|
}, false);
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
this.domElement.style.cursor = "pointer";
|
|
|
|
this.propertyNameElement.style.cursor = "pointer";
|
2011-02-11 19:12:07 +00:00
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
var fireFunction = null;
|
|
|
|
this.onFire = function(fnc) {
|
|
|
|
fireFunction = fnc;
|
|
|
|
return this;
|
2011-02-11 19:12:07 +00:00
|
|
|
}
|
|
|
|
|
2011-02-10 20:50:57 +00:00
|
|
|
this.fire = function() {
|
|
|
|
if (fireFunction != null) {
|
|
|
|
fireFunction.call(this);
|
|
|
|
}
|
|
|
|
_this.object[_this.propertyName].call(_this.object);
|
|
|
|
};
|
2011-01-25 08:22:04 +00:00
|
|
|
};
|
2011-02-01 18:45:22 +00:00
|
|
|
GUI.extendController(GUI.FunctionController);
|