zhuguifei
2026-03-10 58402bd5e762361363a0f7d7907153c77dbb819f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
    @name Edo.containers.Application
    @class 
    @typeName app
    @description 自适应浏览器尺寸的顶级容器
    @extend Edo.containers.Box
*/ 
Edo.containers.Application = function(){    
    Edo.containers.Application.superclass.constructor.call(this);
};
Edo.containers.Application.extend(Edo.containers.Box, {
    fireTimer: null,
    
    /**
        @name Edo.containers.Application#minWidth
        @property
        @default 400
    */ 
    minWidth: 400,
    /**
        @name Edo.containers.Application#minHeight
        @property
        @default 200
    */ 
    minHeight: 200,
    
    elCls: 'e-app e-box e-div',
    
    notHasParent: 'the app module cannot have the father object',
    
    initEvents: function(){                
        if(!this.design){
            if(this.parent) throw new Error(this.notHasParent);
            Edo.util.Dom.on(window, 'resize', function(e){
            
                //if(isIE){
                    if(this.fireTimer) clearTimeout(this.fireTimer);                   
                    this.fireTimer = this.onWindowResize.defer(100, this, [e]);                   
    //            }else{
    //                this.onWindowResiz(e);
    //            }
            }, this);                        
        }
        Edo.containers.Application.superclass.initEvents.call(this);        
    },
    measure: function(){
        //if(this.id == 'design_app') debugger
        if(!this.design) this.syncViewSize();        
        Edo.containers.Application.superclass.measure.call(this);        
    },
    syncViewSize: function(){
        var dh = Edo.util.Dom, doc = document;
        
        
        var w = dh.getViewWidth(doc);
        var h = dh.getViewHeight(doc);
        
        this.width = w;
        this.height = h;
        
        
    },
    onWindowResize: function(e){    
        
        this.syncViewSize();
        
        this.relayout('size', this);
        
        this.fireTimer = null;
    }, 
//    render: function(dom){    
//        if(!this.design) dom = '#body';
//        Edo.containers.Application.superclass.render.call(this, dom);
//    },
    destroy : function(){
        //DomHelper.clearEvent(window);
        Edo.containers.Application.superclass.destroy.call(this);
    }
});
Edo.containers.Application.regType('app');