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.RadContextMenuShowingEventArgs=function(_4,_5){
Telerik.Web.UI.RadContextMenuShowingEventArgs.initializeBase(this);
this._targetElement=_4;
this._domEvent=_5;
};
Telerik.Web.UI.RadContextMenuShowingEventArgs.prototype={get_targetElement:function(){
return this._targetElement;
},get_domEvent:function(){
return this._domEvent;
}};
Telerik.Web.UI.RadContextMenuShowingEventArgs.registerClass("Telerik.Web.UI.RadContextMenuShowingEventArgs",Sys.CancelEventArgs);
Telerik.Web.UI.RadContextMenuItemEventArgs=function(_6,_7,_8){
Telerik.Web.UI.RadContextMenuItemEventArgs.initializeBase(this,[_6,_8]);
this._targetElement=_7;
};
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(_9,_a,_b){
Telerik.Web.UI.RadContextMenuItemCancelEventArgs.initializeBase(this,[_9,_b]);
this._targetElement=_a;
};
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(_c){
Telerik.Web.UI.RadContextMenu.initializeBase(this,[_c]);
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 _d in Telerik.Web.UI.RadContextMenu.contextMenus){
Telerik.Web.UI.RadContextMenu.contextMenus[_d].hide();
}
};
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(_e,_f,_10){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_childInserted",[_e,_f,_10]);
if(_10._shown){
if(_f._getWidth()>0||_f.get_isSeparator()){
Telerik.Web.UI.RadMenu._adjustChildrenWidth(_10);
}
}
},_attachShowHandlers:function(){
var _11=$telerik.isOpera?"mousedown":"contextmenu";
var _12=this._getTargetElements();
for(var i=0;i<_12.length;i++){
$addHandler(_12[i],_11,this._elementContextMenu);
}
},_detachShowHandlers:function(){
var _14=$telerik.isOpera?"mousedown":"contextmenu";
var _15=this._getTargetElements();
for(var i=0;i<_15.length;i++){
var _17=_15[i];
try{
$removeHandler(_17,_14,this._elementContextMenu);
}
catch(ex){
}
}
},_documentClickHandler:function(e){
var _19=this._getContextMenuElement();
if(!$telerik.isDescendant(_19,e.target)){
this.close();
this._clicked=false;
this._hide(e);
}
},_itemClickedHandler:function(_1a,_1b){
if(!this.get_clickToOpen()){
this._hide(_1b.get_domEvent());
}
},_initializeAnimation:function(){
this._determineExpandDirection();
var _1c=this._getAnimatedElement();
if(_1c){
this._slide=new Telerik.Web.UI.Slide(_1c,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 _1d=this.get_defaultGroupSettings().get_expandDirection();
if(_1d==Telerik.Web.UI.ExpandDirection.Auto){
return null;
}
return _1d;
},_getScrollWrapElement:function(){
var _1e=this._getContextMenuElement();
if(!this._scrollWrapElement){
if(this.get_defaultGroupSettings().get_height()||this.get_defaultGroupSettings().get_width()){
this._scrollWrapElement=$telerik.getFirstChildByTagName(_1e,"div",0);
}
}
return this._scrollWrapElement;
},_getAnimatedElement:function(){
if(!this._animatedElement){
this._animatedElement=this._getScrollWrapElement()||this.get_childListElement();
}
return this._animatedElement;
},_determineExpandDirection:function(){
var _1f=this.get_defaultGroupSettings();
if(_1f.get_expandDirection()!=Telerik.Web.UI.ExpandDirection.Auto){
return;
}
_1f.set_expandDirection(Telerik.Web.UI.ExpandDirection.Down);
},_onExpandAnimationEnded:function(_20,e){
return;
if($telerik.isIE&&this._getScrollWrapElement()==null){
this._getAnimationContainer().style.overflow="hidden";
}
},_onExpandAnimationStarted:function(_22,e){
return;
if($telerik.isIE&&this._getScrollWrapElement()==null){
this._getAnimationContainer().style.overflow="auto";
}
},_onCollapseAnimationEnded:function(_24,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(_27){
switch(_27.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(_27.id));
break;
case Telerik.Web.UI.ContextMenuTargetType.TagName:
var _28=document.getElementsByTagName(_27.tagName);
for(var i=0;i<_28.length;i++){
this._addTargetElement(_28[i]);
}
break;
}
},_addTargetElement:function(_2a){
if(_2a){
this._targetElements[this._targetElements.length]=_2a;
}
},_adjustPositionForScreenBoundaries:function(_2b,top){
var _2d=$telerik.getViewPortSize();
var _2e=this._getContextMenuElement();
top=Math.min(top,_2d.height-_2e.offsetHeight);
if(this.get_rightToLeft()){
_2b=Math.max(0,_2b);
}else{
_2b=Math.min(_2b,_2d.width-_2e.offsetWidth);
}
if(isNaN(_2b)){
_2b=0;
}
if(isNaN(top)){
top=0;
}
this._getContextMenuElement().style.left=_2b+"px";
this._getContextMenuElement().style.top=top+"px";
},_detach:function(){
if(!$telerik.isIE||document.readyState=="complete"){
this._getContextMenuElement().parentNode.removeChild(this._getContextMenuElement());
document.forms[0].insertBefore(this._getContextMenuElement(),document.forms[0].firstChild);
this._detached=true;
}
},_getContextMenuElement:function(){
if(!this._contextMenuElement){
this._contextMenuElement=$telerik.getFirstChildByTagName(this.get_element(),"div",0);
}
return this._contextMenuElement;
},_isMainElementDescendant:function(_2f){
return $telerik.isDescendant(this._getContextMenuElement(),_2f);
},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(_30){
return new Telerik.Web.UI.RadContextMenuItemCancelEventArgs(_30.get_item(),this._targetElement,_30.get_domEvent());
},_getExtendedItemClickedEventArgs:function(_31){
return new Telerik.Web.UI.RadContextMenuItemEventArgs(_31.get_item(),this._targetElement,_31.get_domEvent());
},_updateScrollWrapSize:function(){
var _32=this._getScrollWrapElement();
var _33=this.get_childListElement();
if(!_32){
return;
}
if(!_32.style.height){
_32.style.height=_33.offsetHeight+"px";
}
_32.style.width=_33.offsetWidth+"px";
},_getAnimationContainer:function(){
return this._getContextMenuElement();
},_initializeScroller:function(){
var _34=this._getScrollWrapElement();
if(_34){
this._scroller=new Telerik.Web.UI.MenuItemScroller(this.get_childListElement(),Telerik.Web.UI.ItemFlow.Vertical);
this._scroller.initialize();
}
},_adjustRootItemsWidthOnShow:function(){
var _35=this.get_items();
var _36=_35.get_count();
for(var i=0;i<_36;i++){
var _38=_35.getItem(i);
var _39=_38.get_parent();
if(_38._adjustSiblingsWidthOnShow){
_38._adjustSiblingsWidth();
_38._adjustSiblingsWidthOnShow=false;
return;
}
}
},_onTopArrowMouseDown:function(e){
var _3b=this._extractItemFromDomElement(e.eventMapTarget);
if(_3b!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseUp:function(e){
var _3d=this._extractItemFromDomElement(e.eventMapTarget);
if(_3d!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseOver:function(e){
var _3f=this._extractItemFromDomElement(e.eventMapTarget);
if(_3f!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseOut:function(e){
var _41=this._extractItemFromDomElement(e.eventMapTarget);
if(_41!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Top);
},_onBottomArrowMouseDown:function(e){
var _43=this._extractItemFromDomElement(e.eventMapTarget);
if(_43!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseUp:function(e){
var _45=this._extractItemFromDomElement(e.eventMapTarget);
if(_45!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseOver:function(e){
var _47=this._extractItemFromDomElement(e.eventMapTarget);
if(_47!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseOut:function(e){
var _49=this._extractItemFromDomElement(e.eventMapTarget);
if(_49!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Bottom);
},_onLeftArrowMouseDown:function(e){
var _4b=this._extractItemFromDomElement(e.eventMapTarget);
if(_4b!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseUp:function(e){
var _4d=this._extractItemFromDomElement(e.eventMapTarget);
if(_4d!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseOver:function(e){
var _4f=this._extractItemFromDomElement(e.eventMapTarget);
if(_4f!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseOut:function(e){
var _51=this._extractItemFromDomElement(e.eventMapTarget);
if(_51!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Left);
},_onRightArrowMouseDown:function(e){
var _53=this._extractItemFromDomElement(e.eventMapTarget);
if(_53!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseUp:function(e){
var _55=this._extractItemFromDomElement(e.eventMapTarget);
if(_55!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseOver:function(e){
var _57=this._extractItemFromDomElement(e.eventMapTarget);
if(_57!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseOut:function(e){
var _59=this._extractItemFromDomElement(e.eventMapTarget);
if(_59!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Right);
},_onScrollArrowMouseDown:function(_5a){
if(!this._scroller){
return;
}
this._scroller.changeScrollSpeed(Telerik.Web.UI.ScrollerSpeed.Fast);
},_onScrollArrowMouseUp:function(_5b){
if(!this._scroller){
return;
}
this._scroller.changeScrollSpeed(Telerik.Web.UI.ScrollerSpeed.Slow);
},_onScrollArrowMouseOver:function(_5c){
if(!this._scroller){
return;
}
var _5d=1;
if(_5c==Telerik.Web.UI.ArrowPosition.Top||_5c==Telerik.Web.UI.ArrowPosition.Left){
_5d=-1;
}
this._scroller.startScroll(Telerik.Web.UI.ScrollerSpeed.Slow,_5d);
},_onScrollArrowMouseOut:function(_5e){
if(!this._scroller){
return;
}
this._scroller.stopScroll();
},_elementContextMenu:function(_5f){
if($telerik.isOpera){
if(_5f.button!=2){
return;
}
}
this.show(_5f);
},_showAt:function(_60,top,e){
Telerik.Web.UI.RadContextMenu.hideAll();
this._shown=true;
if(!this._detached){
this._detach();
this._getContextMenuElement().style.visibility="hidden";
this._getContextMenuElement().style.display="block";
this.repaint();
}
var _63=this._getAnimatedElement();
this._slide.show();
if(this._rightToLeft){
_60-=this._getContextMenuElement().offsetWidth;
}
this._getContextMenuElement().style.left=_60+"px";
this._getContextMenuElement().style.top=top+"px";
this._adjustRootItemsWidthOnShow();
this._updateScrollWrapSize();
this._slide.updateSize();
if(this.get_enableScreenBoundaryDetection()){
this._adjustPositionForScreenBoundaries(_60,top);
}
if(this._scroller){
this._scroller.updateState();
}
this._slide.expand();
this.raise_shown(new Telerik.Web.UI.RadContextMenuShownEventArgs(this._targetElement,e||null));
},_hide:function(e){
if(this._shown){
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 _65=this.get_openedItem();
if(_65){
_65.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(_66){
this._targets=_66;
},get_targets:function(){
return this._targets;
},get_contextMenuElement:function(){
return this._getContextMenuElement();
},show:function(e){
this._targetElement=e.target;
var _68=new Telerik.Web.UI.RadContextMenuShowingEventArgs(this._targetElement,e||null);
this.raise_showing(_68);
if(_68.get_cancel()){
return;
}
var _69=$telerik.getDocumentRelativeCursorPosition(e);
this._showAt(_69.left,_69.top,e);
$telerik.cancelRawEvent(e);
},showAt:function(_6a,top){
this._showAt(_6a,top,null);
},hide:function(){
this._hide(null);
},add_showing:function(_6c){
this.get_events().addHandler("showing",_6c);
},remove_showing:function(_6d){
this.get_events().removeHandler("showing",_6d);
},raise_showing:function(_6e){
if(this._fireEvents){
this.raiseEvent("showing",_6e);
}
},add_shown:function(_6f){
this.get_events().addHandler("shown",_6f);
},remove_shown:function(_70){
this.get_events().removeHandler("shown",_70);
},raise_shown:function(_71){
if(this._fireEvents){
this.raiseEvent("shown",_71);
}
},add_hidden:function(_72){
this.get_events().addHandler("hidden",_72);
},remove_hidden:function(_73){
this.get_events().removeHandler("hidden",_73);
},raise_hidden:function(_74){
if(this._fireEvents){
this.raiseEvent("hidden",_74);
}
}};
Telerik.Web.UI.RadContextMenu.registerClass("Telerik.Web.UI.RadContextMenu",Telerik.Web.UI.RadMenu);

