//>>built
define("dojox/app/controllers/Layout","dojo/_base/lang,dojo/_base/declare,dojo/sniff,dojo/on,dojo/_base/window,dojo/_base/array,dojo/_base/config,dojo/topic,dojo/query,dojo/dom-style,dojo/dom-attr,dojo/dom-geometry,dijit/registry,../Controller,../layout/utils".split(","),function(j,k,l,t,g,m,n,o,p,d,f,h,q,r,s){return k("dojox.app.controllers.Layout",r,{constructor:function(a,b){this.events={layout:this.layout,select:this.select};this.inherited(arguments);n.mblHideAddressBar?o.subscribe("/dojox/mobile/afterResizeAll",
j.hitch(this,this.onResize)):this.bind(g.global,l("ios")?"orientationchange":"resize",j.hitch(this,this.onResize))},onResize:function(){this._doResize(this.app)},layout:function(a){this._doResize(a.view,a.changeSize||null,a.resultSize||null)},_doLayout:function(a){if(a){var b;if(!a.selectedChild||!a.selectedChild.isFullScreen)b=p("> [data-app-region], > [region]",a.domNode).map(function(a){var b=q.getEnclosingWidget(a);return b?(b.region=f.get(a,"data-app-region")||f.get(a,"region"),b):{domNode:a,
region:f.get(a,"data-app-region")||f.get(a,"region")}}),a.selectedChild&&(b=m.filter(b,function(b){if("center"==b.region&&a.selectedChild&&a.selectedChild.domNode!==b.domNode)return d.set(b.domNode,"zIndex",25),d.set(b.domNode,"display","none"),!1;"center"!=b.region&&(d.set(b.domNode,"display",""),d.set(b.domNode,"zIndex",100));return b.domNode&&b.region},a));a._contentBox&&s.layoutChildren(a.domNode,a._contentBox,b)}},_doResize:function(a,b,c){var e=a.domNode;if(b){h.setMarginBox(e,b);if(b.t)e.style.top=
b.t+"px";if(b.l)e.style.left=b.l+"px"}c=c||{};j.mixin(c,b||{});if(!("h"in c)||!("w"in c))c=j.mixin(h.getMarginBox(e),c);if(a!==this.app){var b=d.getComputedStyle(e),i=h.getMarginExtents(e,b),f=h.getBorderExtents(e,b),c=a._borderBox={w:c.w-(i.w+f.w),h:c.h-(i.h+f.h)},i=h.getPadExtents(e,b);a._contentBox={l:d.toPixelValue(e,b.paddingLeft),t:d.toPixelValue(e,b.paddingTop),w:c.w-i.w,h:c.h-i.h}}else a._contentBox={l:0,t:0,h:g.global.innerHeight||g.doc.documentElement.clientHeight,w:g.global.innerWidth||
g.doc.documentElement.clientWidth};this._doLayout(a);a.selectedChild&&this._doResize(a.selectedChild)},select:function(a){var b=a.parent||this.app;if(a=a.view){if(a!==b.selectedChild)b.selectedChild&&d.set(b.selectedChild.domNode,"zIndex",25),d.set(a.domNode,"display",""),d.set(a.domNode,"zIndex",50),b.selectedChild=a;this._doResize(b)}}})});