unit ElementList;
interface
uses ExtCtrls, pngimage, graphics, SysUtils, Classes, forms, controls,
contnrs;
type TElementType = (etText, etImage, etChart, etTable, etCode, etHTML);
type
TElementList =
class(TScrollBox)
constructor Create(AOwner: TComponent);
override;
function AddElement(ElemType: TElementType; Content:
String;
const Position: Integer = -1):Integer;
end;
implementation
var
Items: TObjectList;
constructor TElementList.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
BevelInner := bvNone;
BevelKind := bkFlat;
BevelOuter := bvLowered;
BorderStyle := bsNone;
Items := TObjectList.Create;
end;
function TElementList.AddElement(ElemType: TElementType; Content:
String;
const Position: Integer):Integer;
var
layer: TPanel;
begin
layer := TPanel.Create(Self);
with layer
do
begin
BevelInner := bvNone;
BevelKind := bkNone;
BevelOuter := bvNone;
BorderStyle := bsNone;
Align := alTop;
Height := 80;
Parent := ???;
//welchen parent muss ich setzen?
Visible := true;
end;
if Position = -1
then
begin
Items.Add(layer);
end
else
begin
Items.Insert(Position, layer);
end;
end;
end.