procedure moveSize(id : string; x, y, w, h : integer);
function find(id : string) : pNode;
end;
implementation
constructor stack.Create;
begin
top := nil;
num := 0;
end;
destructor stack.Destroy;
var
del : pNode;
begin
while top <> nil do
begin
del := top;
top := top.next;
Dispose(del);
end;
end;
function stack.newRect(x, y, w, h : integer) : string;
var
n : pNode;
begin
n := New(pNode);
n.id := IntToStr(num);
Inc(num);
n.x := x;
n.y := y;
n.w := w;
n.h := h;
n.next := top;
top := n;
newRect := n.id;
end;
procedure stack.delRect(id : string);
var
f, d : pNode;
begin
f := top;
if f <> nil then
if f.id = id then
begin
top := top.next;
Dispose(f);
end
else
begin
while f.next <> nil do
begin
if f.next.id = id then
begin
d := f.next;
f.next := d.next;
Dispose(d);
break;
end
end;
end;
end;
procedure stack.moveSize(id : string; x, y, w, h : integer);
var
f : pNode;
begin
f := find(id);
if f <> nil then
begin
f.x := x;
f.y := y;
f.w := w;
f.h := h;
end;
end;
function stack.find(id : string) : pNode;
var
f : pNode;
begin
f := top;
while f <> nil do
begin
if f.id = id then break;
f := f.next;
end;
find := f;
end;
end.
Блок-схемы разработанных методов
constructor stack.Create;
destructor stack.Destroy;
function stack.newRect(x, y, w, h : integer) : string;
procedure stack.delRect(id : string);
procedure stack.moveSize(id : string; x, y, w, h : integer);
function stack.find(id : string) : pNode;