2011-09-08 07:05:53 +00:00
|
|
|
unit browsermodules;
|
|
|
|
|
|
|
|
{$mode delphi}
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
2013-09-16 11:07:57 +00:00
|
|
|
Classes, SysUtils;
|
2011-09-08 07:05:53 +00:00
|
|
|
|
|
|
|
type
|
|
|
|
|
2013-09-16 11:07:57 +00:00
|
|
|
TBrowserModuleUIElement = (bmueEnabledDisableMenu, bmueCommandsSubmenu);
|
|
|
|
TBrowserModuleUIElements = set of TBrowserModuleUIElement;
|
|
|
|
|
2011-09-08 07:05:53 +00:00
|
|
|
{ TBrowserModule }
|
|
|
|
|
|
|
|
TBrowserModule = class
|
|
|
|
public
|
|
|
|
ShortDescription: string;
|
|
|
|
Activated: Boolean;
|
|
|
|
constructor Create; virtual;
|
2013-09-16 11:07:57 +00:00
|
|
|
//
|
|
|
|
function GetModuleUIElements(): TBrowserModuleUIElements; virtual;
|
|
|
|
// For active/disabled modules
|
2011-09-15 12:19:24 +00:00
|
|
|
function HandleOnPageLoad(AInput: string; out AOutput: string): Boolean; virtual;
|
2013-09-16 11:07:57 +00:00
|
|
|
// For expansions
|
|
|
|
function GetCommandCount: Integer; virtual;
|
|
|
|
function GetCommandName(AID: Integer): string; virtual;
|
|
|
|
procedure ExecuteCommand(AID: Integer); virtual;
|
2011-09-08 07:05:53 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure RegisterBrowserModule(AModule: TBrowserModule);
|
|
|
|
function GetBrowserModule(AIndex: Integer): TBrowserModule;
|
|
|
|
function GetBrowserModuleCount(): Integer;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
var
|
|
|
|
gBrowserModules: TList;
|
|
|
|
|
|
|
|
procedure RegisterBrowserModule(AModule: TBrowserModule);
|
|
|
|
begin
|
|
|
|
if AModule = nil then raise Exception.Create('[RegisterBrowserModule] Attempted to register a nil Module');
|
|
|
|
gBrowserModules.Add(AModule);
|
|
|
|
end;
|
|
|
|
|
|
|
|
function GetBrowserModule(AIndex: Integer): TBrowserModule;
|
|
|
|
begin
|
|
|
|
if AIndex < 0 then Exit(nil);
|
|
|
|
Result := TBrowserModule(gBrowserModules.Items[AIndex]);
|
|
|
|
end;
|
|
|
|
|
|
|
|
function GetBrowserModuleCount: Integer;
|
|
|
|
begin
|
|
|
|
Result := gBrowserModules.Count;
|
|
|
|
end;
|
|
|
|
|
|
|
|
{ TBrowserModule }
|
|
|
|
|
|
|
|
constructor TBrowserModule.Create;
|
|
|
|
begin
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
2013-09-16 11:07:57 +00:00
|
|
|
function TBrowserModule.GetModuleUIElements: TBrowserModuleUIElements;
|
|
|
|
begin
|
|
|
|
Result := [bmueEnabledDisableMenu];
|
|
|
|
end;
|
|
|
|
|
2011-09-08 14:16:34 +00:00
|
|
|
function TBrowserModule.HandleOnPageLoad(AInput: string; out AOutput: string): Boolean;
|
2011-09-08 07:05:53 +00:00
|
|
|
begin
|
2011-09-08 14:16:34 +00:00
|
|
|
AOutput := '';
|
|
|
|
Result := False;
|
2011-09-08 07:05:53 +00:00
|
|
|
end;
|
|
|
|
|
2013-09-16 11:07:57 +00:00
|
|
|
function TBrowserModule.GetCommandCount: Integer;
|
|
|
|
begin
|
|
|
|
Result := 0;
|
|
|
|
end;
|
|
|
|
|
|
|
|
function TBrowserModule.GetCommandName(AID: Integer): string;
|
|
|
|
begin
|
|
|
|
Result := '';
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TBrowserModule.ExecuteCommand(AID: Integer);
|
|
|
|
begin
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
2011-09-08 07:05:53 +00:00
|
|
|
initialization
|
|
|
|
gBrowserModules := TList.Create;
|
|
|
|
finalization
|
|
|
|
gBrowserModules.Free;
|
|
|
|
end.
|
|
|
|
|