ILibraryWindowIconProvider Interface

This interface lets you create a plug-in that changes the icons displayed next to items in the HotDocs library. Specifically, it allows you to place an "overlay" icon on top of the existing icons. For example, if you want to create a version control plug-in, you could use overlay status icons to indicate which templates are checked in, checked out, or not under version control.

When HotDocs starts up, it attempts to load each registered plug-in. If it finds a plug-in that implements the ILibraryWindowIconProvider interface, HotDocs calls:

  1. Initialize to load and initialize the plug-in. (If Initialize returns a failure code, HotDocs will stop calling plug-in functions.)
  2. LibraryInitialized to complete initialization of the plug-in.
  3. UpdateLibraryEntry to update the overlay icons for each item in the library as determined by the plug-in.

This interface is very complicated and difficult to implement; it is only recommended for the most advanced integrators.

Plug-ins that implement the ILibraryWindowIconProvider interface must be in-process DLLs.

Functions

Function Description
Initialize This function is called when HotDocs starts up to determine if it should load the plug-in. If the function fails, HotDocs will not load the plug-in.
LibraryInitialized This function is called when the library is initialized.
UpdateLibraryEntry This function is called each time HotDocs updates the list of items in the library window. For example, when an item is added or removed from the library, HotDocs updates the list of items and calls UpdateLibraryEntry for each item in the library.

Example (Visual C#)

The following Visual C# example implements the ILibraryWindowIconProvider interface and adds an overlay icon to each RTF template in the library.

[ComVisible(true)]
[Guid("12345678-1111-2222-AAAA-DDDDDDDDDDDD")]
public class IconProvider : HotDocs.ILibraryWindowIconProvider
{
    public void Initialize()
    {
    }
     
    public void LibraryInitialized()
    {
        MessageBox.Show("The library has been initialized");
    }
     
    public void UpdateLibraryEntry(LibraryEntity pItem, bool bMultithreaded)
    {
        HotDocs.Icon icon = new HotDocs.Icon();
        icon.LoadIcon(@"C:\images\hptIcon.ico");
        HotDocs._LibraryEntity2 pItem2 = (HotDocs._LibraryEntity2)pItem;
         
        if (System.IO.Path.GetExtension(pItem2.TemplateFullPath.ToLower()) == ".hpt")
        {
            pItem2.OverlayIndex = 1;
        }
        else
            pItem2.OverlayIndex = -1;
         
        System.Runtime.InteropServices.Marshal.ReleaseComObject(icon);
    }
     
    [ComRegisterFunction]
    public static void RegisterPlugin(Type t)
    {
        HotDocs.Application app = new HotDocs.Application();
        app.Plugins.Register("{12345678-1111-2222-AAAA-DDDDDDDDDDDD}", "Icon Provider", 100, 1);
        System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
    }
     
    [ComUnregisterFunction]
    public static void UnRegisterPlugin(Type t)
    {
        HotDocs.Application app = new HotDocs.Application();
        app.Plugins.Unregister("{12345678-1111-2222-AAAA-DDDDDDDDDDDD}");
        System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
    }
}