📄 usecplugimp.~pas
字号:
unit uSecPlugImp;
interface
uses
SysUtils, Classes, uSecPlugInf, Dialogs, Controls, Graphics, Windows;
type
TOnAction=procedure(sender:TObject;Params:variant) of object;
TOnMenuPopUp=procedure(sender:TObject;Params:variant;var PlugName:widestring;var ItemHeight,ItemWidth:integer) of object;
TOnDrawMenuItem=procedure(sender:TObject;ACanvas: TCanvas;ARect: TRect) of object;
TSecPlug = class(TInterfacedObject,ISecPlug)
private
FOnExecute: TNotifyEvent;
FOnLoad: TNotifyEvent;
FOnUnLoad: TNotifyEvent;
FName: widestring;
FVer: widestring;
FPlugType: TPlugType;
FAutoExec:Boolean;
FDescription:widestring;
FDisplayInMenu:Boolean;
FDrawMenu:Boolean;
FFileName:widestring;
FImageList:TImageList;
FHostForm:TComponent;
FOnGetContext:TNotifyEvent;
FOnAction:TOnAction;
FOnMenuPopUp:TOnMenuPopUp;
FOnDrawMenuItem: TOnDrawMenuItem;
function GetName:widestring;stdcall;
procedure SetName(const value:widestring);stdcall;
function GetVer:widestring;stdcall;
procedure SetVer(const value:widestring);stdcall;
function GetPlugType:TPlugType;stdcall;
procedure SetPlugType(const value:TPlugType);stdcall;
function GetDisplayInMenu:Boolean;stdcall;
procedure SetDisplayInMenu(const value:Boolean);stdcall;
function GetAutoExec:Boolean;stdcall;
procedure SetAutoExec(const value:Boolean);stdcall;
function GetDescription:widestring;stdcall;
procedure SetDescription(const value:widestring);stdcall;
function GetFileName:widestring;stdcall;
procedure SetFileName(const value:widestring);stdcall;
function GetPlugImages:TImageList;stdcall;
procedure SetPlugImages(const value:TImageList);stdcall;
function GetDrawMenu: Boolean;stdcall;
procedure SetDrawMenu(const Value: Boolean);stdcall;
function GetHostForm: TComponent;stdcall;
procedure SetHostForm(const Value: TComponent);stdcall;
procedure SetOnExecute(const Value: TNotifyEvent);
procedure SetOnLoad(const Value: TNotifyEvent);
procedure SetOnUnLoad(const Value: TNotifyEvent);
procedure SetOnGetContext(const Value: TNotifyEvent);
procedure SetOnAction(const Value: TOnAction);
procedure SetOnMenuPopUp(const Value: TOnMenuPopUp);
procedure SetOnDrawMenuItem(const Value: TOnDrawMenuItem);
{ Private declarations }
protected
procedure Execute;stdcall;
procedure Load;stdcall;
procedure UnLoad;stdcall;
procedure GetContext;stdcall;
procedure Action(Params:variant);stdcall;
procedure MenuPopup(Params:variant;var PlugName:widestring;var ItemHeight,ItemWidth:integer);stdcall;
procedure DrawMenuItem(ACanvas: TCanvas;ARect: TRect);stdcall;
public
{ Public declarations }
property OnExecute:TNotifyEvent read FOnExecute write SetOnExecute;
property OnLoad:TNotifyEvent read FOnLoad write SetOnLoad;
property OnUnLoad:TNotifyEvent read FOnUnLoad write SetOnUnLoad;
property OnGetContext:TNotifyEvent read FOnGetContext write SetOnGetContext;
property OnAction:TOnAction read FOnAction write SetOnAction;
property OnMenuPopUp:TOnMenuPopUp read FOnMenuPopUp write SetOnMenuPopUp;
property OnDrawMenuItem:TOnDrawMenuItem read FOnDrawMenuItem write SetOnDrawMenuItem;
property Name:widestring read GetName write SetName;
property Ver:widestring read GetVer write SetVer;
property PlugType:TPlugType read GetPlugType write SetPlugType;
property AutoExec:Boolean read GetAutoExec write SetAutoExec;
property DisplayInMenu:Boolean read GetDisplayInMenu write SetDisplayInMenu;
property DrawMenu:Boolean read GetDrawMenu write SetDrawMenu;
property Description:widestring read GetDescription write SetDescription;
property FileName:widestring read GetFileName write SetFileName;
property PlugImages:TImageList read GetPlugImages write SetPlugImages;
property HostForm:TComponent read GetHostForm write SetHostForm;
end;
implementation
{ TSecPlug }
procedure TSecPlug.Execute;
begin
if assigned(FOnExecute) then
FOnExecute(self);
end;
function TSecPlug.GetPlugType: TPlugType;
begin
result:=FPlugType;
end;
function TSecPlug.GetName: widestring;
begin
result:=FName;
end;
function TSecPlug.GetVer: widestring;
begin
result:=FVer;
end;
procedure TSecPlug.Load;
begin
if assigned(FOnLoad) then
FOnLoad(self);
end;
procedure TSecPlug.SetPlugType(const value: TPlugType);
begin
FPlugType:=value;
end;
procedure TSecPlug.SetName(const value: widestring);
begin
FName:=value;
end;
procedure TSecPlug.SetOnExecute(const Value: TNotifyEvent);
begin
FOnExecute := Value;
end;
procedure TSecPlug.SetOnLoad(const Value: TNotifyEvent);
begin
FOnLoad := Value;
end;
procedure TSecPlug.SetOnUnLoad(const Value: TNotifyEvent);
begin
FOnUnLoad := Value;
end;
procedure TSecPlug.SetVer(const value: widestring);
begin
FVer:=value;
end;
procedure TSecPlug.UnLoad;
begin
if assigned(FOnUnLoad) then
FOnUnLoad(self);
end;
function TSecPlug.GetAutoExec: Boolean;
begin
result:=FAutoExec;
end;
procedure TSecPlug.SetAutoExec(const value: Boolean);
begin
FAutoExec:=value;
end;
function TSecPlug.GetDescription: widestring;
begin
result:=FDescription;
end;
procedure TSecPlug.SetDescription(const value: widestring);
begin
FDescription:=value;
end;
function TSecPlug.GetFileName: widestring;
begin
result:=FFileName;
end;
procedure TSecPlug.SetFileName(const value: widestring);
begin
FFileName:=value;
end;
function TSecPlug.GetPlugImages: TImageList;
begin
result:=FImageList;
end;
procedure TSecPlug.SetPlugImages(const value: TImageList);
begin
FImageList:=value;
end;
procedure TSecPlug.GetContext;
begin
if assigned(FOnGetContext) then
FOnGetContext(self);
end;
procedure TSecPlug.SetOnGetContext(const Value: TNotifyEvent);
begin
FOnGetContext := Value;
end;
function TSecPlug.GetDisplayInMenu: Boolean;
begin
result:=FDisplayInMenu;
end;
procedure TSecPlug.SetDisplayInMenu(const value: Boolean);
begin
FDisplayInMenu:=value;
end;
procedure TSecPlug.Action(Params:variant);
begin
if assigned(FOnAction) then
FOnAction(self,Params);
end;
procedure TSecPlug.SetOnAction(const Value: TOnAction);
begin
FOnAction := Value;
end;
function TSecPlug.GetDrawMenu: Boolean;
begin
result:=FDrawMenu;
end;
procedure TSecPlug.SetDrawMenu(const Value: Boolean);
begin
FDrawMenu:=Value;
end;
procedure TSecPlug.MenuPopup(Params:variant;var PlugName: widestring; var ItemHeight,
ItemWidth: integer);
begin
if assigned(FOnMenuPopUp) then
FOnMenuPopUp(self,Params,PlugName,ItemHeight,ItemWidth);
end;
procedure TSecPlug.SetOnMenuPopUp(const Value: TOnMenuPopUp);
begin
FOnMenuPopUp := Value;
end;
procedure TSecPlug.DrawMenuItem(ACanvas: TCanvas; ARect: TRect);
begin
if assigned(FOnDrawMenuItem) then
FOnDrawMenuItem(self,ACanvas,ARect);
end;
procedure TSecPlug.SetOnDrawMenuItem(const Value: TOnDrawMenuItem);
begin
FOnDrawMenuItem := Value;
end;
function TSecPlug.GetHostForm: TComponent;
begin
result:=FHostForm;
end;
procedure TSecPlug.SetHostForm(const Value: TComponent);
begin
FHostForm:=Value;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -