toolintf.pas
来自「是 delphi6的函数库」· PAS 代码 · 共 519 行 · 第 1/2 页
PAS
519 行
registered through the RegisiterFilesystem API.
( Informational )
GetParentHandle - returns a HWND, which should be used as the parent for
any windows created by the client.
GetProjectName - returns a fully qualified path name of the currently
open project file, or an empty string if no project is
open.
GetUnitCount - returns the current number of units belonging to the
project.
GetUnitName - returns a fully qualified name of the specified unit.
EnumProjectUnits - Calls EnumProc once for each unit in the project.
GetFormCount - returns the current number of forms belonging to the
project.
GetFormName - returns a fully qualified name of the specified form
file.
GetCurrentFile - returns a fully qualified name of the current file,
which could either be a form or unit (.PAS).
Returns a blank string if no file is currently selected.
IsFileOpen - returns True if the named file is currently open.
GetNewModuleName - Automatically generates a valid Filename and Unit
identifier. Uses the same mechanism as used by the IDE.
( Component library interface )
GetModuleCount - Returns the number of currently installed modules in the
component library.
GetModuleName - Returns then name of the module given its index.
GetComponentCount- Returns the number of components installed in a particular
module.
GetComponentName - Returns the name of the component given its module index
and index in that mnodule.
( Virtual file system interface )
RegisterFileSystem - Registers an externally defined file system.
UnRegisterFileSystem - UnRegisters an externally defined file system.
( Module Interfaces )
GetModuleInterface - Return an module interface associated with the given
file. NOTE: This function returns the same interface
instance for a given module, only the reference count
is adjusted. The user of this interface owns it and
must call release when finished.
GetFormModuleInterface - Return an module interface associated with the
given form. NOTE: See GetModuleInterface.
( Menu Interface )
GetMainMenu - Returns an interface to the IDE's main menu.
See TIMainMenuIntf for details.
( Notification registration )
AddNotifier - Registers an instance of a descendant to TIAddIn-
Notifier.
RemoveNotifier - Removes a registered instance of a TIAddInNotifier.
( Pascal string handling functions )
NOTE: These functions are provided for IDE add-in writers to use a language
other than Pascal. (C++, for example). Add-in writers using Delphi
will never need to use these functions (see doc about the ShareMem
unit and DELPHIMM.DLL)
NewPascalString - Allocates and returns a pascal long string from the
provided PChar (char *, in C parlance). Passing an
empty string or nil for the PChar will return nil for
the string (Pascal's equivilant of an empty string).
FreePascalString - Attempts to free the given Pascal string by
decrementing the internal reference count and
releasing the memory if the count returns to zero.
ReferencePascalString - Increments the reference count of the given Pascal
string. This allows the calling function to
manually extend the lifetime of the string. NOTE:
a corresponding call to FreePascalString must be
made in order to actually release the string's
memory.
AssignPascalString - Assigns one Pascal string to another. NOTE: NEVER
directly assign Pascal strings to each other. Doing
so will orphan memory and cause a memory leak. The
destination may be referencing another string, so
the reference count of that string must be decremented.
Likewise, the reference count of the source string
must be incremented.
( Error handling )
RaiseException - This will cause an Exception to be raised with the IDE
with the string passed to this function. ***NOTE: This
will cause the stack to unwind and control will **NOT**
return to this point. It is the resposibility of the
Library to be sure it has correctly handled the error
condition before calling this procedure.
( Configuration Access )
GetBaseRegistryKey - returns a string representing the full path to
Delphi's base registry key. This key is relative
to HKEY_CURRENT_USER.
( Extensions )
GetFormBounds - Returns the default bounds of an initial form or custom
module.
ProjectCreate - Creates a project using the new TIProjectCreator interface.
This allows finer control over the creation process
ModuleCreate - Creates a module using the new TIModuleCreator interface.
Same as above.
( Extended Notification registration )
AddNotifierEx - Registers an instance of a descendant to TIAddIn-
Notifier. Only notifiers registered using this
function will have EventNotification interface
function called.
}
TCreateModuleFlag = (cmAddToProject, cmShowSource, cmShowForm,
cmUnNamed, cmNewUnit, cmNewForm, cmMainForm, cmMarkModified,
cmNewFile, cmExisting);
TCreateModuleFlags = set of TCreateModuleFlag;
TCreateProjectFlag = (cpCustom, cpApplication, cpLibrary, cpCanShowSource,
cpExisting, cpConsole);
TCreateProjectFlags = set of TCreateProjectFlag;
TBoundsType = (btForm, btCustomModule);
TProjectEnumProc = function (Param: Pointer; const FileName, UnitName,
FormName: string): Boolean stdcall;
TProjectEnumModuleProc = function (Param: Pointer; const FileName, UnitName,
FormName, DesignClass: string): Boolean stdcall;
TIToolServices = class(TInterface)
public
{ Action interfaces }
function CloseProject: Boolean; virtual; stdcall; abstract;
function OpenProject(const ProjName: string): Boolean; virtual; stdcall; abstract;
function OpenProjectInfo(const ProjName: string): Boolean; virtual; stdcall; abstract;
function SaveProject: Boolean; virtual; stdcall; abstract;
function CloseFile(const FileName: string): Boolean; virtual; stdcall; abstract;
function SaveFile(const FileName: string): Boolean; virtual; stdcall; abstract;
function OpenFile(const FileName: string): Boolean; virtual; stdcall; abstract;
function ReloadFile(const FileName: string): Boolean; virtual; stdcall; abstract;
function ModalDialogBox(Instance: THandle; TemplateName: PChar; WndParent: HWnd;
DialogFunc: TFarProc; InitParam: LongInt): Integer; virtual; stdcall; abstract;
function CreateModule(const ModuleName: string;
Source, Form: IStream; CreateFlags: TCreateModuleFlags): Boolean;
virtual; stdcall; abstract;
function CreateModuleEx(const ModuleName, FormName, AncestorClass,
FileSystem: string; Source, Form: IStream;
CreateFlags: TCreateModuleFlags): TIModuleInterface; virtual; stdcall; abstract;
{ Project/UI information }
function GetParentHandle: HWND; virtual; stdcall; abstract;
function GetProjectName: string; virtual; stdcall; abstract;
function GetUnitCount: Integer; virtual; stdcall; abstract;
function GetUnitName(Index: Integer): string; virtual; stdcall; abstract;
function EnumProjectUnits(EnumProc: TProjectEnumProc; Param: Pointer): Boolean;
virtual; stdcall; abstract;
function GetFormCount: Integer; virtual; stdcall; abstract;
function GetFormName(Index: Integer): string; virtual; stdcall; abstract;
function GetCurrentFile: string; virtual; stdcall; abstract;
function IsFileOpen(const FileName: string): Boolean; virtual; stdcall; abstract;
function GetNewModuleName(var UnitIdent, FileName: string): Boolean; virtual; stdcall; abstract;
{ Component Library interface }
function GetModuleCount: Integer; virtual; stdcall; abstract;
function GetModuleName(Index: Integer): string; virtual; stdcall; abstract;
function GetComponentCount(ModIndex: Integer): Integer; virtual; stdcall; abstract;
function GetComponentName(ModIndex, CompIndex: Integer): string; virtual; stdcall; abstract;
{function InstallModule(const ModuleName: string): Boolean; virtual; stdcall; abstract;
function CompileLibrary: Boolean; virtual; stdcall; abstract;}
{ Virtual File system interfaces }
function RegisterFileSystem(AVirtualFileSystem: TIVirtualFileSystem): Boolean; virtual; stdcall; abstract;
function UnRegisterFileSystem(const Ident: string): Boolean; virtual; stdcall; abstract;
function GetFileSystem(const Ident: string): TIVirtualFileSystem; virtual; stdcall; abstract;
{ Editor Interfaces }
function GetModuleInterface(const FileName: string): TIModuleInterface;
virtual; stdcall; abstract;
function GetFormModuleInterface(const FormName: string): TIModuleInterface;
virtual; stdcall; abstract;
{ Menu Interfaces }
function GetMainMenu: TIMainMenuIntf; virtual; stdcall; abstract;
{ Notification registration }
function AddNotifier(AddInNotifier: TIAddInNotifier): Boolean;
virtual; stdcall; abstract;
function RemoveNotifier(AddInNotifier: TIAddInNotifier): Boolean;
virtual; stdcall; abstract;
{ Pascal string handling functions }
function NewPascalString(Str: PChar): Pointer; virtual; stdcall; abstract;
procedure FreePascalString(var Str: Pointer); virtual; stdcall; abstract;
procedure ReferencePascalString(var Str: Pointer); virtual; stdcall; abstract;
procedure AssignPascalString(var Dest, Src: Pointer); virtual; stdcall; abstract;
{ Error handling }
procedure RaiseException(const Message: string); virtual; stdcall; abstract;
{ Configuration Access }
function GetBaseRegistryKey: string; virtual; stdcall; abstract;
{ Extensions }
function GetFormBounds(BoundsType: TBoundsType): TRect; virtual; stdcall; abstract;
function ProjectCreate(ProjectCreator: TIProjectCreator;
CreateFlags: TCreateProjectFlags): TIModuleInterface; virtual; stdcall; abstract;
function ModuleCreate(ModuleCreator: TIModuleCreator;
CreateFlags: TCreateModuleFlags): TIModuleInterface; virtual; stdcall; abstract;
{ Extended Notification registration }
function AddNotifierEx(AddInNotifier: TIAddInNotifier): Boolean;
virtual; stdcall; abstract;
{ Create a unique unit name and class name }
function GetNewModuleAndClassName(const Prefix: string; var UnitIdent,
ClassName, FileName: string): Boolean; virtual; stdcall; abstract;
function CreateCppModule(const ModuleName, FormName, AncestorClass,
FileSystem: string; HdrSource, Source, Form: IStream;
CreateFlags: TCreateModuleFlags): TIModuleInterface; virtual; stdcall; abstract;
function GetVcsCount: Integer; virtual; stdcall; abstract;
procedure GetVcsList(List: TStringList); virtual; stdcall; abstract;
function GetVcsName(Index: Integer): string; virtual; stdcall; abstract;
function EnumProjectModules(EnumProc: TProjectEnumModuleProc; Param: Pointer): Boolean;
virtual; stdcall; abstract;
function ProjectCreateEx(ProjectCreator: TIProjectCreatorEx;
CreateFlags: TCreateProjectFlags): TIModuleInterface; virtual; stdcall; abstract;
function ModuleCreateEx(ModuleCreator: TIModuleCreatorEx;
CreateFlags: TCreateModuleFlags): TIModuleInterface; virtual; stdcall; abstract;
end;
implementation
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?