/*!

 * SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
 * (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
 * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
 */
sap.ui.define(['jquery.sap.global','./BarInPageEnabler'],function(q,B){"use strict";var a={};a.render=B.prototype.render;a.decorateRootElement=function(r,c){r.addClass("sapMBar");r.addClass(this.getContext(c));r.writeAccessibilityState(c,{role:"toolbar"});if(c.getTranslucent()&&(sap.ui.Device.support.touch||q.sap.simulateMobileOnDesktop)){r.addClass("sapMBarTranslucent");}r.addClass("sapMBar-CTX");};a.shouldAddIBarContext=function(){return true;};a.renderBarContent=function(r,c){var C="</div>";r.write("<div id='"+c.getId()+"-BarLeft' ");r.addClass('sapMBarLeft');r.addClass('sapMBarContainer');r.writeClasses();r.write(">");this.renderAllControls(c.getContentLeft(),r,c);r.write(C);r.write("<div id='"+c.getId()+"-BarMiddle' ");r.addClass('sapMBarMiddle');r.writeClasses();r.write(">");if(c.getEnableFlexBox()){c._oflexBox=c._oflexBox||new sap.m.HBox(c.getId()+"-BarPH",{alignItems:"Center"}).addStyleClass("sapMBarPH").setParent(c,null,true);c.getContentMiddle().forEach(function(m){c._oflexBox.addItem(m);});r.renderControl(c._oflexBox);}else{r.write("<div id='"+c.getId()+"-BarPH' ");r.addClass('sapMBarPH');r.addClass('sapMBarContainer');r.writeClasses();r.write(">");this.renderAllControls(c.getContentMiddle(),r,c);r.write(C);}r.write(C);r.write("<div id='"+c.getId()+"-BarRight'");r.addClass('sapMBarRight');r.addClass('sapMBarContainer');if(sap.ui.getCore().getConfiguration().getRTL()){r.addClass("sapMRTL");}r.writeClasses();r.write(">");this.renderAllControls(c.getContentRight(),r,c);r.write(C);};a.renderAllControls=function(c,r,b){c.forEach(function(C){sap.m.BarInPageEnabler.addChildClassTo(C,b);r.renderControl(C);});};a._mContexts={Header:"sapMHeader-CTX",SubHeader:"sapMSubHeader-CTX",Footer:"sapMFooter-CTX",Default:"sapMContent-CTX"};a.getContext=function(c){var d=c.getDesign(),C=a._mContexts;return C[d]||C.Default;};return a;},true);
