% Parts of this code taken from Hans Hagen Metafun
% Other parts inspired by Hagens book


\startuniqueMPgraphic{NassiBox}
     path p ; p := unitsquare
       xscaled \overlaywidth yscaled \overlayheight;
     pickup pencircle scaled \overlaylinewidth ;
     fill p withcolor \MPcolor{\overlaycolor} ;
     draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic


\defineoverlay[Statement][\uniqueMPgraphic{NassiBox}]


\def\Statement#1%
{\framed%
     [background=Statement,%
      frame=off,%
      width=\overlaywidth,%
      align=right,%
      framecolor=black,%
      rulethickness=2pt,%
      backgroundcolor=white]%
     {#1}%
}

\defineoverlay[IfStatement][\useMPgraphic{IfStatement}]


\def\IfStatement#1%
{\framed%
     [background=IfStatement,%
      frame=off,%
      width=\overlaywidth,%
      align=right%
      framecolor=black,%
      rulethickness=2pt,%
      backgroundcolor=white]%
     {\cbox{ #1 \\ ?}}%
}

\startuseMPgraphic{IfStatement}
	path ifp; path jp, p; p:=   ( 0, 1) -- (0.5, 0) -- (1 , 1) -- (1, 0) -- (0, 0) -- (0,1) -- (1,1) -- cycle;
	ifp := p xscaled \overlaywidth yscaled \overlayheight;
     pickup pencircle scaled \overlaylinewidth ;
     fill ifp withcolor \MPcolor{\overlaycolor} ;
     draw ifp withcolor \MPcolor{\overlaylinecolor} ;
\stopuseMPgraphic
