home *** CD-ROM | disk | FTP | other *** search
- unit LibTest;
-
- interface
-
- uses Windows, SysUtils, Classes, Forms, ExptIntf, ToolIntf, LibIntf, Dialogs;
-
- type
- TProjectOpenCloseEvent = procedure (Sender: TObject; Opening: Boolean) of Object;
-
- TLibExpert = class (TIExpert)
- public
- function GetName: string; override;
- function GetAuthor: string; override;
- function GetComment: string; override;
- function GetPage: string; override;
- function GetGlyph: hIcon; override;
- function GetStyle: TExpertStyle; override;
- function GetState: TExpertState; override;
- function GetIDString: string; override;
- function GetMenuText: string; override;
- procedure Execute; override;
- constructor Create;
- destructor Destroy; override;
- procedure MenuClick (Sender: TIMenuItemIntf);
- private
- MyMenuItem: TIMenuItemIntf;
- end;
-
- implementation
-
- uses LibTestForm;
-
- resourcestring
- idAuthor = 'Dave''s ExpertWare Inc.';
- idName = 'LibIntf Sample Expert';
- idMenuName = 'LibExptMenuItem';
-
- { TLibExpert }
-
- constructor TLibExpert.Create;
- var
- Target, Parent: TIMenuItemIntf;
- begin
- Inherited Create;
- with ToolServices.GetMainMenu do
- try
- Target := FindMenuItem ('ToolsOptionsItem');
- if Target <> nil then
- try
- Parent := Target.GetParent;
- if Parent <> nil then
- try
- MyMenuItem := Parent.InsertItem (Target.GetIndex + 1,
- idName, idMenuName, '', 0, 0, 0,
- [mfEnabled, mfVisible], MenuClick);
- finally
- Parent.Free;
- end;
- finally
- Target.Free;
- end;
- finally
- Free;
- end;
- end;
-
- destructor TLibExpert.Destroy;
- begin
- MyMenuItem.Free;
- Inherited Destroy;
- end;
-
- function TLibExpert.GetName: string;
- begin Result := idName; end;
-
- function TLibExpert.GetAuthor: string;
- begin Result := ''; end;
-
- function TLibExpert.GetComment: string;
- begin Result := ''; end;
-
- function TLibExpert.GetPage: string;
- begin Result := ''; end;
-
- function TLibExpert.GetGlyph: hIcon;
- begin Result := 0; end;
-
- function TLibExpert.GetStyle: TExpertStyle;
- begin Result := esAddIn; end;
-
- function TLibExpert.GetState: TExpertState;
- begin Result := []; end;
-
- function TLibExpert.GetIDString: string;
- begin Result := idAuthor + idName; end;
-
- function TLibExpert.GetMenuText: string;
- begin Result := ''; end;
-
- procedure TLibExpert.Execute;
- begin end;
-
- procedure TLibExpert.MenuClick (Sender: TIMenuItemIntf);
- begin
- with TLibExTest.Create (Application) do try
- ShowModal;
- finally
- Free;
- end;
- end;
-
- end.
-