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;
this._originalDomPositionHelper=null;
this._postbackInitiated=false;
};
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";
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"initialize");
this.get_element().style.display="none";
this.get_element().style.visibility="visible";
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();
this._initOriginalDomPositionHelper();
this._beforePostbackHandler=Function.createDelegate(this,this._beforePostBack);
Telerik.Web.UI.PostbackWrapper.add_beforePostback(this._beforePostbackHandler);
if(Sys.WebForms&&Sys.WebForms.PageRequestManager){
this._endRequestHandler=Function.createDelegate(this,this._onEndRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._endRequestHandler);
}
},dispose:function(){
$removeHandler(document,"click",this._documentClickHandler);
if(Sys.WebForms&&Sys.WebForms.PageRequestManager){
Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler);
}
Telerik.Web.UI.PostbackWrapper.remove_beforePostback(this._beforePostbackHandler);
this._originalDomPositionHelper=null;
this._detachShowHandlers();
this._targetElements=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");
},_childInserted:function(_e,_f,_10){
Telerik.Web.UI.RadMenu.callBaseMethod(this,"_childInserted",[_e,_f,_10]);
if(_10._shown){
if(_f._getWidth()>0||_f.get_isSeparator()){
Telerik.Web.UI.RadMenu._adjustChildrenWidth(_10);
}
}
},_onEndRequest:function(_11,_12){
this._postbackInitiated=false;
},_attachShowHandlers:function(){
var _13=$telerik.isOpera?"mousedown":"contextmenu";
var _14=this._getTargetElements();
for(var i=0;i<_14.length;i++){
$addHandler(_14[i],_13,this._elementContextMenu);
}
},_detachShowHandlers:function(){
var _16=$telerik.isOpera?"mousedown":"contextmenu";
var _17=this._getTargetElements();
for(var i=0;i<_17.length;i++){
var _19=_17[i];
try{
$removeHandler(_19,_16,this._elementContextMenu);
}
catch(ex){
}
}
},_documentClickHandler:function(e){
var _1b=this.get_element();
if(!$telerik.isDescendant(_1b,e.target)){
this.close();
this._clicked=false;
this._hide(e);
}
},_itemClickedHandler:function(_1c,_1d){
if(!this.get_clickToOpen()){
this._hide(_1d.get_domEvent());
}
},_initializeAnimation:function(){
this._determineExpandDirection();
var _1e=this._getAnimatedElement();
if(_1e){
this._slide=new Telerik.Web.UI.Slide(_1e,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);
}
},_getRtlClassName:function(){
return "rmRtlContext";
},_getSlideDirection:function(){
var _1f=this.get_defaultGroupSettings().get_expandDirection();
if(_1f==Telerik.Web.UI.ExpandDirection.Auto){
return null;
}
return _1f;
},_getScrollWrapElement:function(){
var _20=this.get_element();
if(!this._scrollWrapElement){
if(this.get_defaultGroupSettings().get_height()||this.get_defaultGroupSettings().get_width()){
this._scrollWrapElement=$telerik.getFirstChildByTagName(_20,"div",0);
}
}
return this._scrollWrapElement;
},_getAnimatedElement:function(){
if(!this._animatedElement){
this._animatedElement=this._getScrollWrapElement()||this.get_childListElement();
}
return this._animatedElement;
},_determineExpandDirection:function(){
var _21=this.get_defaultGroupSettings();
if(_21.get_expandDirection()!=Telerik.Web.UI.ExpandDirection.Auto){
return;
}
_21.set_expandDirection(Telerik.Web.UI.ExpandDirection.Down);
},_onCollapseAnimationEnded:function(_22,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(_25){
switch(_25.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(_25.id));
break;
case Telerik.Web.UI.ContextMenuTargetType.TagName:
var _26=document.getElementsByTagName(_25.tagName);
for(var i=0;i<_26.length;i++){
this._addTargetElement(_26[i]);
}
break;
}
},_addTargetElement:function(_28){
if(_28){
this._targetElements[this._targetElements.length]=_28;
}
},_adjustPositionForScreenBoundaries:function(_29,top){
var _2b=$telerik.getViewPortSize();
_29=Math.min(_29,_2b.width-this.get_element().offsetWidth);
top=Math.min(top,_2b.height-this.get_element().offsetHeight);
if(isNaN(_29)){
_29=0;
}
if(isNaN(top)){
top=0;
}
this.get_element().style.left=_29+"px";
this.get_element().style.top=top+"px";
},_initOriginalDomPositionHelper:function(){
this._originalDomPositionHelper=document.createElement("span");
this.get_element().parentNode.insertBefore(this._originalDomPositionHelper,this.get_element());
var _2c=$get(this.get_clientStateFieldID());
_2c.parentNode.removeChild(_2c);
this._originalDomPositionHelper.parentNode.insertBefore(_2c,this._originalDomPositionHelper);
},_detach:function(){
if(!$telerik.isIE||document.readyState=="complete"){
this.get_element().parentNode.removeChild(this.get_element());
document.forms[0].insertBefore(this.get_element(),document.forms[0].firstChild);
this._detached=true;
}
},_beforePostBack:function(){
this._postbackInitiated=true;
this._reAttach();
},_reAttach:function(){
this.get_element().parentNode.removeChild(this.get_element());
this._originalDomPositionHelper.parentNode.insertBefore(this.get_element(),this._originalDomPositionHelper);
this._detached=false;
},_getExtendedItemClickingEventArgs:function(_2d){
return new Telerik.Web.UI.RadContextMenuItemCancelEventArgs(_2d.get_item(),this._targetElement);
},_getExtendedItemClickedEventArgs:function(_2e){
return new Telerik.Web.UI.RadContextMenuItemEventArgs(_2e.get_item(),this._targetElement);
},_updateScrollWrapSize:function(){
var _2f=this._getScrollWrapElement();
var _30=this.get_childListElement();
if(!_2f){
return;
}
if(!_2f.style.height){
_2f.style.height=_30.offsetHeight+"px";
}
_2f.style.width=_30.offsetWidth+"px";
},_getAnimationContainer:function(){
return this.get_element();
},_initializeScroller:function(){
var _31=this._getScrollWrapElement();
if(_31){
this._scroller=new Telerik.Web.UI.MenuItemScroller(this.get_childListElement(),Telerik.Web.UI.ItemFlow.Vertical);
this._scroller.initialize();
}
},_adjustRootItemsWidthOnShow:function(){
var _32=this.get_items();
var _33=_32.get_count();
for(var i=0;i<_33;i++){
var _35=_32.getItem(i);
var _36=_35.get_parent();
if(_35._adjustSiblingsWidthOnShow){
_35._adjustSiblingsWidth();
_35._adjustSiblingsWidthOnShow=false;
return;
}
}
},_onTopArrowMouseDown:function(e){
var _38=this._extractItemFromDomElement(e.eventMapTarget);
if(_38!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseUp:function(e){
var _3a=this._extractItemFromDomElement(e.eventMapTarget);
if(_3a!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseOver:function(e){
var _3c=this._extractItemFromDomElement(e.eventMapTarget);
if(_3c!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Top);
},_onTopArrowMouseOut:function(e){
var _3e=this._extractItemFromDomElement(e.eventMapTarget);
if(_3e!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Top);
},_onBottomArrowMouseDown:function(e){
var _40=this._extractItemFromDomElement(e.eventMapTarget);
if(_40!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseUp:function(e){
var _42=this._extractItemFromDomElement(e.eventMapTarget);
if(_42!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseOver:function(e){
var _44=this._extractItemFromDomElement(e.eventMapTarget);
if(_44!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Bottom);
},_onBottomArrowMouseOut:function(e){
var _46=this._extractItemFromDomElement(e.eventMapTarget);
if(_46!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Bottom);
},_onLeftArrowMouseDown:function(e){
var _48=this._extractItemFromDomElement(e.eventMapTarget);
if(_48!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseUp:function(e){
var _4a=this._extractItemFromDomElement(e.eventMapTarget);
if(_4a!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseOver:function(e){
var _4c=this._extractItemFromDomElement(e.eventMapTarget);
if(_4c!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Left);
},_onLeftArrowMouseOut:function(e){
var _4e=this._extractItemFromDomElement(e.eventMapTarget);
if(_4e!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Left);
},_onRightArrowMouseDown:function(e){
var _50=this._extractItemFromDomElement(e.eventMapTarget);
if(_50!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseDown",[e]);
return;
}
this._onScrollArrowMouseDown(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseUp:function(e){
var _52=this._extractItemFromDomElement(e.eventMapTarget);
if(_52!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseUp",[e]);
return;
}
this._onScrollArrowMouseUp(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseOver:function(e){
var _54=this._extractItemFromDomElement(e.eventMapTarget);
if(_54!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseOver",[e]);
return;
}
this._onScrollArrowMouseOver(Telerik.Web.UI.ArrowPosition.Right);
},_onRightArrowMouseOut:function(e){
var _56=this._extractItemFromDomElement(e.eventMapTarget);
if(_56!=null){
Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseOut",[e]);
return;
}
this._onScrollArrowMouseOut(Telerik.Web.UI.ArrowPosition.Right);
},_onScrollArrowMouseDown:function(_57){
if(!this._scroller){
return;
}
this._scroller.changeScrollSpeed(Telerik.Web.UI.ScrollerSpeed.Fast);
},_onScrollArrowMouseUp:function(_58){
if(!this._scroller){
return;
}
this._scroller.changeScrollSpeed(Telerik.Web.UI.ScrollerSpeed.Slow);
},_onScrollArrowMouseOver:function(_59){
if(!this._scroller){
return;
}
var _5a=1;
if(_59==Telerik.Web.UI.ArrowPosition.Top||_59==Telerik.Web.UI.ArrowPosition.Left){
_5a=-1;
}
this._scroller.startScroll(Telerik.Web.UI.ScrollerSpeed.Slow,_5a);
},_onScrollArrowMouseOut:function(_5b){
if(!this._scroller){
return;
}
this._scroller.stopScroll();
},_elementContextMenu:function(_5c){
if($telerik.isOpera){
if(_5c.button!=2){
return;
}
}
this.show(_5c);
},_showAt:function(_5d,top,e){
if(this._postbackInitiated){
return;
}
Telerik.Web.UI.RadContextMenu.hideAll();
this._shown=true;
if(!this._detached){
this._detach();
}
var _60=this._getAnimatedElement();
this._slide.show();
if(this._rightToLeft){
_5d-=this.get_element().offsetWidth;
}
this.get_element().style.left=_5d+"px";
this.get_element().style.top=top+"px";
if(this.get_enableScreenBoundaryDetection()){
this._adjustPositionForScreenBoundaries(_5d,top);
}
this._adjustRootItemsWidthOnShow();
this._updateScrollWrapSize();
this._slide.updateSize();
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 _62=this.get_openedItem();
if(_62){
_62.close();
}
}
},get_childListElement:function(){
if(this._getScrollWrapElement()){
this._childListElement=$telerik.getFirstChildByTagName(this._getScrollWrapElement(),"ul",0);
}
return Telerik.Web.UI.RadContextMenu.callBaseMethod(this,"get_childListElement");
},set_targets:function(_63){
this._targets=_63;
},get_targets:function(){
return this._targets;
},show:function(e){
this._targetElement=e.target;
var _65=new Telerik.Web.UI.RadContextMenuShowingEventArgs(this._targetElement,e||null);
this.raise_showing(_65);
if(_65.get_cancel()){
return;
}
var _66=$telerik.getDocumentRelativeCursorPosition(e);
this._showAt(_66.left,_66.top,e);
$telerik.cancelRawEvent(e);
},showAt:function(_67,top){
this._showAt(_67,top,null);
},hide:function(){
this._hide(null);
},add_showing:function(_69){
this.get_events().addHandler("showing",_69);
},remove_showing:function(_6a){
this.get_events().removeHandler("showing",_6a);
},raise_showing:function(_6b){
if(this._fireEvents){
this.raiseEvent("showing",_6b);
}
},add_shown:function(_6c){
this.get_events().addHandler("shown",_6c);
},remove_shown:function(_6d){
this.get_events().removeHandler("shown",_6d);
},raise_shown:function(_6e){
if(this._fireEvents){
this.raiseEvent("shown",_6e);
}
},add_hidden:function(_6f){
this.get_events().addHandler("hidden",_6f);
},remove_hidden:function(_70){
this.get_events().removeHandler("hidden",_70);
},raise_hidden:function(_71){
if(this._fireEvents){
this.raiseEvent("hidden",_71);
}
}};
Telerik.Web.UI.RadContextMenu.registerClass("Telerik.Web.UI.RadContextMenu",Telerik.Web.UI.RadMenu);

