var g_TTMenuImg = new Array(); var g_nCurSelImg=0; function TTMenuImg(strClass,bAutoClose,nHeight,bRight,bCloseOnBottom) { if(!nHeight) nHeight=0; g_TTMenuImg[g_TTMenuImg.length]=strClass; this.rgbTextDisable = "#FF0000"; this.nCurScroll = 0; this.bScroll = false; this.ScrollEvent = TTM_ScrollEvent; this.bCloseOnBottom = bCloseOnBottom; this.bRight = bRight; this.nDist = nHeight; this.strClass = strClass; this.bAutoClose = bAutoClose; this.strBack = ""; this.strSelect = ""; this.strSpace = ""; this.nFontHeight = 12; this.nItemCount = 0; this.nScrollCount = 0; this.nTop = 0; this.nLeft = 0; this.nWidth = 0; this.nHeight = 0; this.strText = ""; this.strEnable = ""; this.aEval = Array(); this.aDiv = Array(); this.bVisible = false; this.nImageHeight = 0; this.nImageWidth = 0; this.strImages = ""; this.rgbTextNormal = "#000066" this.nCurSel = -1; this.bHit = false; this.SetImages = TTM_SetImages; this.SetTextColor = TTM_SetTextColor; this.SetRectangle = TTM_SetRectangle; this.AddItem = TTM_AddItem; this.MouseMove = TTM_MouseMove; this.MouseDown = TTM_MouseDown; this.HitTest = TTM_HitTest; this.CheckBarPos = TTM_CheckBarPos; this.DrawBar = TTM_DrawBar; this.Show = TTM_Show; this.IsVisible = TTM_IsVisible; this.SetScrollBar = TTM_SetScrollBar; this.ChangeScrollPos = TTM_ChangeScrollPos; this.nTextOffset=0; } function TTM_IsVisible() { return this.bVisible; } function TTM_Show(bOn) { this.bHit=false; this.bVisible=bOn; TT_Doc.SetLayerVisible(bOn,this.strClass+"BAR"); TT_Doc.SetLayerVisible(bOn,this.strClass+"SPACE"); TT_Doc.SetLayerVisible(bOn,this.strClass+"BACK"); g_nCurSelImg=0; var nY=this.nTop+2; var nStep=this.nFontHeight+3+this.nDist; if(this.bScroll) { // var nY; for(i1=0;i1<(this.nItemCount+this.nScrollCount);i1++) { // nY=TT_Doc.GetLayerY(this.strClass+"TEXT"+i1); TT_Doc.SetLayerVisible(bOn && nY>=this.nTop&&nY<(this.nTop+this.nHeight-5),this.strClass+"TEXT"+i1); nY+=nStep; } } else { for(i1=0;i1=this.nItemCount) { for(i=nTextPos-1;i>=0;i--) { if(this.strEnable.charAt(i+this.nCurScroll)=="1") { nTextPos=i; break; } } } if(nDest>0 || nTextPos<0) { var i; for(i=nTextPos+1;i=this.nTop+this.nHeight-nStep) { this.Show(false); return; } } for(i=0;i=nTop && nY <= nTop+nStep && this.strEnable.charAt(i+this.nCurScroll)=="1") { return i; } nTop+=nStep; } return this.nCurSel; } function TTM_HitTest(nX,nY,nExpand) { var nLeft=this.nLeft-nExpand; var nRight=this.nLeft+this.nWidth+nExpand; if(this.bRight) nRight+=this.nImageWidth; else nLeft-=this.nImageWidth; var bRet=(nX>=nLeft && nX<=nRight && nY>=this.nTop-nExpand && nY<=this.nTop+this.nHeight+nExpand); if(bRet) { this.bHit=true; } return bRet; } function TTM_MouseMove(nX,nY) { if(!this.bVisible) { g_nCurSelImg=0; return false; } if(!this.HitTest(nX,nY,5)) { if(this.bAutoClose && this.bHit && this.HitTest(nX,nY,30)) { this.Show(false); } g_nCurSelImg=0; return false; } g_nCurSelImg=1; var nPos=this.CheckBarPos(nY); this.DrawBar(nPos); return true; } function TTM_MouseDown(nX,nY) { if(!this.bVisible) { g_nCurSelImg=0; return false; } if(!this.HitTest(nX,nY,0)) return false; var nPos=this.CheckBarPos(nY,true); if(this.bAutoClose) this.Show(false); eval(this.aEval[nPos+this.nCurScroll]); return true; } function TTM_SetTextColor(rgbNormal,nFontHeight,rgbDisable) { if(rgbDisable) this.rgbTextDisable=rgbDisable; else this.rgbTextDisable=rgbNormal; this.rgbTextNormal = rgbNormal; this.nFontHeight = nFontHeight; if(this.nDist>0) { this.nDist-=(this.nFontHeight+2); } } function TTM_SetImages(strBack,strSelect,strSpace) { this.strBack = strBack; this.strSelect = strSelect; this.strSpace = strSpace; } function TTM_SetRectangle(nLeft,nTop,nWidth,nItemCount,bBottom,nImageWidth,nImageHeight,nTextOffset,nMaxRight) { if(!nMaxRight) nMaxRight=0; this.nItemCount=nItemCount; this.nTop=nTop; this.nLeft=nLeft; this.nWidth=nWidth; this.nHeight=(this.nFontHeight+3+this.nDist)*nItemCount; this.nHeight+=this.nDist<=0?2:0; if (!nTextOffset) nTextOffset=0; this.nTextOffset=nTextOffset; if(bBottom) this.nTop=nTop-this.nHeight; if(!nImageWidth) { nImageWidth=0; nImageHeight=0; } else { nImageWidth+=4; this.nImageHeight=nImageHeight; this.nImageWidth=nImageWidth; } var nAbzug=this.nDist<=0?4:0; TT_Doc.Write(""); TT_Doc.Write("
"); TT_Doc.Write("
"); TT_Doc.Write("
"); TT_Doc.SetMouseEvent("MOUSEMOVE",TTMMouseMoveImg,this.strClass+"SPACE"); TT_Doc.SetMouseEvent("MOUSEDOWN",TTMMouseDownImg,this.strClass+"SPACE"); } function TTMMouseMoveImg(e) { TT_Doc.GetMouseKoord(e,true); for(i=0;i0?"1":"0"; if(this.nCurSel<0 && strFunction.length>0) this.nCurSel=i; if(strImage) { this.strImages+="
"; if(this.nTextOffset==0) this.strImages+="
"; } var nStep=this.nFontHeight+3+this.nDist; if(strFunction.length>0) this.strText=""+strText+""; else this.strText=""+strText+""; var nAbzug=this.nDist<=0?4:0; TT_Doc.Write("#"+this.strClass+"TEXT"+i+" {position:absolute; left:"+this.nLeft+"; top:"+(this.nTop+5+nStep*i-nAbzug+this.nTextOffset)+"; width:"+this.nWidth+"; height:"+this.nFontHeight+"; z-Index:102;visibility:hidden;}",true); if(this.bRight) TT_Doc.Write("
"+this.strText+"
",true); else TT_Doc.Write("
"+this.strText+"
",true); this.strText=""; if(i==this.nItemCount-1) { if(this.strImages) { if(this.bRight) TT_Doc.Write("#"+this.strClass+"IMG {position:absolute; left:"+(this.nLeft+this.nWidth+5)+"; top:"+this.nTop+"; width:"+(this.nImageWidth)+"; height:"+this.nHeight+"; z-Index:102;visibility:hidden;}",true); else TT_Doc.Write("#"+this.strClass+"IMG {position:absolute; left:"+(this.nLeft-this.nImageWidth+1)+"; top:"+(this.nTop-1)+"; width:"+(this.nImageWidth)+"; height:"+this.nHeight+"; z-Index:102;visibility:hidden;}",true); TT_Doc.Write("
"+this.strImages+"
",true); } this.DrawBar(this.nCurSel); } } function TTM_ScrollEvent(nMode,nPercent) { switch(nMode) { case 0: this.ChangeScrollPos(1); break; case 1: this.ChangeScrollPos(-1); break; case 4: for(i=1;i0 && this.ChangeScrollPos(-1)) { nMode--; } } oMenuScroll.SetBarPosition(this.nCurScroll/this.nScrollCount*100); } function TTM_ChangeScrollPos(nPos) { var nY=TT_Doc.GetLayerY(this.strClass+"TEXT0"); var i; var nStep=(this.nFontHeight+3+this.nDist)*nPos; if(this.nCurScroll==0 && nPos>0) { this.DrawBar(this.nCurSel,-1); return false; } if(this.nCurScroll==this.nScrollCount && nPos<0) { this.DrawBar(this.nCurSel,1); return false; } this.nCurScroll-=nPos; var i; var nY=this.nTop+2; var nS=this.nFontHeight+3+this.nDist; nY-=(nS*this.nCurScroll); for(i=0;i<(this.nItemCount+this.nScrollCount);i++) { // nY=TT_Doc.GetLayerY(this.strClass+"TEXT"+i)+nStep; TT_Doc.SetLayerVisible(nY>=this.nTop&&nY<(this.nTop+this.nHeight-5),this.strClass+"TEXT"+i); TT_Doc.SetLayerY(nY,this.strClass+"TEXT"+i); nY+=nS; } this.DrawBar(this.nCurSel+nPos); return true; } function TTM_SetScrollBar(strZwischen,strTop,strBottom,strBar,strSpacer) { this.bScroll=true; oMenuScroll=new TT_ScrollBar("oMenuScroll"); oMenuScroll.SetRectangle(this.nLeft+this.nWidth-19,this.nTop+4,30,220,strSpacer); oMenuScroll.SetImageMiddle(strZwischen,12,this.nHeight-24); oMenuScroll.SetImageTop(strTop,12,12); oMenuScroll.SetImageBottom(strBottom,12,12); oMenuScroll.SetImageBar(strBar,10,10); oMenuScroll.SetEventHandle(this,true); oMenuScroll.SetDoClose(this); }