@@ -263,7 +263,7 @@ procedure TPSCodeGen.CreateScript(list: TSimbaComponentList);
ResultScript.Clear;
for i := 0 to list.Count - 1 do
begin
cmp := CmpList.AddItem;
cmp := TSimbaComponent.Create;
with cmp do
begin
clsname := list[i].clsname;
@@ -272,11 +272,12 @@ procedure TPSCodeGen.CreateScript(list: TSimbaComponentList);
fontcolor := list[i].fontcolor;
fontname := list[i].fontname;
img := list[i].img;
heigth := list[i].heigth;
height := list[i].height;
width := list[i].width;
left := list[i].left;
top := list[i].top;
end;
CmpList.Add(cmp);
end;
GenerateFormCode(CmpList);
Stream.Position := 0;
@@ -285,137 +286,73 @@ procedure TPSCodeGen.CreateScript(list: TSimbaComponentList);

procedure TPSCodeGen.GetComponentCode(smbl: TSimbaComponentList);
var
i,j: integer;
smb,cmp: TSimbaComponent;
i, j: integer;
smb, cmp: TSimbaComponent;
begin
for i:=0 to smbl.count - 1 do
begin
smb:=smbl[i];
j:=GetSimbaCType(smb);
case j of
0: begin CreateFormCode(smb,FormCode); end;
1: begin
SmbToCodeList(smb,LabelsCode);
cmp:=Labels.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
for i := 0 to smbl.count - 1 do
begin
smb := smbl[i];
j := GetSimbaCType(smb);
case j of
0: CreateFormCode(smb, FormCode);
1:
begin
SmbToCodeList(smb, LabelsCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
Labels.Add(cmp);
end;
2: begin
SmbToCodeList(smb,EditsCode);
cmp:=Edits.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
2:
begin
SmbToCodeList(smb, EditsCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
Edits.Add(cmp);
end;
3: begin
SmbToCodeList(smb,ImagesCode);
cmp:=Images.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
3:
begin
SmbToCodeList(smb, ImagesCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
Images.Add(cmp);
end;
4: begin
SmbToCodeList(smb,ButtonsCode);
cmp:=Buttons.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
4:
begin
SmbToCodeList(smb, ButtonsCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
Buttons.Add(cmp);
end;
5: begin
SmbToCodeList(smb,CheckBoxesCode);
cmp:=CheckBoxes.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
5:
begin
SmbToCodeList(smb, CheckBoxesCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
CheckBoxes.Add(cmp);
end;
6: begin
SmbToCodeList(smb,ListBoxesCode);
cmp:=ListBoxes.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
6:
begin
SmbToCodeList(smb, ListBoxesCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
ListBoxes.Add(cmp);
end;
7: begin
SmbToCodeList(smb,ComboBoxesCode);
cmp:=Comboboxes.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
7:
begin
SmbToCodeList(smb, ComboBoxesCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
Comboboxes.Add(cmp);
end;
8: begin
SmbToCodeList(smb,RadBtnsCode);
cmp:=RadBtns.AddItem;
cmp.clsname:=smb.clsname;
cmp.compname:=smb.compname;
cmp.caption:=smb.caption;
cmp.fontcolor:=smb.fontcolor;
cmp.fontname:=smb.fontname;
cmp.img:=smb.img;
cmp.heigth:=smb.heigth;
cmp.width:=smb.width;
// cmp.ItemContainer.AddStrings(smb.ItemContainer);
cmp.left:=smb.left;
cmp.top:=smb.top;
8:
begin
SmbToCodeList(smb, RadBtnsCode);
cmp := TSimbaComponent.Create;
cmp.Assign(smb);
RadBtns.Add(cmp);
end;
end;
end;
end;
end;
GenerateScriptHeader;
end;

@@ -436,7 +373,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6)+'Left:='+IntToStr(smb.left)+';');
list.Add(GenSpaces(6)+'Top:='+IntToStr(smb.top)+';');
list.Add(GenSpaces(6)+'Width:='+IntToStr(smb.width)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.heigth)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.height)+';');
list.Add(GenSpaces(6)+'Font.Name:='+smb.fontname+';');
list.Add(GenSpaces(6)+'Font.Color:='+ColorToString(smb.fontcolor)+';');
list.Add(GenSpaces(6)+'Font.Size:='+IntToStr(smb.fontsize)+';');
@@ -452,7 +389,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6)+'Left:='+IntToStr(smb.left)+';');
list.Add(GenSpaces(6)+'Top:='+IntToStr(smb.top)+';');
list.Add(GenSpaces(6)+'Width:='+IntToStr(smb.width)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.heigth)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.height)+';');
list.Add(GenSpaces(6)+'Font.Name:='+smb.fontname+';');
list.Add(GenSpaces(6)+'Font.Color:='+ColorToString(smb.fontcolor)+';');
list.Add(GenSpaces(6)+'Font.Size:='+IntToStr(smb.fontsize)+';');
@@ -471,11 +408,11 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6)+'Left:='+IntToStr(smb.left)+';');
list.Add(GenSpaces(6)+'Top:='+IntToStr(smb.top)+';');
list.Add(GenSpaces(6)+'Width:='+IntToStr(smb.width)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.heigth)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.height)+';');
if smb.img.switcher = true then
begin
s:=smb.img.imgcode;
if (smb.heigth<= 24) and (smb.width <=24) then
if (smb.height<= 24) and (smb.width <=24) then
begin
s1:=#13#10+GenSpaces(6)+#39;
for p:=0 to Length(s)-1 do begin
@@ -507,16 +444,16 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
end;
end;
end;
List.Add(GenSpaces(6)+'bmps'+IntToStr(img)+':=GetMufasaBitmap(BitmapFromString('+IntToStr(smb.width)+','+IntToStr(smb.Heigth)+','+s1+#39+'));');
List.Add(GenSpaces(6)+'bmps'+IntToStr(img)+':=GetMufasaBitmap(BitmapFromString('+IntToStr(smb.width)+','+IntToStr(smb.height)+','+s1+#39+'));');
List.Add(GenSpaces(6)+'bmp'+IntToStr(img)+':=bmps'+IntToStr(img)+'.ToTBitmap;');
List.Add(GenSpaces(6)+'Picture.Bitmap.handle:=bmp'+IntToStr(img)+'.handle;');
end else begin
s2:=#39+s+#39;
// List.Add(GenSpaces(6)+'bmp'+IntToStr(img)+':=TBitmap.Create;');
List.Add(GenSpaces(6)+'bmps'+IntToStr(img)+':=GetMufasaBitmap(BitmapFromString('+IntToStr(smb.width)+','+IntToStr(smb.Heigth)+','+s2+'));');
List.Add(GenSpaces(6)+'bmps'+IntToStr(img)+':=GetMufasaBitmap(BitmapFromString('+IntToStr(smb.width)+','+IntToStr(smb.height)+','+s2+'));');
List.Add(GenSpaces(6)+'bmp'+IntToStr(img)+':=bmps'+IntToStr(img)+'.ToTBitmap;');
List.Add(GenSpaces(6)+'Picture.Bitmap.handle:=bmp'+IntToStr(img)+'.handle;');
// List.Add(GenSpaces(6)+'DrawBitmap(bmps'+IntToStr(img)+',Canvas,'+IntToStr(smb.width)+','+IntToStr(smb.Heigth)+');');
// List.Add(GenSpaces(6)+'DrawBitmap(bmps'+IntToStr(img)+',Canvas,'+IntToStr(smb.width)+','+IntToStr(smb.height)+');');
//list.Add(GenSpaces(6)+'Picture.Bitmap.LoadFromFile('+#39+smb.img.path+#39+');');
end;
end else
@@ -534,7 +471,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6)+'Left:='+IntToStr(smb.left)+';');
list.Add(GenSpaces(6)+'Top:='+IntToStr(smb.top)+';');
list.Add(GenSpaces(6)+'Width:='+IntToStr(smb.width)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.heigth)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.height)+';');
list.Add(GenSpaces(6)+'OnClick:=@YourClickProcedure'+';');
list.Add(GenSpaces(6)+'Font.Name:='+smb.fontname+';');
list.Add(GenSpaces(6)+'Font.Color:='+ColorToString(smb.fontcolor)+';');
@@ -553,7 +490,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6)+'Left:='+IntToStr(smb.left)+';');
list.Add(GenSpaces(6)+'Top:='+IntToStr(smb.top)+';');
list.Add(GenSpaces(6)+'Width:='+IntToStr(smb.width)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.heigth)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.height)+';');
list.Add(GenSpaces(6)+'Font.Name:='+smb.fontname+';');
list.Add(GenSpaces(6)+'Font.Color:='+ColorToString(smb.fontcolor)+';');
list.Add(GenSpaces(6)+'Font.Size:='+IntToStr(smb.fontsize)+';');
@@ -568,7 +505,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6)+'Left:='+IntToStr(smb.left)+';');
list.Add(GenSpaces(6)+'Top:='+IntToStr(smb.top)+';');
list.Add(GenSpaces(6)+'Width:='+IntToStr(smb.width)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.heigth)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.height)+';');
list.Add(GenSpaces(6)+'//add your items here');
list.Add(GenSpaces(6)+'Items.Add('+#39+'YourItem'+#39+')'+';');
list.Add(GenSpaces(6)+'//End items');
@@ -587,7 +524,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6)+'Left:='+IntToStr(smb.left)+';');
list.Add(GenSpaces(6)+'Top:='+IntToStr(smb.top)+';');
list.Add(GenSpaces(6)+'Width:='+IntToStr(smb.width)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.heigth)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.height)+';');
list.Add(GenSpaces(6)+'//add your items here');
list.Add(GenSpaces(6)+'Items.Add('+#39+'YourItem'+#39+')'+';');
list.Add(GenSpaces(6)+'//End items');
@@ -607,7 +544,7 @@ procedure TPSCodeGen.SmbToCodeList(smb: TSimbaComponent; list: TStringList);
list.Add(GenSpaces(6)+'Left:='+IntToStr(smb.left)+';');
list.Add(GenSpaces(6)+'Top:='+IntToStr(smb.top)+';');
list.Add(GenSpaces(6)+'Width:='+IntToStr(smb.width)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.heigth)+';');
list.Add(GenSpaces(6)+'Height:='+IntToStr(smb.height)+';');
list.Add(GenSpaces(6)+'Font.Name:='+smb.fontname+';');
list.Add(GenSpaces(6)+'Font.Color:='+ColorToString(smb.fontcolor)+';');
list.Add(GenSpaces(6)+'Font.Size:='+IntToStr(smb.fontsize)+';');
@@ -695,7 +632,7 @@ procedure TPSCodeGen.CreateFormCode(smb: TSimbaComponent; List: TStringList);
Add(GenSpaces(6) + 'Left:=' + IntToStr(smb.left) + ';');
Add(GenSpaces(6) + 'Top:=' + IntToStr(smb.top) + ';');
Add(GenSpaces(6) + 'Width:=' + IntToStr(smb.width) + ';');
Add(GenSpaces(6) + 'Height:=' + IntToStr(smb.heigth) + ';');
Add(GenSpaces(6) + 'Height:=' + IntToStr(smb.height) + ';');
Add(GenSpaces(6) + 'Font.Name:=' + smb.fontname + ';');
Add(GenSpaces(6) + 'Font.Color:=' + ColorToString(smb.fontcolor) + ';');
Add(GenSpaces(6) + 'Font.Size:=' + IntToStr(smb.fontsize) + ';');

This file was deleted.

@@ -87,7 +87,7 @@ TCompForm = class(TForm)
FButtonDown: TToolButton;
FControlsClassPStd: TControlsClassStandard;
FInterpreterType: integer;
procedure ComponentToSimba(cmp: TControl;var smb: TSimbaComponent);
procedure ComponentToSimba(cmp: TControl);
function GetButtonIndex: Integer;
procedure ApplySimbaToComponent(smb: TSimbaComponent;cmp: TControl);
procedure SaveDesignForm(filename: string);
@@ -214,8 +214,7 @@ procedure TCompForm.FormCreate(Sender: TObject);
LCLIntf.SetParent(f.Handle,self.Panel1.Handle);
SetModeScript;
ppEdit.OnExit:=OnExit;
smbCmp:= CompList.AddItem;
ComponentToSimba(f,smbCmp);
ComponentToSimba(f);
ofdlg:= TOpenDialog.Create(self);
ofdlg.Filter:='Simba form files only|*.smf';
sfdlg:= TSaveDialog.Create(self);
@@ -479,44 +478,58 @@ function TCompForm.GetControlType(cmp: TControl): integer;
end;
end;

procedure TCompForm.ComponentToSimba(cmp: TControl;var smb: TSimbaComponent);
procedure TCompForm.ComponentToSimba(cmp: TControl);
var
mb: TMufasaBitmap;
mb: TMufasaBitmap;
smb: TSimbaComponent;
Image: TBitmapContainer;
begin
mb:=TMufasaBitmap.Create;
try
smb.caption:=cmp.Caption;
smb.top:=cmp.Top;
smb.width:=cmp.Width;
smb.left:=cmp.Left;
smb.heigth:=cmp.Height;
smb.clsname:=cmp.ClassName;
smb.compname:=cmp.Name;
smb.fontcolor:=cmp.Font.Color;
if (CompareText(cmp.Font.Name,'default'))=0 then
smb.fontname:=cmp.Font.Name else smb.fontname:=#39+cmp.Font.Name+#39;
smb.fontsize:=cmp.Font.Size;
if (CompareText(cmp.ClassName,'TImage')) = 0 then
mb := TMufasaBitmap.Create;
try
smb := TSimbaComponent.Create;
with smb do
begin
smb.img.switcher:=true;
mb.LoadFromTBitmap(TImage(cmp).Picture.Bitmap);
smb.img.imgcode:=mb.ToString;
caption := cmp.Caption;
top := cmp.Top;
width := cmp.Width;
left := cmp.Left;
height := cmp.Height;
clsname := cmp.ClassName;
compname := cmp.Name;
fontcolor := cmp.Font.Color;
if (CompareText(cmp.Font.Name, 'default')) = 0 then
fontname := cmp.Font.Name
else
fontname := #39 + cmp.Font.Name + #39;
fontsize := cmp.Font.Size;
if (CompareText(cmp.ClassName, 'TImage')) = 0 then
begin
image.switcher := true;
mb.LoadFromTBitmap(TImage(cmp).Picture.Bitmap);
image.imgcode := mb.ToString;
smb.Img := Image;
end;
end;
finally
mb.Free;
end;
CompList.Add(smb);
finally
if mb <> nil then
mb.Free;
end;
end;

procedure TCompForm.ApplySimbaToComponent(smb: TSimbaComponent; cmp: TControl);
begin
cmp.Caption:=smb.caption;
cmp.Top:=smb.top;
cmp.Width:=smb.width;
cmp.Left:=smb.left;
cmp.Height:=smb.heigth;
cmp.Font.Color:=smb.fontcolor;
cmp.Font.Name:=smb.fontname;
cmp.Font.Size:=smb.fontsize;
with cmp do
begin
Caption := smb.caption;
Top := smb.top;
Width := smb.width;
Left := smb.left;
Height := smb.height;
Font.Color := smb.fontcolor;
Font.Name := Smb.fontname;
Font.Size := smb.fontsize;
end;
end;

procedure TCompForm.SaveDesignForm(filename: string);
@@ -525,7 +538,8 @@ procedure TCompForm.SaveDesignForm(filename: string);
ms: TMemoryStream;
begin
filename:=filename+'.smf';
if not assigned(f) then exit;
if not assigned(f) then
exit;
fs := TFileStream.Create(FileName, fmCreate);
ms := TMemoryStream.Create;
try
@@ -589,19 +603,14 @@ procedure TCompForm.AddToStringGrid(cmp: TControl);
procedure TCompForm.FormToSCList(form: TDsgnForm);
var
i: integer;
smb: TSimbaComponent;
begin
if assigned(complist) then
complist.Free;
complist:=TSimbaComponentList.Create;
smb:=CompList.AddItem;
ComponentToSimba(form,smb);
ComponentToSimba(form);
for i := 0 to form.ControlCount - 1 do
begin
smb:=CompList.AddItem;
//CompList.AddItem(ComponentToSimba(Form.Controls[i]),i+1);
ComponentToSimba(Form.Controls[i],smb);
end;
ComponentToSimba(Form.Controls[i]);
end;

procedure TCompForm.AddToStringGridEx(smb: TSimbaComponent);
@@ -13,83 +13,178 @@ type TBitmapContainer = record
type

{ TSimbaComponent }

TSimbaComponent = class(TCollectionItem)

Public
clsname: string;
caption: string;
compname: string;
img: TBitmapContainer;
//ItemContainer: TStrings;
left,top,width,heigth: integer;
fontcolor: TColor;
fontname: string;
fontsize: integer;
constructor Create(Col: TCollection); override;
destructor Destroy; override;
TSimbaComponent = class(TObject)
private
FBitmapContainer: TBitmapContainer;
FCLSName: string;
FCaption: string;
fComponentName: string;
FImage: TBitmapContainer;
FLeft,FTop,FWidth,FHeight: integer;
FFontColor: TColor;
FFontName: string;
FFontSize: integer;
procedure Clear;
public
Constructor Create;
Procedure Assign(smb: TSimbaComponent);
property CLSName: string read FCLSName write FCLSName;
property Caption: string read FCaption write FCaption;
property CompName: string read FComponentName write FComponentName;
property Img: TBitmapContainer read FBitmapContainer write FBitmapContainer;
property Left: integer read FLeft write FLeft;
property Top: integer read FTop write FTop;
property Width: integer read FWidth write FWidth;
property Height: integer read FHeight write FHeight;
property FontColor: TColor read FFontColor write FFontColor;
property FontName: string read FFontName write FFontName;
property FontSize: integer read FFontSize write FFontSize;
end;

{ TSimbaComponentList }

TSimbaComponentList = class (TCollection)
TSimbaComponentList = class
private
function GetItems(Index: Integer): TSimbaComponent;
FSimbaComponents: TList;
function GetCount: Integer;
function GeTSimbaComponent(Index: Integer): TSimbaComponent;
public
function AddItem: TSimbaComponent;

constructor Create;

function FindByName(aName: string): TSimbaComponent;

property Items[Index: Integer]: TSimbaComponent read GetItems; default;
destructor Destroy; override;
procedure Clear;
procedure Add(aSimbaComponent: TSimbaComponent);
procedure Assign(Src: TSimbaComponentList);
function IndexOf(aItem: TSimbaComponent): Integer; overload;
function IndexOf(Name: String): Integer; overload;
procedure Delete(Index: Integer); overload;
procedure Delete(aItem: TSimbaComponent); overload;
property Count: Integer read GetCount;
property SimbaComponent[Index: Integer]: TSimbaComponent read GeTSimbaComponent; default;
end;


const
ErrItemNotFound = 'Item not found!';
implementation

function TSimbaComponentList.GetItems(Index: Integer): TSimbaComponent;
{ TSimbaComponent }

procedure TSimbaComponent.Clear;
begin
Result := TSimbaComponent(inherited Items[Index]);
CLSName:='';
Caption:='';
CompName:='';
Left:=0;
Top:=0;
Width:=0;
Height:=0;
FontName:='';
FontSize:=0;
end;

constructor TSimbaComponent.Create;
begin
Clear;
end;

function TSimbaComponentList.AddItem: TSimbaComponent;
procedure TSimbaComponent.Assign(smb: TSimbaComponent);
begin
Result := TSimbaComponent(inherited Add());
clsname:=smb.clsname;
compname:=smb.compname;
caption:=smb.caption;
fontcolor:=smb.fontcolor;
fontname:=smb.fontname;
img:=smb.img;
height:=smb.height;
width:=smb.width;
left:=smb.left;
top:=smb.top;
end;

{ TSimbaComponentList }

constructor TSimbaComponentList.Create;
begin
inherited Create(TSimbaComponent);
FSimbaComponents := TList.Create;
end;

function TSimbaComponentList.FindByName(aName: string): TSimbaComponent;
var I: Integer;
procedure TSimbaComponentList.Delete(Index: Integer);
begin
Result := nil;
for I := 0 to Count - 1 do
if AnsiCompareText(Trim(Items[i].compname),Trim(aName))=0 then
begin
Result := Items[i];
Break;
end;
if (Index < 0) or (Index >= Count) then
raise Exception.Create(ErrItemNotFound);

TSimbaComponent(FSimbaComponents[Index]).Free;
FSimbaComponents.Delete(Index);
end;

{ TSimbaComponentList }
procedure TSimbaComponentList.Delete(aItem: TSimbaComponent);
begin
Delete(IndexOf(aItem));
end;

destructor TSimbaComponentList.Destroy;
begin
Clear;
FSimbaComponents.Free;
inherited;
end;

procedure TSimbaComponentList.Add(aSimbaComponent: TSimbaComponent);
begin
FSimbaComponents.Add(aSimbaComponent);
end;

procedure TSimbaComponentList.Assign(Src: TSimbaComponentList);
var
I: Integer;
begin
Clear;
for I := 0 to Src.Count - 1 do
Add(Src[I]);
end;

procedure TSimbaComponentList.Clear;
var
I: Integer;
begin
for I := 0 to FSimbaComponents.Count - 1 do
SimbaComponent[I].Free;
FSimbaComponents.Clear;
end;


constructor TSimbaComponent.Create(Col: TCollection);
function TSimbaComponentList.GetCount: Integer;
begin
inherited Create(Col);
Result := FSimbaComponents.Count;
end;

destructor TSimbaComponent.Destroy;
function TSimbaComponentList.GeTSimbaComponent(Index: Integer): TSimbaComponent;
begin
inherited Destroy;
if (Index >= 0) and (Index < Count) then
Result := TSimbaComponent(FSimbaComponents[Index])
else
Result := nil;
end;

function TSimbaComponentList.IndexOf(aItem: TSimbaComponent): Integer;
begin
Result := FSimbaComponents.IndexOf(aItem);
end;

function TSimbaComponentList.IndexOf(Name: String): Integer;
var
I: Integer;
begin
for I := 0 to Count - 1 do
if SimbaComponent[I].CompName = Name then
begin
Result := I;
Exit;
end;
Result := -1;
end;



end.