/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */
function QxMenuBarButton(vText,vMenu){QxWidget.call(this);this.setCanSelect(false);if(isValid(vText)){this.setText(vText);};if(isValid(vMenu)){this.setMenu(vMenu);};this.addEventListener("mouseover",this._onmouseover);this.addEventListener("mouseout",this._onmouseout);this.addEventListener("mousedown",this._g1);};QxMenuBarButton.extend(QxWidget,"QxMenuBarButton");QxMenuBarButton.addProperty({name:"text",type:String});QxMenuBarButton.addProperty({name:"menu"});QxMenuBarButton.addProperty({name:"status",type:String,defaultValue:"normal"});proto._modifyElement=function(_b1,_b2,_b3,_b4){QxWidget.prototype._modifyElement.call(this,_b1,_b2,_b3,_b4);if(_b1){if(!this._textNode){this._textNode=document.createTextNode(this.getText());};_b1.appendChild(this._textNode);}else if(_b2&&this._textNode){_b2.removeChild(this._textNode);};return true;};proto._modifyState=function(_b1,_b2,_b3,_b4){var vParent=this.getParent();if(vParent.getMenu()==this.getMenu()){if(_b1==null||_b1=="hover"){vParent.setMenu(null,_b4);};}else if(_b1=="pressed"){vParent.setMenu(this.getMenu(),_b4);};return QxWidget.prototype._modifyState.call(this,_b1,_b2,_b3,_b4);};proto._modifyText=function(_b1,_b2,_b3,_b4){if(!this.isCreated()){return true;};this._textNode.nodeValue=_b1;return true;};proto._modifyMenu=function(_b1,_b2,_b3,_b4){if(_b2){_b2.setOpener(null,_b4);};if(_b1){_b1.setOpener(this,_b4);};return true;};proto._onmouseover=function(e){var vMenu=this.getParent().getMenu();if(vMenu!=this.getMenu()){this.setState(vMenu?"pressed":"hover");};};proto._onmouseout=function(e){if(this.getState()=="hover"){this.setState(null);};};proto._g1=function(e){if(e.isNotLeftButton()){return;};this.setState(this.getState()=="pressed"?"hover":"pressed");e.setPropagationStopped(true);};proto.dispose=function(){if(this.getDisposed()){return;};this.removeEventListener("mouseover",this._onmouseover);this.removeEventListener("mouseout",this._onmouseout);this.removeEventListener("mousedown",this._g1);QxWidget.prototype.dispose.call(this);};