110 lines
1.8 KiB
ObjectPascal
110 lines
1.8 KiB
ObjectPascal
unit Simulator.Base;
|
|
|
|
interface
|
|
uses
|
|
Vcl.Controls,
|
|
Vcl.Forms,
|
|
|
|
Simulator.Registry;
|
|
|
|
|
|
type
|
|
TSimulatorBaseFrameClass = class of TSimulatorBaseFrame;
|
|
|
|
TSimulatorBaseFrame = class(TFrame)
|
|
private
|
|
FFans: ISimulatorFans;
|
|
public
|
|
constructor Create(AFans: ISimulatorFans); reintroduce; virtual;
|
|
|
|
procedure Initialize; virtual;
|
|
|
|
procedure Start; virtual;
|
|
procedure Stop; virtual;
|
|
|
|
procedure SetUIParent(AParent: TWinControl); virtual;
|
|
|
|
property Fans: ISimulatorFans read FFans;
|
|
end;
|
|
|
|
|
|
TSimulatorFrame<T: TSimulatorBaseFrame> = class(TInterfacedObject, ISimulator)
|
|
private
|
|
FSimulatorFrame: TSimulatorBaseFrame;
|
|
protected
|
|
property SimulatorFrame: TSimulatorBaseFrame read FSimulatorFrame;
|
|
public
|
|
constructor Create(AFans: ISimulatorFans);
|
|
|
|
{ ISimulator }
|
|
procedure Start;
|
|
procedure Stop;
|
|
|
|
procedure SetUIParent(AParent: TWinControl);
|
|
end;
|
|
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
{ TSimulatorBaseFrame }
|
|
constructor TSimulatorBaseFrame.Create(AFans: ISimulatorFans);
|
|
begin
|
|
inherited Create(nil);
|
|
|
|
FFans := AFans;
|
|
Initialize;
|
|
end;
|
|
|
|
|
|
procedure TSimulatorBaseFrame.Initialize;
|
|
begin
|
|
end;
|
|
|
|
|
|
procedure TSimulatorBaseFrame.Start;
|
|
begin
|
|
end;
|
|
|
|
|
|
procedure TSimulatorBaseFrame.Stop;
|
|
begin
|
|
end;
|
|
|
|
|
|
procedure TSimulatorBaseFrame.SetUIParent(AParent: TWinControl);
|
|
begin
|
|
Align := alClient;
|
|
Parent := AParent;
|
|
end;
|
|
|
|
|
|
{ TSimulatorFrame<T> }
|
|
constructor TSimulatorFrame<T>.Create(AFans: ISimulatorFans);
|
|
begin
|
|
inherited Create;
|
|
|
|
FSimulatorFrame := TSimulatorBaseFrameClass(T).Create(AFans);
|
|
end;
|
|
|
|
|
|
procedure TSimulatorFrame<T>.Start;
|
|
begin
|
|
FSimulatorFrame.Start;
|
|
end;
|
|
|
|
|
|
procedure TSimulatorFrame<T>.Stop;
|
|
begin
|
|
FSimulatorFrame.Stop;
|
|
end;
|
|
|
|
|
|
procedure TSimulatorFrame<T>.SetUIParent(AParent: TWinControl);
|
|
begin
|
|
FSimulatorFrame.SetUIParent(AParent);
|
|
end;
|
|
|
|
end.
|