⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editintf.pas

📁 是 delphi6的函数库
💻 PAS
📖 第 1 页 / 共 2 页
字号:
  TIFormInterface = class(TInterface)
  public
    function FileName: string; virtual; stdcall; abstract;
    function FormModified: Boolean; virtual; stdcall; abstract;
    function MarkModified: Boolean; virtual; stdcall; abstract;
    function GetFormComponent: TIComponentInterface; virtual; stdcall; abstract;
    function FindComponent(const Name: string): TIComponentInterface;
      virtual; stdcall; abstract;
    function GetComponentFromHandle(ComponentHandle: Pointer): TIComponentInterface;
      virtual; stdcall; abstract;
    function GetSelCount: Integer; virtual; stdcall; abstract;
    function GetSelComponent(Index: Integer): TIComponentInterface;
      virtual; stdcall; abstract;
    function GetCreateParent: TIComponentInterface; virtual; stdcall; abstract;
    function CreateComponent(Container: TIComponentInterface;
      const TypeName: string; X, Y, W, H: Integer): TIComponentInterface;
      virtual; stdcall; abstract;
  end;

  TResHeaderValue = (hvFlags, hvLanguage, hvDataVersion, hvVersion,
    hvCharacteristics);

  { TIResourceEntry is a raw interface to a resource entry in the project's
    resource file (<projectname>.RES).

    This interface is a very raw.  No implication on what is contained within
    a particular entry is made.  It if up to the add-in developer to interpret
    the data accessed through this interface.  NOTE: The 'MAINICON' entry and
    related entries should not be modified as these are maintained by Delphi.

    GetResourceType
    SetResourceType   - Sets and gets the resource type of this entry.  Follows
                        Windows standard of specifying a type by name or value.
                        If the high-word is 0, then the low-word is the
                        resource type value, otherwise it is a pointer to a
                        null terminated ANSI (byte per char) string. Most
                        predefined types are by value.

    GetResourceName
    SetResourceName   - Sets and gets the resource name of this entry.  Follows
                        Windows standard of specifying a type by name or value.
                        If the high-word is 0, then the low-word is the
                        resource type value, otherwise it is a pointer to a
                        null terminated ANSI (byte per char) string.

    GetHeaderValue
    SetHeaderValue    - Gets and sets various resource header values.  Pass in
                        one of the TResHeaderValues enums to indicate which
                        value to get/set.  Although some values are 16bits
                        (Word) these functions operation only on 32bits
                        (Integer).

    GetData           - Returns a raw pointer to the actual resource data buffer.

    GetDataSize       - Returns the current size of the data buffer.

    SetDataSize       - Resizes the current data buffer.  If the size is
                        smaller than the current size, the data is simply
                        truncated without regard to its current contents.

    GetEntryHandle    - Returns a unique handle value identifying the resource
                        entry.
  }

  TIResourceEntry = class(TInterface)
  public
    function GetResourceType: PChar; virtual; stdcall; abstract;
    function GetResourceName: PChar; virtual; stdcall; abstract;
    function Change(NewType, NewName: PChar): Boolean; virtual; stdcall; abstract;
    function GetHeaderValue(HeaderValue: TResHeaderValue;
      var Value: Integer): Boolean; virtual; stdcall; abstract;
    function SetHeaderValue(HeaderValue: TResHeaderValue;
      Value: Integer): Boolean; virtual; stdcall; abstract;
    function GetData: Pointer; virtual; stdcall; abstract;
    function GetDataSize: Integer; virtual; stdcall; abstract;
    function SetDataSize(NewSize: Integer): Boolean; virtual; stdcall; abstract;
    function GetEntryHandle: Pointer; virtual; stdcall; abstract;
  end;

  { The TIResourceFile is an interface on the project's resource file
    (<projectname>.RES).

    GetEntryCount     - Returns the number of Resource entries.

    GetEntry          - Given an index, returns a TIResourceEntry of the
                        index'th entry.

    FindEntry         - Given a Resource type and name, return a
                        TIResourceEntry or nil if not found.

    DeleteEntry       - Given an entry handle, delete the given resource
                        entry.

    CreateEntry       - Creates a new resource entry of the given type and name
                        and returns a TIResourceEntry.  Returns nil if the
                        entry already exists or any other error occurs.
  }

  TIResourceFile = class(TInterface)
  public
    function FileName: string; virtual; stdcall; abstract;
    function GetEntryCount: Integer; virtual; stdcall; abstract;
    function GetEntry(Index: Integer): TIResourceEntry; virtual; stdcall; abstract;
    function GetEntryFromHandle(EntryHandle: Pointer): TIResourceEntry; virtual; stdcall; abstract;
    function FindEntry(ResType, Name: PChar): TIResourceEntry; virtual; stdcall; abstract;
    function DeleteEntry(EntryHandle: Pointer): Boolean; virtual; stdcall; abstract;
    function CreateEntry(ResType, Name: PChar; Flags, LanguageId: Word;
      DataVersion, Version, Characteristics: Integer): TIResourceEntry; virtual; stdcall; abstract;
  end;

  { The TIModuleNotifer interface is a client provided interface:

    Use this interface as a base to a client defined implementation.  An
    instance of the TIModuleNotifer descendant is the registered with a
    TIModuleInterface in order to receive notifications for the events
    defined by the TNotifyCode.

      ncModuleDeleted    - the Module associated with the TIModule is being
                           freed.  Perform any clean-up and free all references
                           to a TIModuleInterface, including un-registering
                           the notifier class.
      ncModuleRenamed    - The module was renamed by a "save as" operation.
      ncEditorModified   - The edit buffer was modified by the user or through
                           a TIEditWriter interface (internal or external).
      ncFormModified     - The form was modified by the user or through
                           a TIFormInterface (internal of external).
      ncEditorSelected   - An edit view was selected and focused.
      ncFormSelected     - The associated form was selected and focused.
      ncBeforeSave       - This is sent right before the module (editor and
                           possibly the form) is actually saved to the file
                           system
      ncAfterSave        - Like the ncBeforeSave this is after all saving has
                           occurred and was successful.
      ncFormSaving       - This is sent just prior to the associated form is
                           actually streamed out.  This *may* be sent after an
                           ncBeforeSave, but not always.  This may be sent as
                           a result of a project compile operated without an
                           ncBeforSave being sent.
      ncProjResModified  - If this notifier is attached to a project module,
                           this event will be sent when the project resource
                           file changes (mainly when the user changes the
                           Icon, or other changes are made through the
                           TIResourceFile interface).

      ComponentRenamed   - Before any component on the associated form/data
                           model is renamed, this event is triggered allowing
                           the interface to track any changes to component on
                           a form.  If NewName is an empty string, component,
                           OldName was deleted.  If OldName is an empty string,
                           component NewName was added and you may call
                           TIFormInterface.GetCreateParent to determine the
                           container in which this component is being created.
                           .GetCreateParent is only valid if component is a
                           TControl.
                           NOTE: This procedure will *NOT* be called when the
                           form is being destroyed due to the form designer
                           being destroyed.
  }

  TNotifyCode = (ncModuleDeleted, ncModuleRenamed, ncEditorModified,
    ncFormModified, ncEditorSelected, ncFormSelected, ncBeforeSave,
    ncAfterSave, ncFormSaving, ncProjResModified);

  TIModuleNotifier = class(TInterface)
  public
    procedure Notify(NotifyCode: TNotifyCode); virtual; stdcall; abstract;
    procedure ComponentRenamed(const AComponent: TComponent;
      const OldName, NewName: string); virtual; stdcall; abstract;
  end;

  { The TIModuleInterface represents any file/module open in the IDE:

    A module is simply a file, or a file and form.  Use this interface to gain
    access to the edit buffer and form. There is only one instance of a
    TIModuleInterface per module, but is reference counted so it can be treated
    as separate instances.  When finished with the interface, the owner *must*
    "free" it. For instance, if a TIModuleNotifier object is told that the
    module was deleted.

    Functions:

    GetEditorInterface - This returns an interface to the associated edit
                         buffer.
    GetFormInterface   - This returns an interface to the associated form, if
                         one exists.  Returns nil otherwise.
    GetAncestortModule - Return the ancestor module to this Form/Data module
                         if not a direct descendent of a TForm or TDataModule.
    GetProjectResource - If this module interface is referencing a project
                         module, this will return an interface on the project's
                         resource.  Returns nil if this is not a project module
                         interface. (this resource contains the application's
                         main ICON as entry 'MAINICON').
    IsProjectModule    - Returns True if this is a project module interface,
                         False, otherwise.
    Close              - Returns true if the module was closed.
                         This may cause the ncModuleDeleted notification to
                         be triggered.  If another form references this module
                         through form inheritance, or form linking, the module
                         will remain "open" but is marked for deletion.
                         NOTE: This will close the module without saving or
                               even asking the user to save. See the Save
                               function.
    Save               - Returns true if successfully saved. Pass True in order
                         force the save operation without the user being asked.
                         Otherwise the user will be asked.  If the module is
                         marked UnNamed, the "Save As" dialog will be
                         presented to the user.
    Rename             - Renames the current module. The form file name will be
                         derived from the new name. An ncModuleRenamed
                         notification will be sent.
    GetFileSystem      - Returns true if able to get the current file system
                         associated with this module. An empty string indicates
                         the default file system.
    SetFileSystem      - Returns true if able to set the file system to the
                         indicated file system. An empty string indicates the
                         default file system.  One use is in response to an
                         ncModuleRenamed notification and the new name is
                         unavailable in the current file system.
    ShowSource         - Selects and focuses the top-most edit buffer view.
    ShowForm           - Selects and focused the form, if present.
    AddNotifier        - Registers an instance of a descendant to TIModule-
                         Notifier.
    RemoveNotifier     - Removes a registered instance of a TIModuleNotifier.
    GetAuxEditorInterface - Obtains a TIEditorInterface to the .H file if the
                         main file is a .c/.cpp file.  Used only in C++Builder.
  }

  TIModuleInterface = class(TInterface)
  public
    function GetEditorInterface: TIEditorInterface; virtual; stdcall; abstract;
    function GetFormInterface: TIFormInterface; virtual; stdcall; abstract;
    function GetAncestorModule: TIModuleInterface; virtual; stdcall; abstract;
    function GetProjectResource: TIResourceFile; virtual; stdcall; abstract;
    function IsProjectModule: Boolean; virtual; stdcall; abstract;
    function Close: Boolean; virtual; stdcall; abstract;
    function Save(ForceSave: Boolean): Boolean; virtual; stdcall; abstract;
    function Rename(const NewName: string): Boolean; virtual; stdcall; abstract;
    function GetFileSystem(var FileSystem: string): Boolean; virtual; stdcall; abstract;
    function SetFileSystem(const FileSystem: string): Boolean; virtual; stdcall; abstract;
    function ShowSource: Boolean; virtual; stdcall; abstract;
    function ShowForm: Boolean; virtual; stdcall; abstract;
    function AddNotifier(AModuleNotifier: TIModuleNotifier): Boolean; virtual; stdcall; abstract;
    function RemoveNotifier(AModuleNotifier: TIModuleNotifier): Boolean; virtual; stdcall; abstract;
    function GetAuxEditorInterface: TIEditorInterface; virtual; stdcall; abstract;
  end;

  { TIProjectCreator interface

  }

  TIProjectCreator = class(TInterface)
  public
    function Existing: Boolean; virtual; stdcall; abstract;
    function GetFileName: string; virtual; stdcall; abstract;
    function GetFileSystem: string; virtual; stdcall; abstract;
    function NewProjectSource(const ProjectName: string): string; virtual; stdcall; abstract;
    procedure NewDefaultModule; virtual; stdcall; abstract;
    procedure NewProjectResource(Module: TIModuleInterface); virtual; stdcall; abstract;
  end;

  TIProjectCreatorEx = class(TIProjectCreator)
  public
    function GetOptionName: string; virtual; stdcall; abstract; 
    function NewOptionSource(const ProjectName: string): string; virtual; stdcall; abstract;
  end;

  { TIModuleCreator interface
  }

  TIModuleCreator = class(TInterface)
  public
    function Existing: Boolean; virtual; stdcall; abstract;
    function GetAncestorName: string; virtual; stdcall; abstract;
    function GetFileName: string; virtual; stdcall; abstract;
    function GetFileSystem: string; virtual; stdcall; abstract;
    function GetFormName: string; virtual; stdcall; abstract;
    function NewModuleSource(const UnitIdent, FormIdent,
      AncestorIdent: string): string; virtual; stdcall; abstract;
    procedure FormCreated(Form: TIFormInterface); virtual; stdcall; abstract;
  end;

  TIModuleCreatorEx = class(TIModuleCreator)
  public
    function GetIntfName: string; virtual; stdcall; abstract;
    function NewIntfSource(const UnitIdent, FormIdent,
      AncestorIdent: string): string; virtual; stdcall; abstract;
  end;

implementation

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -