unit Sparkle.Wizard.Registration;

interface

  procedure Register;

implementation

uses
  ToolsAPI, Sparkle.Wizard;

var
  SparkleServerWizardIndex : Integer;

type
  TSimpleWizard = class(TNotifierObject, IOTAWizard)
  public
    procedure Execute;
    function GetIDString: String;
    function GetName: String;
    function GetState: TWizardState;
    procedure AfterSave;
    procedure BeforeSave;
    procedure Destroyed;
    procedure Modified;
  end;

{ TSimpleWizard }

function TSimpleWizard.GetIDString: String;
begin
  Result := 'TMS.Dummy.Wizard';
end;

function TSimpleWizard.GetName: String;
begin
  Result := 'TMS Dummy Wizard';
end;

function TSimpleWizard.GetState: TWizardState;
begin
  Result := [wsEnabled];
end;

procedure TSimpleWizard.Execute;
begin
end;

procedure TSimpleWizard.AfterSave;
begin
end;

procedure TSimpleWizard.BeforeSave;
begin
end;

procedure TSimpleWizard.Destroyed;
begin
end;

procedure TSimpleWizard.Modified;
begin
end;

function InitialiseWizard : IOTAWizard;
begin
  // The trick to getting a repository wizard to work - register a normal wizard
  // here (returned through RegisterProc) and add the repository wizard via
  // AddWizard
  SparkleServerWizardIndex := (BorlandIDEServices as IOTAWizardServices).AddWizard(
    TSparkleServerWizard.Create);
  Result := TSimpleWizard.Create;
end;

procedure Register;
begin
  InitialiseWizard;
end;

initialization
  SparkleServerWizardIndex := -1;

finalization
  if SparkleServerWizardIndex >= 0 then begin
    (BorlandIDEServices As IOTAWizardServices).RemoveWizard(SparkleServerWizardIndex);
    SparkleServerWizardIndex := -1;
  end;

end.
