1 sc_require("panes/pane"); 2 3 /** 4 Adds SC.Pane specific processes. 5 6 While it would be a little nicer to use didAppendToDocument, 7 willRemoveFromDocument and other functions, we cannot because they are public 8 callbacks and if a developer overrides them without knowing to call sc_super() 9 everything will fail. Instead, it's better to keep our static setup/remove 10 code private. 11 */ 12 SC.Pane.reopen({ 13 14 /** @private */ 15 _executeDoAttach: function () { 16 // hook into root responder 17 var responder = (this.rootResponder = SC.RootResponder.responder); 18 responder.panes.add(this); 19 20 // Update the currentWindowSize cache. 21 this.set('currentWindowSize', responder.currentWindowSize); 22 23 // Set the initial design mode. The responder will update this if it changes. 24 this.updateDesignMode(this.get('designMode'), responder.get('currentDesignMode')); 25 26 sc_super(); 27 28 // Legacy. 29 this.paneDidAttach(); 30 31 // Legacy? 32 this.recomputeDependentProperties(); 33 34 // handle intercept if needed 35 this._addIntercept(); 36 37 // If the layout is flexible (dependent on the window size), then the view 38 // will resize when appended. 39 if (!this.get('isFixedSize')) { 40 // We call viewDidResize so that it calls parentViewDidResize on all child views. 41 this.viewDidResize(); 42 } 43 }, 44 45 /** @private */ 46 _executeDoDetach: function () { 47 sc_super(); 48 49 // remove intercept 50 this._removeIntercept(); 51 52 // remove the pane 53 var rootResponder = this.rootResponder; 54 rootResponder.panes.remove(this); 55 this.rootResponder = null; 56 } 57 58 }); 59