struct WSN=[chnWSN:Chn , winWSN:ObjWin, xWSN:I , yWSN:I, wWSN:I,hWSN:I , baseWSN:I,maxWSN:I,valueWSN:I,col1WSN:I,colfillWSN:I,colfondWSN:I, retWSN:fun [WSN I] I,bmpWSN:ObjBitmap,colfontWSN:I,fontWSN:ObjFont] mkWSN ;; fun WSNpaintBitmap(w)= _FILLbitmap w.bmpWSN w.colfondWSN ; _DRAWrectangle w.bmpWSN 0 0 w.wWSN w.hWSN DRAW_SOLID 1 w.col1WSN DRAW_INVISIBLE 0 ; _DRAWrectangle w.bmpWSN 1 1 ((w.wWSN-2)*(w.valueWSN-w.baseWSN))/(w.maxWSN-w.baseWSN) w.hWSN-2 DRAW_SOLID 1 w.colfillWSN DRAW_SOLID w.colfillWSN ; _DRAWtext w.bmpWSN w.fontWSN w.wWSN/2 w.hWSN/2-5 TD_CENTER + TD_TOP w.colfontWSN itoa w.valueWSN ; 0 ;; fun WSNgetValue(w)=w.valueWSN ;; fun WSNsetValue(w,i)=set w.valueWSN=i; WSNpaintBitmap w ; _PAINTwindow w.winWSN ; w;; fun WSNclick(a,w,x,y,b)= let if (x==0) then w.baseWSN else if (x>=(w.wWSN-1)) then w.maxWSN else ((x*(w.maxWSN-w.baseWSN))/(w.wWSN-2)+w.baseWSN)->v in ( set w.valueWSN=v; exec w.retWSN with [ w v ] ; WSNpaintBitmap w; _PAINTwindow w.winWSN; 0 ) ;; fun WSNdestroy (w)= _DSbitmap w.bmpWSN ; _DSwindow w.winWSN ;; fun WSNpaint(a,w)=_BLTbitmap w.winWSN w.bmpWSN 0 0 ;; fun WSNdeswin(w,wsn)= _DSbitmap wsn.bmpWSN ;; fun WSNInit(channel,parent,x,y,ww,hh,base,maxv,value,col1,colfill,colfond,ret,colfont,font)= let mkWSN [ channel nil x y ww hh base maxv value col1 colfill colfond ret nil colfont font]->w in ( set w.winWSN = _CRwindow channel parent x y ww hh WN_CHILD "" ; set w.bmpWSN = _CRbitmap channel ww hh ; WSNpaintBitmap w ; _CBwinPaint w.winWSN @WSNpaint w ; _CBwinClick w.winWSN @WSNclick w ; _CBwinDestroy w.winWSN @WSNdeswin w ; _PAINTwindow w.winWSN ; w ) ;;