Unit NormWIN;

Interface

Procedure G_Init;
Procedure G_SetText(Font,Dir,Size:integer);
Procedure G_Fenster(x1, y1, x2, y2, farbe:integer; Titel, Kommentar:string; Win95:Boolean);
Procedure G_Knopf(x1,y1,x2,y2:integer; text:string);
Procedure G_InvKnopf(x1,y1,x2,y2:integer; text:string);
Procedure G_Done;


implementation

uses dos,crt,graph;

var Fnt,Direction,Sz,offs : integer;


Procedure G_SetText(Font,Dir,Size:integer);
Begin;
Fnt:=Font;
Direction:=Dir;
Sz:=Size;
if Font=0 then offs:=+2;
if Font=1 then offs:=-7;
if Font=2 then offs:=-10;
if Font=3 then offs:=-8;
if Font=4 then offs:=-8;
if Font=5 then offs:=-11;
if Font=6 then offs:=-10;
if Font=7 then offs:=-7;
if Font=8 then offs:=-10;
end;


Procedure ResetText;
Begin;
SetTextStyle(Fnt,Direction,Sz);
end;

Procedure G_Init;
var
  GraphDriver, GraphMode: Integer;
begin
  GraphDriver := Detect;
  InitGraph(GraphDriver, GraphMode, '');
  if GraphResult <> grOk then begin;
    clrscr;
    writeln('FoxLAB-GUI ERROR');
    writeln('Couldn`t initialize Graphics Adapter!');
    writeln('');
    Halt(1);
  end;
end;


Procedure G_InvKnopf (x1, y1, x2, y2:integer; text:string);
begin
ResetText;
setcolor(7);
SetFillStyle(SolidFill,7);
BAR (x1 + 1, y1 + 1, x2, y2);
Setcolor(15);
LINE (x2, y1 + 1, x2, y2);
LINE (x1 + 1, y2, x2, y2);
Setcolor(0);
LINE (x2, y1, x1, y1);
LINE (x1, y2, x1, y1);
Setcolor(7);
SetFillStyle(SolidFill,7);
BAR (x1 + 2, y1 + 2, x2 - 2, y2 - 2);
Setcolor(8);
LINE (x2 - 1, y1 + 1, x1 + 1, y1 + 1);
LINE (x1 + 1, y2 - 1, x1 + 1, y1 + 1);
IF text<>''  THEN begin; Setcolor(0); OutTextXY (x1 + 6, y1 + 5+offs, text); end;
END;


Procedure G_Knopf (x1,y1,x2,y2:integer; text:string);
begin
ResetText;
Setcolor(15);
SetFillStyle(SolidFill,15);
BAR (x1, y1, x2, y2);
Setcolor(0);
LINE (x2, y1, x2, y2);
LINE (x1, y2, x2, y2);
Setcolor(8);
LINE (x2 - 1, y1 + 1, x2 - 1, y2 - 1);
LINE (x1 + 1, y2 - 1, x2 - 1, y2 - 1);
Setcolor(7);
SetFillStyle(SolidFill,7);
BAR (x1 + 1, y1 + 1, x2 - 2, y2 - 2);
IF text <> '' THEN begin; Setcolor(0); OutTextXY(x1 + 5, y1 + 4+ offs, text);end;
END;


Procedure G_Fenster (x1, y1, x2, y2, farbe:integer; Titel, Kommentar:string; Win95 : Boolean);
begin;
ResetText;
Setcolor(7);
SetFillStyle(SolidFill,7);
BAR (x1, y1, x2, y2);
Setcolor(15);
LINE (x1 + 1, y1 + 1, x1 + 1, y2 - 1);
LINE (x1 + 1, y1 + 1, x2 - 1, y1 + 1);
Setcolor(0);
LINE (x2, y1, x2, y2);
LINE (x1, y2, x2, y2);
Setcolor(8);
LINE (x2 - 1, y1 + 1, x2 - 1, y2 - 1);
LINE (x1 + 1, y2 - 1, x2 - 1, y2 - 1);
IF Titel <> '' THEN begin
{Fr dunkelblaue Nicht-3D-Titelleiste wie in WIN95
 Zwecks Originalgetreue eventuell y1 + 4 + 15 statt y1 + 4 + 20
 (=>schmler)
 --------------------------------------------------}
if Win95 then
begin
Setcolor(1);
SetFillStyle(SolidFill,1);
BAR (x1 + 4, y1 + 4, x2 - 4, y1 + 4 + 20)
{--------------------------------------------------}
end
else
begin
{Fr hellblaue 3D-Titelleiste}
Setcolor(9);
SetFillStyle(SolidFill,9);
BAR (x1 + 4, y1 + 4, x2 - 4, y1 + 4 + 20);
Setcolor(11);
LINE (x1 + 4, y1 + 4, x2 - 4, y1 + 4);
Setcolor(1);
LINE (x2 - 4, y1 + 4 + 20, x1 + 4, y1 + 4 + 20);
Setcolor(11);
LINE (x1 + 4, y1 + 4, x1 + 4, y1 + 4 + 20);
Setcolor(1);
LINE (x2 - 4, y1 + 4 + 20, x2 - 4, y1 + 4);
end;
END;
IF Kommentar <> '' THEN
begin
IF Titel <> '' THEN begin;
SetFillStyle(SolidFill,15);
Setcolor(15);
BAR (x1 + 4, y1 + 4 + 24, x2 - 4, y2 - 4 - 21);
SetFillStyle(SolidFill,farbe);
Setcolor(farbe);
BAR (x1 + 4, y1 + 4 + 24, x2 - 4-2, y2 - 4 - 21-2);
Setcolor(8);
LINE (x1 + 4, y1 + 4 + 24, x1 + 4, y2 - 4 - 21);
LINE (x1 + 4, y1 + 4 + 24, x2 - 4, y1 + 4 + 24);
Setcolor(0);
LINE (x1 + 5, y1 + 5 + 24, x1 + 5, y2 - 5 - 21);
LINE (x1 + 5, y1 + 5 + 24, x2 - 5, y1 + 5 + 24);
Setcolor(7);
LINE (x1 + 5, y2 - 5 - 21, x2 - 5, y2 - 5 - 21);
LINE (x2 - 5, y1 + 5 + 24, x2 - 5, y2 - 5 - 21);
END;
IF Titel = '' THEN begin;
Setcolor(15);
SetFillStyle(SolidFill,15);
BAR (x1 + 4, y1 + 4, x2 - 4, y2 - 4 - 21);
Setcolor(farbe);
SetFillStyle(SolidFill,farbe);
BAR (x1 + 4, y1 + 4, x2 - 4-2, y2 - 4 - 21-2);
Setcolor(8);
LINE (x1 + 4, y1 + 4, x1 + 4, y2 - 4 - 21);
LINE (x1 + 4, y1 + 4, x2 - 4, y1 + 4);
Setcolor(0);
LINE (x1 + 5, y1 + 5, x1 + 5, y2 - 5 - 21);
LINE (x1 + 5, y1 + 5, x2 - 5, y1 + 5);
Setcolor(7);
LINE (x1 + 5, y2 - 5 - 21, x2 - 5, y2 - 5 - 21);
LINE (x2 - 5, y1 + 5, x2 - 5, y2 - 5 - 21);
END;
Setcolor(8);
LINE (x1 + 4, y2 - 1 - 20, x2 - 4, y2 - 1 - 20);
LINE (x1 + 4, y2 - 1 - 20, x1 + 4, y2 - 4);
Setcolor(15);
LINE (x1 + 4, y2 - 4, x2 - 4, y2 - 4);
LINE (x2 - 4, y2 - 4, x2 - 4, y2 - 1 - 20);
END
ELSE
BEGIN
IF Titel <> '' THEN begin
Setcolor(15);
SetFillStyle(SolidFill,15);
BAR (x1 + 4, y1 + 4 + 24, x2 - 4, y2 - 4);
Setcolor(farbe);
SetFillStyle(SolidFill,farbe);
BAR (x1 + 4, y1 + 4 + 24, x2 - 4-2, y2 - 4-2);
Setcolor(8);
LINE (x1 + 4, y1 + 4 + 24, x1 + 4, y2 - 4);
LINE (x1 + 4, y1 + 4 + 24, x2 - 4, y1 + 4 + 24);
Setcolor(0);
LINE (x1 + 5, y1 + 5 + 24, x1 + 5, y2 - 5);
LINE (x1 + 5, y1 + 5 + 24, x2 - 5, y1 + 5 + 24);
Setcolor(7);
LINE (x1 + 5, y2 - 5, x2 - 5, y2 - 5);
LINE (x2 - 5, y1 + 5 + 24, x2 - 5, y2 - 5);
END;
IF Titel = '' THEN begin
Setcolor(15);
SetFillStyle(SolidFill,15);
BAR (x1 + 4, y1 + 4, x2 - 4, y2 - 4);
Setcolor(farbe);
SetFillStyle(SolidFill,farbe);
BAR (x1 + 4, y1 + 4, x2 - 4-2, y2 - 4-2);
Setcolor(8);
LINE (x1 + 4, y1 + 4, x1 + 4, y2 - 4);
LINE (x1 + 4, y1 + 4, x2 - 4, y1 + 4);
Setcolor(0);
LINE (x1 + 5, y1 + 5, x1 + 5, y2 - 5);
LINE (x1 + 5, y1 + 5, x2 - 5, y1 + 5);
Setcolor(7);
LINE (x1 + 5, y2 - 5, x2 - 5, y2 - 5);
LINE (x2 - 5, y1 + 5, x2 - 5, y2 - 5);
END;
END;
IF Titel <> '' THEN begin; Setcolor(14); OutTextXY(x1 + 10, y1 + 9+ offs, Titel);end;
IF Kommentar <> '' THEN begin; Setcolor(0); OutTextXY(x1 + 10, y2 - 18+ offs, Kommentar);end;
end;


procedure G_Done;
begin
closegraph;
end;


begin
G_SetText(0,0,1);
end.