home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of German Only 1
/
romside_best_of_german_only_1.iso
/
wissen
/
dos
/
wgraph
/
entpack.exe
/
WGBSP!.EXE
/
BSP10.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-12-05
|
4KB
|
166 lines
program Beispiel10;
uses GDecl,
GEvent,
GViews,
GDlg,
GApp,
Graph;
const cmStandard = 101;
type TApplication=object(TApp)
procedure SetDesktopFrame(Titel:string); virtual;
procedure SetDesktopBackground; virtual;
procedure InitMenuBar; virtual;
procedure HandleEvent; virtual;
procedure NewWindow;
end;
PMemoryInfo=^TMemoryInfo;
TMemoryInfo=object(TWindow)
procedure SetPalette; virtual;
procedure InitBackground; virtual;
end;
PMemoryInfoBgrd=^TMemoryInfoBgrd;
TMemoryInfoBgrd=object(TBackground)
procedure Draw;virtual;
end;
PNewDTBgrd=^TNewDTBgrd;
TNewDTBgrd=object(TDsktpBgrd)
procedure Draw;virtual;
end;
var MyProg:TApplication;
{Implementation TApplication}
procedure TApplication.SetDesktopFrame(Titel:string);
var R:TRect;
begin
with Desktop^ do
begin
GetBounds(R);
Frame:=new(PFrame, Init(R,R,Titel,winDouble+winPanel+winMenu));
Frame^.Palette:=Palette1;
List^.InsertItem(Frame);
end;
end;
procedure TApplication.SetDesktopBackground;
var R:TRect;
NBgrd:PNewDTBgrd;
begin
with Desktop^ do
begin
R:=Frame^.Area;
NBgrd:=new(PNewDTBgrd, Init(R));
NBgrd^.Palette[7]:=#14;
NBgrd^.Palette[8]:=#7;
List^.InsertItem(NBgrd);
end;
end;
procedure TApplication.InitMenuBar;
begin
Palette[1]:=#14;
Palette[5]:=#14;
Palette[4]:=#4;
Palette[12]:=#4;
MainMenu('~F~enster',0);
SubMenu('~S~peicher-Ressourcen',cmStandard,0,0,false,false);
SubMenu('E~x~it Alt-X',cmCloseApplication,0,altX,false,false);
end;
procedure TApplication.HandleEvent;
begin
Heap^.ShowHeapStatus(523,8,White);
TProgram.HandleEvent;
case Event.Command of
cmStandard : NewWindow;
end; {case}
end;
procedure TApplication.NewWindow;
var R:TRect;
Window:PMemoryInfo;
begin
R.Assign(60,80,450,320);
Window:=new(PMemoryInfo, Init(R,'Speicher-Ressourcen',winDouble+winPanel+winMenu));
Window^.SetWindowAttrib(false);
InsertDesktop(Window);
end;
{Implementation TMemoryInfo}
procedure TMemoryInfo.SetPalette;
begin
Palette:=Pal[palGreen];
end;
procedure TMemoryInfo.InitBackground;
var R:TRect;
begin
R:=Frame^.Area;
Bgrd:=new(PMemoryInfoBgrd, Init(R));
List^.InsertItem(Bgrd);
end;
{Implementation TMemoryInfoBgrd}
procedure TMemoryInfoBgrd.Draw;
var z:string;
EMS:PEMS;
HD:PHardDisk;
begin
with Border do
begin
SetFillStyle(SolidFill,GetPalColor(7));
Bar(A.x,A.y,B.x,B.y);
str(MemAvail:8,z);
SetColor(Red);
OutTextXY(A.x+10,A.y+25,'Hauptspeicher');
OutTextXY(A.x+10,A.y+100,'Expanded Memory');
OutTextXY(A.x+10,A.y+160,'Festplatte C');
SetColor(Blue);
OutTextXY(A.x+10,A.y+45,'Freier RAM (Heap) : '+z+' Byte');
str(MaxAvail:8,z);
OutTextXY(A.x+10,A.y+65,'Größter zusammenhängender');
OutTextXY(A.x+10,A.y+75,'freier Speicherblock : '+z+' Byte');
EMS:=new(PEMS, Init(Border));
str(EMS^.FreeMemory:8,z);
OutTextXY(A.x+10,A.y+120,'verfügbarer Speicher : '+z+' Byte');
str(EMS^.FreeMemory div 16384:8,z);
OutTextXY(A.x+10,A.y+140,'verfügbare Seiten : '+z+' Seiten');
dispose(EMS, Done);
HD:=new(PHardDisk, Init(Border));
str(HD^.FreeMemory:8,z);
OutTextXY(A.x+10,A.y+180,'verfügbare Plattenkapazität : '+z+' Byte');
dispose(HD, Done);
end;
end;
{Implementation TNewDTBgrd}
procedure TNewDTBgrd.Draw;
begin
with Border do
begin
SetFillStyle(SolidFill,GetPalColor(7));
Bar(A.x,A.y,B.x,A.y+20);
SetFillStyle(SolidFill,GetPalColor(8));
Bar(A.x,A.y+22,B.x,B.y);
end;
end;
begin
MyProg.Init('Beispiel 10');
MyProg.Run;
MyProg.Done;
end.