/* *******************************************************
#kesrequire(share/webwidgets/ui/root/Attach.js)
#kesrequire(share/webwidgets/ui/core/MChildrenHandling.js)
******************************************************* */

/**
 * Root-Widget fuer Popups.
 * Legt fuer jedes Popup gleich das Blocker-Element mit an.
 * Dies ist notwendig damit der IE nicht mit den ZIndex-Werten rumspinnt.
 */
qx.Class.define("nx4.webwidgets.ui.popup.Root",
{
  extend : nx4.webwidgets.ui.root.Attach,

  construct : function(domElem)
  {
    this.base(arguments, domElem);
    this._blocker = {};
  },

  members :
  {
    _blocker : null,

    add : function(child, options)
    {
      var el = new qx.html.Blocker();
      this.getContentElement().add(el)
      this._blocker[child.toHashCode()] = el
      this._add(child, options);
    },

    showBlocker : function(child)
    {
      var el = this._blocker[child.toHashCode()];
      el.setStyles(
      {
        top : "0px",
        left: "0px",
        width : qx.bom.Document.getWidth()+"px",
        height : qx.bom.Document.getHeight()+"px",
        opacity : child.getBlockerOpacity(),
        backgroundColor : child.getBlockerColor(),
        zIndex : child.getZIndex()-2
      });
      el.show();
    },

    hideBlocker : function(child)
    {
      var el = this._blocker[child.toHashCode()];
      el.hide();
    }
  }
});
