1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-14 21:35:07 -05:00
Simba/Projects/SAMufasaGUI/extensionmanager.pas

65 lines
1.2 KiB
ObjectPascal
Raw Normal View History

unit extensionmanager;
{$mode objfpc}
interface
uses
Classes, SysUtils;
type
(**
TExtensionManager holds a list of VirtualExtensions, and
has functions to easily handle hooks.
*)
TExtensionManager = class(TObject)
2010-03-18 19:41:32 -04:00
public
constructor Create;
destructor Destroy; override;
2010-03-19 18:11:26 -04:00
private
Extensions: TList;
public
function HandleHook(HookName: String; Args: Array of Variant): Variant;
end;
2010-03-18 19:41:32 -04:00
implementation
2010-03-19 18:11:26 -04:00
uses
pseventextension, virtualextension;
2010-03-18 19:41:32 -04:00
constructor TExtensionManager.Create;
begin
2010-03-19 18:11:26 -04:00
Extensions := TList.Create;
2010-03-18 19:41:32 -04:00
end;
destructor TExtensionManager.Destroy;
2010-03-19 18:11:26 -04:00
var
i: Integer;
2010-03-18 19:41:32 -04:00
begin
2010-03-19 18:11:26 -04:00
{
for i := 0 to Extensions.Count - 1 do
TVirtualSimbaExtension(Extensions.Items[i]).Free;
}
Extensions.Free;
end;
2010-03-18 19:41:32 -04:00
2010-03-19 18:11:26 -04:00
// How do we return more than one result?
function TExtensionManager.HandleHook(HookName: String; Args: Array of Variant): Variant;
var
i: Integer;
begin
for i := 0 to Extensions.Count -1 do
if TVirtualSimbaExtension(Extensions.Items[i]).HookExists(HookName) then
if TVirtualSimbaExtension(Extensions.Items[i]).ExecuteHook(HookName, Args, Result) <> 0 then
begin
// Not succesfull.
end;
2010-03-18 19:41:32 -04:00
end;
end.