Templates

This page covers ITemplate, ITemplates, ITemplateChangeEvent, and ITemplateChangeEventHandler. Templates own reusable groups of pieces and expose the same add, remove, and change patterns used elsewhere in the Desktop model.

ITemplates adds BeginUpdate, EndUpdate, IsUpdating, and OnChange in engine version 25. BeginUpdate, EndUpdate, IsUpdating, and GetOnChange are appended after the existing vtable slots under the same interface GUID. See Update scopes for nesting, notifications, and error handling. Rebuild plugins against the matching SDK; the Desktop host requires an exact engine version match.

Interfaces

Declarations are shown in Pascal and, where the SDK's generated language-support manifest lists the member for C++, in C++; the build fails if that manifest no longer matches TonCutPluginSdk.hpp. There is no C# declaration: C# plugins are native-shim-only, so a C++ shim owns every interface on this page. Methods are listed with their accessors folded into properties; open Vtable order for the exact slot sequence, and see ABI and marshalling for type sizes and ownership rules.

ITemplate

Saved template that owns a collection of reusable formats.

IID
{13F64158-F0FF-4D5A-AFE4-D8AB7969D82E}
Parent
IUnknown (implicit: a Delphi interface without a parent is IUnknown)
Unit
uITemplate

The SDK's language-support manifest lists no C++ member of this interface. If your TonCutPluginSdk.hpp leaves it opaque, declare the interface yourself in the vtable order below.

Vtable order (15 methods, slots 3 to 17, after the three IUnknown slots)
  1. function GetId(): Int64;
  2. procedure SetId(aId: Int64);
  3. function GetTitle(): WideString;
  4. procedure SetTitle(const aTitle: WideString);
  5. function GetDescription(): WideString;
  6. procedure SetDescription(const aDescription: WideString);
  7. function GetFormats(): IFormats;
  8. function GetOnChange(): INotifyEvent;
  9. function GetOnIdChange(): IIdChangeEvent;
  10. function GetOnFormatAdd(): IFormatChangeEvent;
  11. function GetOnFormatRemove(): IFormatChangeEvent;
  12. function GetOnFormatChange(): IFormatChangeEvent;
  13. procedure Assign(const aOther: ITemplate);
  14. procedure BeginUpdate();
  15. procedure EndUpdate();

Properties

  • Property name
    Id
    Type
    Int64
    Description

    Persistent numeric identifier used by TonCut to track the object.

    Declaration

    property Id: Int64 read GetId write SetId;
  • Property name
    Title
    Type
    WideString
    Description

    Human-readable title shown to users.

    Declaration

    property Title: WideString read GetTitle write SetTitle;
  • Property name
    Description
    Type
    WideString
    Description

    Name or descriptive text shown to the user.

    Declaration

    property Description: WideString read GetDescription write SetDescription;
  • Property name
    Formats
    Type
    IFormats
    Description

    Shared format collection exposed by the host.

    Declaration

    property Formats: IFormats read GetFormats;
  • Property name
    OnChange
    Type
    INotifyEvent
    Description

    Event fired when the object or collection changes.

    Declaration

    property OnChange: INotifyEvent read GetOnChange;
  • Property name
    OnIdChange
    Type
    IIdChangeEvent
    Description

    Event fired when an identifier changes.

    Declaration

    property OnIdChange: IIdChangeEvent read GetOnIdChange;
  • Property name
    OnFormatAdd
    Type
    IFormatChangeEvent
    Description

    Event exposed through OnFormatAdd.

    Declaration

    property OnFormatAdd: IFormatChangeEvent read GetOnFormatAdd;
  • Property name
    OnFormatRemove
    Type
    IFormatChangeEvent
    Description

    Event exposed through OnFormatRemove.

    Declaration

    property OnFormatRemove: IFormatChangeEvent read GetOnFormatRemove;
  • Property name
    OnFormatChange
    Type
    IFormatChangeEvent
    Description

    Event exposed through OnFormatChange.

    Declaration

    property OnFormatChange: IFormatChangeEvent read GetOnFormatChange;

Methods

  • Method name
    Assign()
    Type
    procedure
    Description

    Copy values from another object of the same type.

    Declaration

    procedure Assign(const aOther: ITemplate); safecall;
    Parameters
    aOtherconst
    Source object whose values should be copied.
  • Method name
    BeginUpdate()
    Type
    procedure
    Description

    Start a batched update so change notifications can be delayed.

    Declaration

    procedure BeginUpdate(); safecall;
  • Method name
    EndUpdate()
    Type
    procedure
    Description

    Finish a batched update and allow deferred notifications to resume.

    Declaration

    procedure EndUpdate(); safecall;

ITemplates

Collection interface used to create, enumerate, query, and reload a shared Desktop object set.

IID
{EDBF1B3E-F26E-49C9-807A-C2D5601849BF}
Parent
IUnknown (implicit: a Delphi interface without a parent is IUnknown)
Unit
uITemplates

The SDK's language-support manifest lists no C++ member of this interface. If your TonCutPluginSdk.hpp leaves it opaque, declare the interface yourself in the vtable order below.

Vtable order (20 methods, slots 3 to 22, after the three IUnknown slots)
  1. function CreateTemplate(): ITemplate;
  2. function CreateFormat(): IFormat;
  3. procedure Add(aTemplate: ITemplate);
  4. procedure DeleteByIndex(aIndex: Cardinal);
  5. procedure DeleteById(aId: Int64);
  6. procedure Remove(const aTemplate: ITemplate);
  7. function IndexOf(const aTemplate: ITemplate): Integer; overload;
  8. function IndexOf(aId: Int64): Integer; overload;
  9. function CheckUniqueName(const aTitle: WideString; const aIgnoreTemplate: ITemplate): Boolean; overload;
  10. function CheckUniqueName(aTemplate: ITemplate): Boolean; overload;
  11. function GetCount(): Integer;
  12. function GetByIndex(aIndex: Cardinal): ITemplate;
  13. function GetById(aId: Int64): ITemplate;
  14. function GetOnAdd(): ITemplateChangeEvent;
  15. function GetOnRemove(): ITemplateChangeEvent;
  16. procedure Reload();
  17. procedure BeginUpdate();
  18. procedure EndUpdate();
  19. function IsUpdating(): Boolean;
  20. function GetOnChange(): INotifyEvent;

Properties

  • Property name
    Count
    Type
    Integer
    Description

    Number of items currently exposed by the interface.

    Declaration

    property Count: Integer read GetCount;
  • Property name
    Items
    Type
    ITemplate
    Description

    Indexed property used to read one item from the collection.

    Declaration

    property Items[aIndex: Cardinal]: ITemplate read GetByIndex; default;
    Index Parameters
    aIndex
    Cardinal
    Zero-based position within a collection.
    Value
    The collection item located at the supplied index.
  • Property name
    OnAdd
    Type
    ITemplateChangeEvent
    Description

    Event fired when an item is added. Suppressed during a collection update scope; the outermost changed scope emits one collection OnChange instead.

    Declaration

    property OnAdd: ITemplateChangeEvent read GetOnAdd;
  • Property name
    OnRemove
    Type
    ITemplateChangeEvent
    Description

    Event fired when an item is removed. Suppressed during a collection update scope; the outermost changed scope emits one collection OnChange instead.

    Declaration

    property OnRemove: ITemplateChangeEvent read GetOnRemove;
  • Property name
    OnChange
    Type
    INotifyEvent
    Description

    Collection notification emitted once when the outermost changed update scope ends (engine version 25). Empty scopes emit nothing. Outside a scope, adds/removes use OnAdd/OnRemove, and item edits do not emit this collection event. Item events remain active inside collection scopes.

    Declaration

    property OnChange: INotifyEvent read GetOnChange;

Methods

  • Method name
    CreateTemplate()
    Type
    ITemplate
    Description

    Create a new template instance.

    Declaration

    function CreateTemplate(): ITemplate; safecall;
    Returns
    A new template interface instance.
  • Method name
    CreateFormat()
    Type
    IFormat
    Description

    Create a new format instance.

    Declaration

    function CreateFormat(): IFormat; safecall;
    Returns
    A new format interface instance.
  • Method name
    Add()
    Type
    procedure
    Description

    Add an item or handler.

    Declaration

    procedure Add(aTemplate: ITemplate); safecall;
    Parameters
    aTemplate
    Template instance being queried or modified.
  • Method name
    DeleteByIndex()
    Type
    procedure
    Description

    Delete the item at the specified zero-based index.

    Declaration

    procedure DeleteByIndex(aIndex: Cardinal); safecall;
    Parameters
    aIndex
    Cardinal
    Zero-based position within a collection.
  • Method name
    DeleteById()
    Type
    procedure
    Description

    Delete the item with the specified TonCut identifier.

    Declaration

    procedure DeleteById(aId: Int64); safecall;
    Parameters
    aId
    Int64
    TonCut object identifier.
  • Method name
    Remove()
    Type
    procedure
    Description

    Remove an item or handler.

    Declaration

    procedure Remove(const aTemplate: ITemplate); safecall;
    Parameters
    aTemplateconst
    Template instance being queried or modified.
  • Method name
    IndexOf()
    Type
    Integer
    Description

    Return the zero-based index of the matching item.

    Declaration

    function IndexOf(const aTemplate: ITemplate): Integer; overload; safecall;
    Parameters
    aTemplateconst
    Template instance being queried or modified.
    Returns
    Zero-based index of the matching item, or -1 when no match exists.
  • Method name
    IndexOf()
    Type
    Integer
    Description

    Return the zero-based index of the matching item.

    Declaration

    function IndexOf(aId: Int64): Integer; overload; safecall;
    Parameters
    aId
    Int64
    TonCut object identifier.
    Returns
    Zero-based index of the matching item, or -1 when no match exists.
  • Method name
    CheckUniqueName()
    Type
    Boolean
    Description

    Check whether a proposed title is unique within the collection.

    Declaration

    function CheckUniqueName(const aTitle: WideString; const aIgnoreTemplate: ITemplate): Boolean; overload; safecall;
    Parameters
    aTitleconst
    WideString
    Human-readable title.
    aIgnoreTemplateconst
    Template to exclude from uniqueness checks.
    Returns
    Returns true if the proposed title is unique within the collection.
  • Method name
    CheckUniqueName()
    Type
    Boolean
    Description

    Check whether a proposed title is unique within the collection.

    Declaration

    function CheckUniqueName(aTemplate: ITemplate): Boolean; overload; safecall;
    Parameters
    aTemplate
    Template instance being queried or modified.
    Returns
    Returns true if the proposed title is unique within the collection.
  • Method name
    GetById()
    Type
    ITemplate
    Description

    Return the item stored under the specified TonCut identifier.

    Declaration

    function GetById(aId: Int64): ITemplate; safecall;
    Parameters
    aId
    Int64
    TonCut object identifier.
    Returns
    The matching template interface instance.
  • Method name
    Reload()
    Type
    procedure
    Description

    Reload the underlying data from the host or storage layer.

    Declaration

    procedure Reload(); safecall;
  • Method name
    BeginUpdate()
    Type
    procedure
    Description

    Begin a nested collection notification scope (engine version 25). Balance each call with EndUpdate in finally. Changes take effect immediately; the scope provides no rollback.

    Declaration

    procedure BeginUpdate(); safecall;
  • Method name
    EndUpdate()
    Type
    procedure
    Description

    End one collection notification scope (engine version 25). The outermost call emits one collection OnChange only if an add, remove, or item OnChange occurred in the scope; suppressed add/remove callbacks are not replayed. Raises an error without a matching BeginUpdate.

    Declaration

    procedure EndUpdate(); safecall;
  • Method name
    IsUpdating()
    Type
    Boolean
    Description

    Report whether at least one collection notification scope remains open (engine version 25). Nested scopes remain active until the outermost EndUpdate.

    Declaration

    function IsUpdating(): Boolean; safecall;
    Returns
    Returns true while the interface is inside a BeginUpdate / EndUpdate batch.

ITemplateChangeEventHandler

Callback sink consumed by the matching change-event interface.

IID
{E8FE8BF5-57E6-4A4A-B643-1856BA84EF66}
Parent
IUnknown
Unit
uITemplateChangeEvent

The SDK's language-support manifest lists no C++ member of this interface. If your TonCutPluginSdk.hpp leaves it opaque, declare the interface yourself in the vtable order below.

Vtable order (1 methods, slots 3 to 3, after the three IUnknown slots)
  1. procedure Invoke(aSender: IUnknown; aTemplate: ITemplate; aIndex: Integer);

Methods

  • Method name
    Invoke()
    Type
    procedure
    Description

    Handle the event callback when the owning event interface invokes it.

    Declaration

    procedure Invoke(aSender: IUnknown; aTemplate: ITemplate; aIndex: Integer); safecall;
    Parameters
    aSender
    IUnknown
    Object that raised the event.
    aTemplate
    Template instance being queried or modified.
    aIndex
    Integer
    Zero-based position within a collection.

ITemplateChangeEvent

Event interface with Add, Remove, and Invoke hooks for collection or entity change notifications.

IID
{EBFFBF8E-66C3-4401-8A2B-6E7419D58BD3}
Parent
IUnknown
Unit
uITemplateChangeEvent

The SDK's language-support manifest lists no C++ member of this interface. If your TonCutPluginSdk.hpp leaves it opaque, declare the interface yourself in the vtable order below.

Vtable order (3 methods, slots 3 to 5, after the three IUnknown slots)
  1. procedure Add(aHandler: ITemplateChangeEventHandler);
  2. procedure Remove(aHandler: ITemplateChangeEventHandler);
  3. procedure Invoke(aSender: IUnknown; aTemplate: ITemplate; aIndex: Integer);

Methods

  • Method name
    Add()
    Type
    procedure
    Description

    Add an item or handler.

    Declaration

    procedure Add(aHandler: ITemplateChangeEventHandler); safecall;
    Parameters
    aHandler
    The handler interface instance to use.
  • Method name
    Remove()
    Type
    procedure
    Description

    Remove an item or handler.

    Declaration

    procedure Remove(aHandler: ITemplateChangeEventHandler); safecall;
    Parameters
    aHandler
    The handler interface instance to use.
  • Method name
    Invoke()
    Type
    procedure
    Description

    Raise the typed change event for the current payload.

    Declaration

    procedure Invoke(aSender: IUnknown; aTemplate: ITemplate; aIndex: Integer); safecall;
    Parameters
    aSender
    IUnknown
    Object that raised the event.
    aTemplate
    Event payload field for template.
    aIndex
    Integer
    Event payload field for index.

Was this page helpful?