home *** CD-ROM | disk | FTP | other *** search
/ PC Format Collection 48 / SENT14D.ISO / tech / delphi / disk14 / doc.pak / TOOLINTF.INT < prev    next >
Encoding:
Text File  |  1995-08-24  |  8.2 KB  |  171 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Visual Component Library                 }
  5. {                                                       }
  6. {       Copyright (c) 1995 Borland International        }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. unit ToolIntf;
  11.  
  12. interface
  13.  
  14. uses WinTypes, VirtIntf;
  15.  
  16. type
  17.   { The Tool services object is created on the application side, and is
  18.     passed to the VCS/Expert Manager DLL during initialization.  Note that
  19.     the application is responsible for creating and freeing the interface
  20.     object, and the client should never free the interface.
  21.  
  22.     The following functions are available to the client:
  23.  
  24.     ( Actions )
  25.  
  26.     CloseProject     - returns True if no project open, or if the currently
  27.                        open project can be closed.
  28.  
  29.     OpenProject      - returns True if the named project can be opened.  Pass an
  30.                        empty string to create a new project and main form.
  31.  
  32.     OpenProjectInfo  - returns True if the named project file can be opened.
  33.                        This routine bypasses all the normal project load
  34.                        features (such as loading a desktop file, showing
  35.                        the source code, etc), and simply opens the .DPJ and
  36.                        .OPT files.
  37.  
  38.     SaveProject      - returns True if the project is unmodified, if there
  39.                        is no project open, or if the open project can be saved.
  40.  
  41.     CloseFile        - returns True if the specified file is not currently
  42.                        open, or if it can be closed.
  43.  
  44.     OpenFile         - returns True if the specified file is already open
  45.                        or can be opened.
  46.  
  47.     ReloadFile       - returns True if the file is already open and was
  48.                        reloaded from disk.  (NOTE: This will not perform any
  49.                        checking of the current editor state).
  50.  
  51.     RefreshBuffers   - causes the IDE to check the time/date stamp of each open
  52.                        file to determine if the file has changed on disk.  If so,
  53.                        the file is re-read.
  54.  
  55.     ModalDialogBox   - used by non-VCL DLL's to present a dialog box which is
  56.                        modal.  Note that DLLs written using VCL can simply call
  57.                        a form's ShowModal function.
  58.  
  59.     CreateModule     - Will create new module from memory images of the source
  60.                        and, optionally, the form file.  The TCreateModuleFlags are:
  61.       cmAddToProject - Add the new module to the currently open project.
  62.       cmShowSource   - Show the source file in the top-most editor window.
  63.       cmShowForm     - If a form is created, show it above the source.
  64.       cmUnNamed      - Will mark the module as unnamed which will cause the
  65.                        SaveAs dialog to show the first time the user attempts to
  66.                        save the file.
  67.       cmNewUnit      - Creates a new unit and adds it to the current project.
  68.                        NOTE: all other parameters are ignored.
  69.       cmNewForm      - Creates a new form and adds it to the current project.
  70.                        NOTE: all other parameters are ignored.
  71.       cmMainForm     - If the module includes a form, make it the main form of
  72.                        the currently open project. Only valid with the
  73.                        cmAddToProject option.
  74.       cmMarkModified - Will insure that the new module is marked as modified.
  75.  
  76.     ( Informational )
  77.  
  78.     GetParentHandle  - returns a HWND, which should be used as the parent for
  79.                        any windows created by the client.
  80.  
  81.     GetProjectName   - returns a fully qualified path name of the currently
  82.                        open project file, or an empty string if no project is
  83.                        open.
  84.  
  85.     GetUnitCount     - returns the current number of units belonging to the
  86.                        project.
  87.  
  88.     GetUnitName      - returns a fully qualified name of the specified unit.
  89.  
  90.     GetFormCount     - returns the current number of forms belonging to the
  91.                        project.
  92.  
  93.     GetFormName      - returns a fully qualified name of the specified form
  94.                        file.
  95.  
  96.     GetCurrentFile   - returns a fully qualified name of the current file,
  97.                        which could either be a form or unit (.PAS).
  98.                        Returns a blank string if no file is currently selected.
  99.  
  100.     IsFileOpen       - returns True if the named file is currently open.
  101.  
  102.     GetNewModuleName - Automatically generates a valid Filename and Unit
  103.                        identifier.  Uses the same mechanism as used by the IDE.
  104.  
  105.     ( Component library interface )
  106.  
  107.     GetModuleCount   - Returns the number of currently installed modules in the
  108.                        component library.
  109.  
  110.     GetModuleName    - Returns then name of the module given its index.
  111.  
  112.     GetComponentCount- Returns the number of components installed in a particular
  113.                        module.
  114.  
  115.     GetComponentName - Returns the name of the component given its module index
  116.                        and index in that mnodule.
  117.  
  118.     ( Error handling )
  119.  
  120.     RaiseException   - This will cause an Exception to be raised with the IDE
  121.                        with the string passed to this function.  ***NOTE: This
  122.                        will cause the stack to unwind and control will **NOT**
  123.                        return to this point.  It is the resposibility of the
  124.                        Library to be sure it has correctly handled the error
  125.                        condition before calling this procedure.
  126.     }
  127.  
  128.   TCreateModuleFlags = set of (cmAddToProject, cmShowSource, cmShowForm,
  129.     cmUnNamed, cmNewUnit, cmNewForm, cmMainForm, cmMarkModified);
  130.  
  131.   TIToolServices = class(TInterface)
  132.   public
  133.     { Action interfaces }
  134.     function CloseProject: Boolean; virtual; export; abstract;
  135.     function OpenProject(const ProjName: string): Boolean; virtual; export; abstract;
  136.     function OpenProjectInfo(const ProjName: string): Boolean; virtual; export; abstract;
  137.     function SaveProject: Boolean; virtual; export; abstract;
  138.     function CloseFile(const FileName: string): Boolean; virtual; export; abstract;
  139.     function SaveFile(const FileName: string): Boolean; virtual; export; abstract;
  140.     function OpenFile(const FileName: string): Boolean; virtual; export; abstract;
  141.     function ReloadFile(const FileName: string): Boolean; virtual; export; abstract;
  142.     function ModalDialogBox(Instance: THandle; TemplateName: PChar;  WndParent: HWnd;
  143.       DialogFunc: TFarProc; InitParam: LongInt): Integer; virtual; export; abstract;
  144.     function CreateModule(const ModuleName: string; Source, Form: TIStream;
  145.       CreateFlags: TCreateModuleFlags): Boolean; virtual; export; abstract;
  146.  
  147.     { Project/UI information }
  148.     function GetParentHandle: HWND; virtual; export; abstract;
  149.     function GetProjectName: string; virtual; export; abstract;
  150.     function GetUnitCount: Integer; virtual; export; abstract;
  151.     function GetUnitName(Index: Integer): string; virtual; export; abstract;
  152.     function GetFormCount: Integer; virtual; export; abstract;
  153.     function GetFormName(Index: Integer): string; virtual; export; abstract;
  154.     function GetCurrentFile: string; virtual; export; abstract;
  155.     function IsFileOpen(const FileName: string): Boolean; virtual; export; abstract;
  156.     function GetNewModuleName(var UnitIdent, FileName: string): Boolean; virtual; export; abstract;
  157.  
  158.     { Component Library interface }
  159.     function GetModuleCount: Integer; virtual; export; abstract;
  160.     function GetModuleName(Index: Integer): string; virtual; export; abstract;
  161.     function GetComponentCount(ModIndex: Integer): Integer; virtual; export; abstract;
  162.     function GetComponentName(ModIndex, CompIndex: Integer): string; virtual; export; abstract;
  163.     {function InstallModule(const ModuleName: string): Boolean; virtual; export; abstract;
  164.     function CompileLibrary: Boolean; virtual; export; abstract;}
  165.  
  166.     { Error handling }
  167.     procedure RaiseException(const Message: string); virtual; export; abstract;
  168.   end;
  169.  
  170. implementation
  171.