Program SystemedeFenetrage; (*****************************************************************************) (* premiere famille de classes : les classes graphiques *) (*****************************************************************************) Unit Ptr : Class; End Ptr; Unit Windows : Ptr Class(father :windows,x1,y1,x2,y2 : integer); Close hauteur,largeur; Var lborder,cfond,cborder : integer, hauteur,largeur : integer, xpos,ypos,xmax,ymax : integer, num_id : integer, save_map : arrayof integer; Unit Affiche : procedure; Begin call father.rectanglef(x1,y1,x2,y2,cfond); End Affiche; Unit virtual rectangle : procedure(xx1,yy1,xx2,yy2,c :integer); Begin if(xx1x1 and yy1y1) then call father.rectangle(xx1,yy1,xx2,yy2,c); fi; End rectangle; Unit virtual rectanglef : procedure(xx1,yy1,xx2,yy2,c : integer); End rectanglef; Begin hauteur:=y2-y1-2*lborder; largeur:=x2-x1-2*lborder; End Windows; Unit Bitmap : Windows Class; End Bitmap; Unit Son : Windows Class; End Son; Unit Maine : Windows Class; End Maine; Unit Dialogue : Son Class; End Dialogue; Unit Catalogue : Dialogue Class; End Catalogue; Unit Question : Dialogue Class; End Question; Unit Widgets : Ptr Class; End Widgets; Unit Menu : Widgets Class; End Menu; Unit Menu_V : Menu Class; End Menu_V; Unit Menu_H : Menu Class; End Menu_H; Unit Bottons : Widgets Class; End Bottons; Unit Racc : Bottons Class; End Racc; Unit Opt_list : Bottons Class; End Opt_list; Unit Oneline : Opt_list Class; End Oneline; Unit Multiline : Opt_list Class; End Multiline; Unit Botton : Bottons Class; End Botton; Unit Lift : Widgets Class; End Lift; Unit Lift_V : Lift Class; End Lift_V; Unit Lift_H : Lift Class; End Lift_H; (*****************************************************************************) (* deuxieme famille de classes : les structures de donnees *) (*****************************************************************************) Unit Ensemble : CLass; End Ensemble; Unit Queue : Ensemble Class; End Queue; Unit Ofpriority : Queue Class; End Ofpriority; Unit ListD : Ensemble Class; End ListD; Unit Clic : ListD Class; End Clic; Unit Bot : ListD Class; End Bot; Unit Key : ListD Class; End Key; Unit Win : ListD Class; End Win; Unit Stack : Ensemble Class; End Stack; (*****************************************************************************) (* Famille de process *) (*****************************************************************************) Unit Applications : process (node : integer); End Applications; Unit Gest_event : mouse process (node : integer,gest : gest_wind); Unit ready : procedure; End ready; Unit event : function(output v,h,p,l,r,c : integer) : boolean; Begin result:=getpress(v,h,p,l,r,c); End; Var i :integer, v,h,p,l,r,c : integer; Begin return; accept ready; call init(1,1); call showcursor; do if(event(v,h,p,l,r,c)) then call gest.event(v,h,p,l,r,c); fi; od End Gest_event; Unit Gest_wind : iiuwgraph process(node,x1,y1,x2,y2 : integer,gest:gest_event); Var i :integer, v,p,h,l,r,c : integer, w : windows, j : graph; Unit getinfo : procedure (g : gest_event); Begin gest:=g; disable getinfo; End getinfo; Unit event : procedure (input lv,lh,lp,ll,lr,lc : integer); Begin v:=lv; h:=lh; p:=lp; l:=ll; r:=lr; c:=lc; End event; Unit traitement : procedure; Begin if((h=164 and l=27) or c=3) then call fin; fi; call patern(80,25,130,100,0,1); call track(40,10,4,v); call track(140,10,4,p); call track(80,30,4,h); call track(80,50,4,l); call track(80,70,4,r); call track(80,90,4,c); End traitement; Unit fin : procedure; begin call groff; writeln("on ferme"); call endrun; End fin; Unit graph : windows class; Unit virtual rectangle : procedure (x1,y1,x2,y2,c : integer); Begin call patern(x1,y1,x2,y2,c,0); End rectangle; Unit virtual rectanglef : procedure (x1,y1,x2,y2,c : integer); Begin call patern(x1,y1,x2,y2,c,1); End rectanglef; End graph; Begin call gron(0); j:=new graph(none,0,0,0,0); w:=new windows(j,x1,y1,x2,y2); w.cfond:=10; call w.affiche; return; accept getinfo; call gest.ready; call outstring(10,40,"Windows",0,10); do accept event; call traitement; od; call groff; End Gest_wind; Unit Application : Applications process; End Application; (*****************************************************************************) (* P r o g r a m m e P r i n c i p a l *) (*****************************************************************************) Var i : integer, G1 : Gest_wind, G2 : Gest_event; handlers when memerror : call endrun; when syserror : call endrun; end handlers; Begin G1:=new Gest_wind(0,0,0,640,480,none); G2:=new Gest_event(0,G1); resume(G1); resume(G2); call G1.getinfo(G2); End.