root / trunk / web / dojo / dojox / drawing / util / oo.js @ 10
History | View | Annotate | Download (1.1 KB)
| 1 | 9 | andrej.cim | /*
|
|---|---|---|---|
| 2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
| 3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
| 4 | see: http://dojotoolkit.org/license for details
|
||
| 5 | */
|
||
| 6 | |||
| 7 | |||
| 8 | if(!dojo._hasResource["dojox.drawing.util.oo"]){ |
||
| 9 | dojo._hasResource["dojox.drawing.util.oo"]=true; |
||
| 10 | dojo.provide("dojox.drawing.util.oo");
|
||
| 11 | dojox.drawing.util.oo={declare:function(){
|
||
| 12 | var f,o,_1=0,a=arguments; |
||
| 13 | if(a.length<2){ |
||
| 14 | console.error("gfx.oo.declare; not enough arguments");
|
||
| 15 | } |
||
| 16 | if(a.length==2){ |
||
| 17 | f=a[0];
|
||
| 18 | o=a[1];
|
||
| 19 | }else{
|
||
| 20 | a=Array.prototype.slice.call(arguments);
|
||
| 21 | o=a.pop(); |
||
| 22 | f=a.pop(); |
||
| 23 | _1=1;
|
||
| 24 | } |
||
| 25 | for(var n in o){ |
||
| 26 | f.prototype[n]=o[n]; |
||
| 27 | } |
||
| 28 | if(_1){
|
||
| 29 | a.unshift(f); |
||
| 30 | f=this.extend.apply(this,a); |
||
| 31 | } |
||
| 32 | return f;
|
||
| 33 | },extend:function(){ |
||
| 34 | var a=arguments,_2=a[0]; |
||
| 35 | if(a.length<2){ |
||
| 36 | console.error("gfx.oo.extend; not enough arguments");
|
||
| 37 | } |
||
| 38 | var f=function(){ |
||
| 39 | for(var i=1;i<a.length;i++){ |
||
| 40 | a[i].prototype.constructor.apply(this,arguments); |
||
| 41 | } |
||
| 42 | _2.prototype.constructor.apply(this,arguments); |
||
| 43 | }; |
||
| 44 | for(var i=1;i<a.length;i++){ |
||
| 45 | for(var n in a[i].prototype){ |
||
| 46 | f.prototype[n]=a[i].prototype[n]; |
||
| 47 | } |
||
| 48 | } |
||
| 49 | for(n in _2.prototype){ |
||
| 50 | f.prototype[n]=_2.prototype[n]; |
||
| 51 | } |
||
| 52 | return f;
|
||
| 53 | }}; |
||
| 54 | } |