home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 April / Chip_1997-04_cd.bin / prezent / cb / data.z / EXPTINTF.PAS < prev    next >
Pascal/Delphi Source File  |  1997-01-16  |  6KB  |  140 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Visual Component Library                 }
  5. {                                                       }
  6. {       Copyright (c) 1995,1996 Borland International   }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. unit Exptintf;
  11.  
  12. interface
  13.  
  14. uses Windows, VirtIntf, ToolIntf;
  15.  
  16. const
  17.   isExperts = 'Experts';
  18.   ExpertEntryPoint = 'INITEXPERT0016';
  19.   ValidExpertVersion = 2;
  20.  
  21. type
  22.   TExpertStyle = (esStandard, esForm, esProject, esAddIn);
  23.   TExpertState = set of (esEnabled, esChecked);
  24.  
  25.   {
  26.     This is the declaration of the pure-virtual base class for the expert
  27.     interface within the Delphi IDE.
  28.  
  29.     NOTE: In Delphi 1.0, the GetGlyph function used to return an HBITMAP,
  30.           whereas now it must return an HICON.
  31.  
  32.     GetName -      REQUIRED.  This must return a unique descriptive name
  33.                    identifying this expert.
  34.  
  35.     GetAuthor  -   REQUIRED is style is esForm or esProject.  This should
  36.                    return the "author" of this add-in/expert.  This could
  37.                    be a person or company, for example.  This value will
  38.                    be displayed in the Object Repository.
  39.  
  40.     GetComment -   REQUIRED if style is esForm or esProject.  This should
  41.                    return a 1 - 2 sentence describing the function of this
  42.                    expert.
  43.  
  44.     GetPage -      REQUIRED if style is esForm or esProject. Should return
  45.                    short string indicating on  which page in the repository
  46.                    this expert should be placed.  NOTE: The user can still
  47.                    override this setting from the Tool|Repository dialog.
  48.  
  49.     GetGlyph -     REQUIRED if style is esForm or esProject.  This should
  50.                    return a handle to a icon to be displayed in the form or
  51.                    project list boxes or dialogs.  Return 0 to display the
  52.                    default icon.
  53.  
  54.     GetStyle -     REQUIRED.  Returns one of four possible values:
  55.                    esStandard - Tells the IDE to treat the interface to
  56.                                 this expert as a menu item on the Tools/Experts
  57.                                 menu.
  58.                    esForm     - Tells the IDE to treat this expert interface
  59.                                 in a fashion similar to form templates.
  60.                    esProject  - Tells the IDE to treat this interface in a
  61.                                 fashion similar to project templates.
  62.                    esAddIn    - Tells the IDE that this expert handles all its
  63.                                 own interfacing to the IDE through the
  64.                                 TIToolServices interface.
  65.  
  66.     GetState -     REQUIRED. If the style is esStandard, esChecked will cause
  67.                    the menu to display a checkmark. NOTE: This function is
  68.                    called each time the expert is shown in a menu or listbox in
  69.                    order to determine how it should be displayed.
  70.  
  71.     GetIDString -  REQUIRED. This ID string should be unique to all experts
  72.                    that could be installed.  By convention, the format of the
  73.                    string is:
  74.                    CompanyName.ExpertFunction, ex. Borland.WidgetExpert
  75.  
  76.     GetMenuText -  REQURED if style is esStandard.  This should return the
  77.                    actual text to display for the menu item. NOTE: This
  78.                    function is called each time the parent menu is pulled-down,
  79.                    so it is possible to provide context sensative text.
  80.  
  81.     Execute -      REQUIRED if style is esStandard, esForm, or esProject.
  82.                    Called whenever this expert is invoked via the menu, form
  83.                    repository dialog, or project repository dialog.  The style
  84.                    will determine how the expert was invoked.  This procedure
  85.                    is never called if the style is esAddIn.
  86.  
  87.     TExpertInitProc - defines the number and types of parameters passed to the
  88.                       single exported entry-point to the expert DLL.
  89.                       ToolServices - a pure-virtual class containing all the
  90.                                      tool services provided by the IDE.
  91.                       RegisterProc - The function to call in order to register
  92.                                      an expert.  NOTE: This function is called
  93.                                      once for each expert instance that the DLL
  94.                                      wants to register with the IDE.
  95.                       Terminate -    Set this parameter to point to a procedure
  96.                                      that will be called immediately before the
  97.                                      expert DLL is unloaded by the IDE.  Leave
  98.                                      nil, if not needed.
  99.   }
  100.  
  101.   TIExpert = class(TInterface)
  102.   public
  103.     { Expert UI strings }
  104.     function GetName: string; virtual; stdcall; abstract;
  105.     function GetAuthor: string; virtual; stdcall; abstract;
  106.     function GetComment: string; virtual; stdcall; abstract;
  107.     function GetPage: string; virtual; stdcall; abstract;
  108.     function GetGlyph: HICON; virtual; stdcall; abstract;
  109.     function GetStyle: TExpertStyle; virtual; stdcall; abstract;
  110.     function GetState: TExpertState; virtual; stdcall; abstract;
  111.     function GetIDString: string; virtual; stdcall; abstract;
  112.     function GetMenuText: string; virtual; stdcall; abstract;
  113.  
  114.     { Launch the Expert }
  115.     procedure Execute; virtual; stdcall; abstract;
  116.   end;
  117.  
  118.   TExpertRegisterProc = function(Expert: TIExpert): Boolean;
  119.   TExpertTerminateProc = procedure;
  120.   TExpertInitProc = function(ToolServices: TIToolServices;
  121.     RegisterProc: TExpertRegisterProc;
  122.     var Terminate: TExpertTerminateProc): Boolean stdcall;
  123.  
  124. var
  125.   LibraryExpertProc: TExpertRegisterProc = nil;
  126.   ToolServices: TIToolServices = nil;
  127.  
  128. procedure RegisterLibraryExpert(Expert: TIExpert);
  129.  
  130. implementation
  131.  
  132. procedure RegisterLibraryExpert(Expert: TIExpert);
  133. begin
  134.   if @LibraryExpertProc <> nil then
  135.     LibraryExpertProc(Expert);
  136. end;
  137.  
  138. end.
  139.  
  140.