unit uMenuGr;

      {=================================================================}
      {                                                                 }
      {  SW pro terminaly SofCon                V2.51   17.03.2003 Bu   }
      {                                                                 }
      {  Rozsireni tMenuChr pro graficke terminaly                      }
      {                                                                 }
      {  (C) 1996-1997, SofCon s.r.o., Stresovicka 49, Praha 6          }
      {                 Vypracoval: R.Bukovsky                          }
      {=================================================================}

{$ifdef USE_SETS_INC} { Pokud chces tak nastav v Compiler Options/Conditional defines }
   {$I Sets.inc}
{$endif}

interface
uses
 {$IFDEF DEBUGSYSFC}
  uSysf,
 {$ENDIF}
  uString,
  uAMenu,
  uMenuChr, { Rozsireni MenuVirt pro praci s terminalem }
  uATerm,   { Objekt abstraktniho terminalu }
  uTermGr;  { objekt grafickeho terminalu }

const
  cVerNo = $0251; { BCD format }
  cVer   = '02.51,17.03.2003';

{=============================================================================}
{                        t M e n u G r                                        }
{=============================================================================}
type
pBkIndex    = ^integer;
pMenuGr     = ^tMenuGr;
pMMenuGr    = ^tMMenuGr;
tMMenuGr    = procedure(P: pMenuGr);
tMenuGr = object(tMenuChr)
  pDispGraphicString :pString; { ukazatel na string pro vypis grafiky na vDisplay }
  pBkGroundIndex     :pBkIndex;
  constructor Init(AMenu: pMenu; EndIndex: Word;
                   var DisplayString, HelpString,GraphicStr: String;
                   BkGroundIndex: pBkIndex;
                   ATerminal: pTermGr; ParTerm: tParamStr;
                   WaitMenu: Word);
  procedure DisplayMenuAndGraphic;                                { replace DisplayMenu ! }
  procedure InitParam;                                                 virtual;{ override }
  procedure SetBkGround(NewBkGroundIndex : pBkIndex);                  virtual;
  procedure SetHelpVar(var HGrStr:string;var HBkBmp:integer);          virtual;
end;

{#############################################################################}
implementation

{=============================================================================}
{                        M e n u T e r m G r                                  }
{=============================================================================}
constructor tMenuGr.Init(AMenu: pMenu; EndIndex: Word;
                         var DisplayString, HelpString,GraphicStr: String;
                         BkGroundIndex:pBkIndex;
                         ATerminal: pTermGr; ParTerm: tParamStr;
                         WaitMenu: Word);
begin
 {$ifdef Deb_Crt}
  writeln('tMenuGr.Init Entry');{!Bu}
 {$endif}
{$ifdef Ver60}
  tMenuChr.Init(AMenu,EndIndex,DisplayString,HelpString,ATerminal,ParTerm,WaitMenu);
{$else}
  inherited Init(AMenu,EndIndex,DisplayString,HelpString,ATerminal,ParTerm,WaitMenu);
{$endif}
  pDispGraphicString :=Addr(GraphicStr); { ukazatel na string pro vypis grafiky na vDisplay }
  pBkGroundIndex     :=BkGroundIndex;
 {$ifdef Deb_Crt}
  writeln('tMenuGr.Init Exit');{!Bu}
 {$endif}
end;

{ nova def. puvodniho DisplayMenu rozsirena o predani GraphicString }
procedure tMenuGr.DisplayMenuAndGraphic;
begin
  with pTermGr(Term)^ do
  begin
    if flTickExecute then { v Term probehl uplny Tick }
    begin
      flTickExecute:=false;
      Suspend_DispRefresh;
      {$ifdef DEB_STYLES}
        writelnSysOut('');
        writelnSysOut('tMenuGr.DisplayMenuAndGraphic: -- Entry --');
      {$endif}
        WriteBkGroundIndex(pBkGroundIndex^);{!Bu}
        WriteGraphicStr(pDispGraphicString^);{!Bu}
        if ClrScreen
        then ClrScr
        else GotoXY(1,1);
        WriteS(MenuDispStr^);
      {$ifdef DEB_STYLES}
        writelnSysOut('tMenuGr.DisplayMenuAndGraphic: -- Exit ---');
        writelnSysOut('');
      {$endif}
      Release_DispRefresh;
    end;
  end;
end;

procedure tMenuGr.InitParam;
begin
 {$ifdef Deb_Crt}
  writeln('tMenuGr.InitParam Entry');{!Bu}
 {$endif}
 {$ifdef Ver60}
  tMenuChr.InitParam;
 {$else}
  inherited InitParam;
 {$endif}
  SetDisplayMenu(Addr(tMenuGr.DisplayMenuAndGraphic));
 {$ifdef Deb_Crt}
  writeln('tMenuGr.InitParam Exit');{!Bu}
 {$endif}
end;

procedure tMenuGr.SetBkGround(NewBkGroundIndex : pBkIndex);
begin
  pBkGroundIndex := NewBkGroundIndex;
end;

procedure tMenuGr.SetHelpVar(var HGrStr:string;var HBkBmp:integer);
begin
  pTermGr(Term)^.TermSetHelpVar(HGrStr,HBkBmp);
end;

End.
