Telerik.Web.UI.RadContextMenuEventArgs=function(_1){
Telerik.Web.UI.RadContextMenuEventArgs.initializeBase(this);
this._domEvent=_1||null;
};
Telerik.Web.UI.RadContextMenuEventArgs.prototype={get_domEvent:function(){
return this._domEvent;
}};
Telerik.Web.UI.RadContextMenuEventArgs.registerClass("Telerik.Web.UI.RadContextMenuEventArgs",Sys.EventArgs);
Telerik.Web.UI.RadContextMenuShownEventArgs=function(_2,_3){
Telerik.Web.UI.RadContextMenuShownEventArgs.initializeBase(this);
this._targetElement=_2;
this._domEvent=_3||null;
};
Telerik.Web.UI.RadContextMenuShownEventArgs.prototype={get_targetElement:function(){
return this._targetElement;
},get_domEvent:function(){
return this._domEvent;
}};
Telerik.Web.UI.RadContextMenuShownEventArgs.registerClass("Telerik.Web.UI.RadContextMenuShownEventArgs",Sys.EventArgs);
Telerik.Web.UI.RadContextMenuCancelEventArgs=function(_4,_5){
Telerik.Web.UI.RadContextMenuCancelEventArgs.initializeBase(this);
this._targetElement=_4;
this._domEvent=_5;
};
Telerik.Web.UI.RadContextMenuCancelEventArgs.prototype={get_targetElement:function(){
return this._targetElement;
},get_domEvent:function(){
return this._domEvent;
}};
Telerik.Web.UI.RadContextMenuCancelEventArgs.registerClass("Telerik.Web.UI.RadContextMenuCancelEventArgs",Sys.CancelEventArgs);
Telerik.Web.UI.RadContextMenuShowingEventArgs=function(_6,_7){
Telerik.Web.UI.RadContextMenuShowingEventArgs.initializeBase(this,[_6,_7]);
};
Telerik.Web.UI.RadContextMenuShowingEventArgs.registerClass("Telerik.Web.UI.RadContextMenuShowingEventArgs",Telerik.Web.UI.RadContextMenuCancelEventArgs);
Telerik.Web.UI.RadContextMenuItemEventArgs=function(_8,_9,_a){
Telerik.Web.UI.RadContextMenuItemEventArgs.initializeBase(this,[_8,_a]);
this._targetElement=_9;
};
Telerik.Web.UI.RadContextMenuItemEventArgs.prototype={get_targetElement:function(){
return this._targetElement;
}};
Telerik.Web.UI.RadContextMenuItemEventArgs.registerClass("Telerik.Web.UI.RadContextMenuItemEventArgs",Telerik.Web.UI.RadMenuItemEventArgs);
Telerik.Web.UI.RadContextMenuItemCancelEventArgs=function(_b,_c,_d){
Telerik.Web.UI.RadContextMenuItemCancelEventArgs.initializeBase(this,[_b,_d]);
this._targetElement=_c;
};
Telerik.Web.UI.RadContextMenuItemCancelEventArgs.prototype={get_targetElement:function(){
return this._targetElement;
}};
Telerik.Web.UI.RadContextMenuItemCancelEventArgs.registerClass("Telerik.Web.UI.RadContextMenuItemCancelEventArgs",Telerik.Web.UI.RadMenuItemCancelEventArgs);
Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.ContextMenuTargetType=function(){
throw Error.notImplemented();
};
Telerik.Web.UI.ContextMenuTargetType.prototype={Control:0,Element:1,TagName:2,Document:3};
Telerik.Web.UI.ContextMenuTargetType.registerEnum("Telerik.Web.UI.ContextMenuTargetType");
Telerik.Web.UI.RadContextMenu=function(_e){
Telerik.Web.UI.RadContextMenu.initializeBase(this,[_e]);
this._targets=[];
this._targetElements=null;
this._shown=false;
this._scrollWrapElement=null;
this._scroller=null;
this._animatedElement=null;
this._slide=null;
this._collapseAnimationEndedDelegate=null;
this._detached=false;
this._currentTarget=null;
};
Telerik.Web.UI.RadContextMenu.contextMenus={};
Telerik.Web.UI.RadContextMenu.hideAll=function(){
for(var _f in Telerik.Web.UI.RadContextMenu.contextMenus){
Telerik.Web.UI.RadContextMenu.contextMenus[_f].hide();
}
};
Telerik.Web.UI.RadContextMenu._getAllHidden=function(){
for(var _10 in Telerik.Web.UI.RadContextMenu.contextMenus){
if(Telerik.Web.UI.RadContextMenu.contextMenus[_10]._shown){
return false;
}
}
return true;
};
Telerik.Web.UI.RadContextMenu.prototype={initialize:function(){
this.get_element().style.display="block";
this.get_element().style.visibility="hidden";
this._getContextMenuElement().style.display="block";
this._getContextMenuElement().style.visibility="hidden";
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"initialize");
this._getContextMenuElement().style.display="none";
this._getContextMenuElement().style.visibility="visible";
this.get_element().style.display="none";
this.get_element().style.visibility="visible";
this._getContextMenuElement().style.zIndex=this._originalZIndex;
this.get_childListElement().style.cssFloat="left";
Telerik.Web.UI.RadContextMenu.contextMenus[this.get_id()]=this;
this._elementContextMenu=Function.createDelegate(this,this._elementContextMenu);
this._attachShowHandlers();
this._documentClickHandler=Function.createDelegate(this,this._documentClickHandler);
$addHandler(document,"click",this._documentClickHandler);
this._itemClickedHandler=Function.createDelegate(this,this._itemClickedHandler);
this.add_itemClicked(this._itemClickedHandler);
this._initializeAnimation();
this._initializeScroller();
},dispose:function(){
if(this._detached){
this.attachContextMenu();
}
$removeHandler(document,"click",this._documentClickHandler);
this._detachShowHandlers();
this._targetElements=null;
this._contextMenuElement=null;
if(this._collapseAnimationEndedDelegate){
if(this._slide){
this._slide.remove_collapseAnimationEnded(this._collapseAnimationEndedDelegate);
}
this._collapseAnimationEndedDelegate=null;
}
if(this._slide){
this._slide.dispose();
this._slide=null;
}
if(this._scroller){
this._scroller.dispose();
this._scroller=null;
}
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"dispose");
},_initializeEventMap:function(){
this._eventMap.initialize(this,this._getContextMenuElement());
},_childInserted:function(_11,_12,_13){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_childInserted",[_11,_12,_13]);
if(_13._shown){
if(_12._getWidth()>0||_12.get_isSeparator()){
Telerik.Web.UI.RadMenu._adjustChildrenWidth(_13);
}
}
},_attachShowHandlers:function(){
var _14=$telerik.isOpera?"mousedown":"contextmenu";
var _15=this._getTargetElements();
for(var i=0;i<_15.length;i++){
$addHandler(_15[i],_14,this._elementContextMenu);
}
},_detachShowHandlers:function(){
var _17=$telerik.isOpera?"mousedown":"contextmenu";
var _18=this._getTargetElements();
for(var i=0;i<_18.length;i++){
var _1a=_18[i];
try{
$removeHandler(_1a,_17,this._elementContextMenu);
}
catch(ex){
}
}
},_documentClickHandler:function(e){
var _1c=this._getContextMenuElement();
if(!$telerik.isDescendant(_1c,e.target)){
this.close();
this._clicked=false;
this._hide(e);
}
},_itemClickedHandler:function(_1d,_1e){
if(!this.get_clickToOpen()){
this._hide(_1e.get_domEvent());
}
},_initializeAnimation:function(){
this._determineExpandDirection();
var _1f=this._getAnimatedElement();
if(_1f){
this._slide=new Telerik.Web.UI.Slide(_1f,this.get_expandAnimation(),this.get_collapseAnimation());
this._slide.initialize();
this._slide.set_direction(this._getSlideDirection());
this._collapseAnimationEndedDelegate=Function.createDelegate(this,this._onCollapseAnimationEnded);
this._slide.add_collapseAnimationEnded(this._collapseAnimationEndedDelegate);
this._expandAnimationStartedDelegate=Function.createDelegate(this,this._onExpandAnimationStarted);
this._slide.add_expandAnimationStarted(this._expandAnimationStartedDelegate);
this._expandAnimationEndedDelegate=Function.createDelegate(this,this._onExpandAnimationEnded);
this._slide.add_expandAnimationEnded(this._expandAnimationEndedDelegate);
}
},_getRtlClassName:function(){
return "rmRtlContext";
},_getMainElement:function(){
return this._getContextMenuElement();
},_getSlideDirection:function(){
var _20=this.get_defaultGroupSettings().get_expandDirection();
if(_20==Telerik.Web.UI.ExpandDirection.Auto){
return null;
}
return _20;
},_getScrollWrapElement:function(){
var _21=this._getContextMenuElement();
if(!this._scrollWrapElement){
if(this.get_defaultGroupSettings().get_height()||this.get_defaultGroupSettings().get_width()){
this._scrollWrapElement=$telerik.getFirstChildByTagName(_21,"div",0);
}
}
return this._scrollWrapElement;
},_getAnimatedElement:function(){
if(!this._animatedElement){
this._animatedElement=this._getScrollWrapElement()||this.get_childListElement();
}
return this._animatedElement;
},_determineExpandDirection:function(){
var _22=this.get_defaultGroupSettings();
if(_22.get_expandDirection()!=Telerik.Web.UI.ExpandDirection.Auto){
return;
}
_22.set_expandDirection(Telerik.Web.UI.ExpandDirection.Down);
},_onExpandAnimationEnded:function(_23,e){
return;
if($telerik.isIE&&this._getScrollWrapElement()==null){
this._getAnimationContainer().style.overflow="hidden";
}
},_onExpandAnimationStarted:function(_25,e){
return;
if($telerik.isIE&&this._getScrollWrapElement()==null){
this._getAnimationContainer().style.overflow="auto";
}
},_onCollapseAnimationEnded:function(_27,e){
this._restoreZIndex();
},_getTargetElements:function(){
if(this._targetElements==null){
this._targetElements=[];
for(var i=0;i<this._targets.length;i++){
this._addTargetElements(this._targets[i]);
}
}
return this._targetElements;
},_addTargetElements:function(_2a){
switch(_2a.type){
case Telerik.Web.UI.ContextMenuTargetType.Document:
this._addTargetElement(document);
break;
case Telerik.Web.UI.ContextMenuTargetType.Control:
case Telerik.Web.UI.ContextMenuTargetType.Element:
this._addTargetElement($get(_2a.id));
break;
case Telerik.Web.UI.ContextMenuTargetType.TagName:
var _2b=document.getElementsByTagName(_2a.tagName);
for(var i=0;i<_2b.length;i++){
this._addTargetElement(_2b[i]);
}
break;
}
},_addTargetElement:function(_2d){
if(_2d){
this._targetElements[this._targetElements.length]=_2d;
}
},_adjustPositionForScreenBoundaries:function(_2e,top){
var _30=$telerik.getViewPortSize();
var _31=this._getContextMenuElement();
top=Math.min(top,_30.height-_31.offsetHeight);
if(this.get_rightToLeft()){
_2e=Math.max(0,_2e);
}else{
_2e=Math.min(_2e,_30.width-_31.offsetWidth);
}
if(isNaN(_2e)){
_2e=0;
}
if(isNaN(top)){
top=0;
}
this._getContextMenuElement().style.left=_2e+"px";
this._getContextMenuElement().style.top=top+"px";
},_detach:function(){
if(!$telerik.isIE||document.readyState=="complete"){
this._getContextMenuElement().parentNode.removeChild(this._getContextMenuElement());
var _32=document.forms[0]||document.body;
_32.insertBefore(this._getContextMenuElement(),_32.firstChild);
this._detached=true;
}
},_getContextMenuElement:function(){
if(!this._contextMenuElement){
this._contextMenuElement=$telerik.getFirstChildByTagName(this.get_element(),"div",0);
}
return this._contextMenuElement;
},_isMainElementDescendant:function(_33){
return $telerik.isDescendant(this._getContextMenuElement(),_33);
},attachContextMenu:function(){
if(!this._detached){
return;
}
this._getContextMenuElement().parentNode.removeChild(this._getContextMenuElement());
this.get_element().insertBefore(this._getContextMenuElement(),$get(this.get_clientStateFieldID()));
this._detached=false;
},_getExtendedItemClickingEventArgs:function(_34){
return new Telerik.Web.UI.RadContextMenuItemCancelEventArgs(_34.get_item(),this._targetElement,_34.get_domEvent());
},_getExtendedItemClickedEventArgs:function(_35){
return new Telerik.Web.UI.RadContextMenuItemEventArgs(_35.get_item(),this._targetElement,_35.get_domEvent());
},_updateScrollWrapSize:function(){
var _36=this._getScrollWrapElement();
var _37=this.get_childListElement();
if(!_36){
return;
}
if(!_36.style.height){
_36.style.height=_37.offsetHeight+"px";
}
_36.style.width=_37.offsetWidth+"px";
},_getAnimationContainer:function(){
return this._getContextMenuElement();
},_initializeScroller:function(){
var _38=this._getScrollWrapElement();
if(_38){
this._scroller=new Telerik.Web.UI.MenuItemScroller(this.get_childListElement(),Telerik.Web.UI.ItemFlow.Vertical);
this._scroller.initialize();
}
},_adjustRootItemsWidthOnShow:function(){
var _39=this.get_items();
var _3a=_39.get_count();
for(var i=0;i<_3a;i++){
var _3c=_39.getItem(i);
var _3d=_3c.get_parent();
if(_3c._adjustSiblingsWidthOnShow){
_3c._adjustSiblingsWidth();
_3c._adjustSiblingsWidthOnShow=false;
return;
}
}
},_onTopArrowMouseDown:function(e){
var _3f=this._extractItemFromDomElement(e.eventMapTarget);
if(_3f!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseUp:function(e){
var _41=this._extractItemFromDomElement(e.eventMapTarget);
if(_41!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseOver:function(e){
var _43=this._extractItemFromDomElement(e.eventMapTarget);
if(_43!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseOut:function(e){
var _45=this._extractItemFromDomElement(e.eventMapTarget);
if(_45!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Top);
},_onBottomArrowMouseDown:function(e){
var _47=this._extractItemFromDomElement(e.eventMapTarget);
if(_47!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseUp:function(e){
var _49=this._extractItemFromDomElement(e.eventMapTarget);
if(_49!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseOver:function(e){
var _4b=this._extractItemFromDomElement(e.eventMapTarget);
if(_4b!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseOut:function(e){
var _4d=this._extractItemFromDomElement(e.eventMapTarget);
if(_4d!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Bottom);
},_onLeftArrowMouseDown:function(e){
var _4f=this._extractItemFromDomElement(e.eventMapTarget);
if(_4f!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseUp:function(e){
var _51=this._extractItemFromDomElement(e.eventMapTarget);
if(_51!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseOver:function(e){
var _53=this._extractItemFromDomElement(e.eventMapTarget);
if(_53!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseOut:function(e){
var _55=this._extractItemFromDomElement(e.eventMapTarget);
if(_55!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Left);
},_onRightArrowMouseDown:function(e){
var _57=this._extractItemFromDomElement(e.eventMapTarget);
if(_57!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseUp:function(e){
var _59=this._extractItemFromDomElement(e.eventMapTarget);
if(_59!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseOver:function(e){
var _5b=this._extractItemFromDomElement(e.eventMapTarget);
if(_5b!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseOut:function(e){
var _5d=this._extractItemFromDomElement(e.eventMapTarget);
if(_5d!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Right);
},_onScrollArrowMouseDown:function(_5e){
if(!this._scroller){
return;
}
this._scroller.changeScrollSpeed(Telerik.Web.UI.ScrollerSpeed.Fast);
},_onScrollArrowMouseUp:function(_5f){
if(!this._scroller){
return;
}
this._scroller.changeScrollSpeed(Telerik.Web.UI.ScrollerSpeed.Slow);
},_onScrollArrowMouseOver:function(_60){
if(!this._scroller){
return;
}
var _61=1;
if(_60==Telerik.Web.UI.ArrowPosition.Top||_60==Telerik.Web.UI.ArrowPosition.Left){
_61=-1;
}
this._scroller.startScroll(Telerik.Web.UI.ScrollerSpeed.Slow,_61);
},_onScrollArrowMouseOut:function(_62){
if(!this._scroller){
return;
}
this._scroller.stopScroll();
},_elementContextMenu:function(_63){
if($telerik.isOpera){
if(_63.button!=2){
return;
}
}
this.show(_63);
},_showAt:function(_64,top,e){
Telerik.Web.UI.RadContextMenu.hideAll();
if(!Telerik.Web.UI.RadContextMenu._getAllHidden()){
return;
}
this._shown=true;
if(!this._detached){
this._detach();
this._getContextMenuElement().style.visibility="hidden";
this._getContextMenuElement().style.display="block";
this.repaint();
}
var _67=this._getAnimatedElement();
this._slide.show();
if(this._rightToLeft){
_64-=this._getContextMenuElement().offsetWidth;
}
this._getContextMenuElement().style.left=_64+"px";
this._getContextMenuElement().style.top=top+"px";
this._adjustRootItemsWidthOnShow();
this._updateScrollWrapSize();
this._slide.updateSize();
if(this.get_enableScreenBoundaryDetection()){
this._adjustPositionForScreenBoundaries(_64,top);
}
if(this._scroller){
this._scroller.updateState();
}
this._getContextMenuElement().style.visibility="visible";
this._slide.expand();
this.raise_shown(new Telerik.Web.UI.RadContextMenuShownEventArgs(this._targetElement,e||null));
},_hide:function(e){
if(!this._shown){
return;
}
var _69=new Telerik.Web.UI.RadContextMenuCancelEventArgs(this._targetElement,e||null);
this.raise_hiding(_69);
if(_69.get_cancel()){
return;
}
this._shown=false;
this._slide.collapse();
this.raise_hidden(new Telerik.Web.UI.RadContextMenuEventArgs(e||null));
this._targetElement=null;
this._clicked=false;
if(this._focusedItem){
this._focusedItem._doBlur();
}
var _6a=this.get_openedItem();
if(_6a){
_6a.close();
}
},get_childListElement:function(){
if(this._getScrollWrapElement()){
this._childListElement=$telerik.getFirstChildByTagName(this._getScrollWrapElement(),"ul",0);
}
if(!this._childListElement){
this._childListElement=$telerik.getFirstChildByTagName(this._getContextMenuElement(),"ul",0);
}
return this._childListElement;
},set_targets:function(_6b){
this._targets=_6b;
},get_targets:function(){
return this._targets;
},get_contextMenuElement:function(){
return this._getContextMenuElement();
},show:function(e){
if(this._shown){
this._hide();
}
this._targetElement=e.target;
var _6d=new Telerik.Web.UI.RadContextMenuShowingEventArgs(this._targetElement,e||null);
this.raise_showing(_6d);
if(_6d.get_cancel()){
return;
}
var _6e=$telerik.getDocumentRelativeCursorPosition(e);
this._showAt(_6e.left,_6e.top,e);
$telerik.cancelRawEvent(e);
},showAt:function(_6f,top){
this._showAt(_6f,top,null);
},hide:function(){
this._hide(null);
},add_showing:function(_71){
this.get_events().addHandler("showing",_71);
},remove_showing:function(_72){
this.get_events().removeHandler("showing",_72);
},raise_showing:function(_73){
if(this._fireEvents){
this.raiseEvent("showing",_73);
}
},raise_hiding:function(_74){
if(this._fireEvents){
this.raiseEvent("hiding",_74);
}
},add_shown:function(_75){
this.get_events().addHandler("shown",_75);
},remove_shown:function(_76){
this.get_events().removeHandler("shown",_76);
},raise_shown:function(_77){
if(this._fireEvents){
this.raiseEvent("shown",_77);
}
},add_hiding:function(_78){
this.get_events().addHandler("hiding",_78);
},remove_hiding:function(_79){
this.get_events().removeHandler("hiding",_79);
},add_hidden:function(_7a){
this.get_events().addHandler("hidden",_7a);
},remove_hidden:function(_7b){
this.get_events().removeHandler("hidden",_7b);
},raise_hidden:function(_7c){
if(this._fireEvents){
this.raiseEvent("hidden",_7c);
}
}};
Telerik.Web.UI.RadContextMenu.registerClass("Telerik.Web.UI.RadContextMenu",Telerik.Web.UI.RadMenu);

