/* Alert Window - Mar 98 - by Sylvain Huet */ proto removeAlarm = fun [I] I;; proto destroyWindow = fun [] I;; struct AlertWin= [chAlrtW:Chn,winAlrtW:ObjWin, bannerAlrtW:ObjText,bmpAlrtW:ObjBitmap, widthAlrtW:I,alrtAlrtW:[[S I] r1], endAlrtW:fun [AlertWin] I]mkAlrtW;; fun _paintE(a,b)= _BLTbitmap b.winAlrtW b.bmpAlrtW 0 30;; fun _destroyE(x,b)= _DSbitmap b.bmpAlrtW; exec b.endAlrtW with [b]; destroyWindow ;; fun calcAlert2(b,y,l)= if l==nil then 0 else let l->[[t s] n] in (_DRAWrectangle b.bmpAlrtW 0 y b.widthAlrtW 20 DRAW_INVISIBLE 0 0 DRAW_SOLID if s then 0xff else 0; _DRAWtext b.bmpAlrtW Font b.widthAlrtW/2 y TD_TOP+TD_CENTER if s then 0 else 0xffff00 t; calcAlert2 b y+20 n);; fun calcAlert(b)= _FILLbitmap b.bmpAlrtW 0; calcAlert2 b 0 b.alrtAlrtW; _paintE nil b;; fun _clickE(a,b,x,y,button)= let (y-30)/20 -> i in ( let nth_list b.alrtAlrtW i->a in mutate a<-[_ 0]; removeAlarm i ); calcAlert b;; fun _resizeE(a,b,w,h)= if (w<40) then nil else (_SIZEtext b.bannerAlrtW w-10 20 5 5; _DSbitmap b.bmpAlrtW; set b.widthAlrtW=w; set b.bmpAlrtW=_CRbitmap b.chAlrtW b.widthAlrtW 20*8; calcAlert b) ;; fun crAlert(l)= if l==nil then nil else let l->[t n] in [t 0]::crAlert n;; fun iniAlrtW(ch,father,x,y,w,h,title,end,flag,texts)= let _CRwindow ch father x y w h (if flag then WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER else WN_MENU+WN_MINBOX+WN_SIZEBOX) title -> win in let _CRtext ch win 5 5 w-10 20 ET_DOWN title -> banner in let _CRbitmap ch w 20*8 -> bmp in let mkAlrtW [ch win banner bmp w crAlert texts end] -> b in (_CBwinDestroy win @_destroyE b; _CBwinSize win @_resizeE b; _CBwinPaint win @_paintE b; _CBwinClick win @_clickE b; calcAlert b; b );; fun _setAlert(b,i)= let nth_list b.alrtAlrtW i->a in let a->[_ old] in (mutate a<-[_ 1]; calcAlert b; old);; fun _killAlrtW(b)= _DSwindow b.winAlrtW; _DSbitmap b.bmpAlrtW;;