//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (c) Microsoft Corporation. All rights reserved.
//
//--------------------------------------------------------------------------

import "ocidl.idl";
import "shtypes.idl";
import "oaidl.idl";
import "tlogstg.idl";


cpp_quote("#define TLOG_BACK  -1")
cpp_quote("#define TLOG_FORE   1")
cpp_quote("")
cpp_quote("#define TLMENUF_INCLUDECURRENT      0x00000001")
cpp_quote("#define TLMENUF_CHECKCURRENT        (TLMENUF_INCLUDECURRENT | 0x00000002)")
cpp_quote("#define TLMENUF_BACK                0x00000010  // Default")
cpp_quote("#define TLMENUF_FORE                0x00000020")
cpp_quote("#define TLMENUF_BACKANDFORTH        (TLMENUF_BACK | TLMENUF_FORE | TLMENUF_INCLUDECURRENT)")
cpp_quote("")

typedef struct _WINDOWDATA
{
    DWORD     dwWindowID;  // Window ID
    UINT      uiCP;        // Codepage of the current entry
    LPITEMIDLIST pidl;     // Current pidl - pidl and lpszUrl are exclusive.
    [string]  LPOLESTR lpszUrl;     // Pointer to a buffer to hold the window URL
    [string]  LPOLESTR lpszUrlLocation;     // Pointer to a buffer to hold the window URL Location (local anchor).
    [string]  LPOLESTR lpszTitle;   // Pointer to a buffer to hold the window Title
    IStream * pStream;     // Stream of window data used for navigation
} WINDOWDATA;

typedef WINDOWDATA * LPWINDOWDATA;
typedef const WINDOWDATA * LPCWINDOWDATA;

// ITravelEntry
[
    uuid(F46EDB3B-BC2F-11d0-9412-00AA00A3EBD3), // IID_ITravelEntry
    object,
    local,
    hidden,
    helpstring("ITravelEntry interface"),
    helpcontext(0x0000)
]
interface ITravelEntry : IUnknown
{
    [helpstring("Invokes the entry."), helpcontext(0x0000)]
    HRESULT Invoke(
        [in] IUnknown *punk);
        
    [helpstring("Updates the entry."), helpcontext(0x0000)]
    HRESULT Update(
        [in] IUnknown *punk,
        [in] BOOL fIsLocalAnchor);
        
    [helpstring("Retrieves the pidl associated with the entry."), helpcontext(0x0000)]
    HRESULT GetPidl(
        [out] LPITEMIDLIST * ppidl);
};


// ITravelLog
[
    uuid(66A9CB08-4802-11d2-A561-00A0C92DBFE8), // IID_ITravelLog
    object,
    local,
    hidden,
    helpstring("ITravelLog interface"),
    helpcontext(0x0000)
]
interface ITravelLog : IUnknown
{
    [helpstring("Adds an entry to the travel log."), helpcontext(0x0000)]
    HRESULT AddEntry(
        [in] IUnknown * punk,
        [in] BOOL fIsLocalAnchor);
    
    [helpstring("Updates an entry in the travel log."), helpcontext(0x0000)]
    HRESULT UpdateEntry(
        [in] IUnknown * punk,
        [in] BOOL fIsLocalAnchor);
    
    [helpstring("Updates an external entry."), helpcontext(0x0000)]
    HRESULT UpdateExternal(
        [in] IUnknown * punk,
        [in] IUnknown * punkHLBrowseContext);
    
    [helpstring("Travels to an entry."), helpcontext(0x0000)]
    HRESULT Travel(
        [in] IUnknown * punk,
        [in] int iOffset);
    
    [helpstring("Retrieves an entry at the specified offset."), helpcontext(0x0000)]
    HRESULT GetTravelEntry(
        [in]  IUnknown * punk, 
        [in]  int iOffset,
        [out] ITravelEntry ** ppte);
    
    [helpstring("Finds the entry with the specified pidl."), helpcontext(0x0000)]
    HRESULT FindTravelEntry(
        [in]  IUnknown * punk,
        [in]  LPCITEMIDLIST pidl,
        [out] ITravelEntry ** ppte);
    
    [helpstring("Retrieves tool tip text for an entry."), helpcontext(0x0000)]
    HRESULT GetToolTipText(
        [in]  IUnknown * punk,
        [in]  int iOffset,
        [in]  int idsTemplate,
        [out, size_is(cchText)] LPWSTR pwzText,
        [in]  DWORD cchText);
    
    [helpstring("Inserts entries into the specified menu."), helpcontext(0x0000)]
    HRESULT InsertMenuEntries(
        [in] IUnknown * punk,
        [in] HMENU hmenu,
        [in] int nPos,
        [in] int idFirst,
        [in] int idLast,
        [in] DWORD dwFlags);
    
    [helpstring("Clones the current travel log."), helpcontext(0x0000)]
    HRESULT Clone(
        [out] ITravelLog ** pptl);
    
    [helpstring("Returns the number of entries in the travel log."), helpcontext(0x0000)]
    DWORD CountEntries(
        [in] IUnknown * punk);
    
    [helpstring("Reverts to the current entry."), helpcontext(0x0000)]
    HRESULT Revert();
};

// ITravelLogEx
[
    uuid(3050f679-98b5-11cf-bb82-00aa00bdce0b), // IID_ITravelLogEx
    object,
    local,
    hidden,
    helpstring("ITravelLog interface"),
    helpcontext(0x0000)
]
interface ITravelLogEx : IUnknown
{
    [helpstring("Finds and returns the travel entry containing the specified URL."), helpcontext(0x0000)]
    HRESULT FindTravelEntryWithUrl(
        [in] IUnknown * punk,
        [in] UINT uiCP,
        [in] LPOLESTR pszUrl,
        [out] ITravelEntry ** ppte);
    
    [helpstring("Travels to the specified URL."), helpcontext(0x0000)]
    HRESULT TravelToUrl(
        [in] IUnknown * punk,
        [in] UINT uiCP,
        [in] LPOLESTR pszUrl);

    [helpstring("Delete the entry specified by index."), helpcontext(0x0000)]
    HRESULT DeleteIndexEntry(
        [in] IUnknown *punk,
        [in] int index);
        
    [helpstring("Delete the entry specified by URL."), helpcontext(0x0000)]
    HRESULT DeleteUrlEntry(
        [in]  IUnknown *punk, 
        [in]  UINT uiCP, 
        [in]  LPOLESTR pszUrl);
    
    [helpstring("Counts entries in the log."), helpcontext(0x0000)]
    HRESULT CountEntryNodes(
        [in]  IUnknown *punk, 
        [in]  DWORD dwFlags, 
        [out] DWORD *pdwCount);
            
    [helpstring("Create page titles enumerator."), helpcontext(0x0000)]
    HRESULT CreateEnumEntry(
        [in]  IUnknown *punk, 
        [out] IEnumTravelLogEntry **ppEnum, 
        [in]  DWORD dwFlags);
        
    [helpstring("Delete entry."), helpcontext(0x0000)]
    HRESULT DeleteEntry(
        [in] IUnknown *punk, 
        [in] ITravelLogEntry *pte);

    [helpstring("Insert a dummy new entry."), helpcontext(0x0000)]
    HRESULT InsertEntry(
        [in] IUnknown *punkBrowser,
        [in] ITravelLogEntry *pteRelativeTo, 
        [in] BOOL fPrepend,
        [in] IUnknown* punkTLClient, 
        [in] ITravelLogEntry **ppEntry);

    [helpstring("Travel to a specific entry."), helpcontext(0x0000)]
    HRESULT TravelToEntry(
        [in] IUnknown *punkBrowser,
        [in] ITravelLogEntry *pteDestination);
};

[
    uuid(3050f67A-98b5-11cf-bb82-00aa00bdce0b), // IID_ITravelLogClient
    object,
    local,
    hidden,
    helpstring("ITravelClient interface"),
    helpcontext(0x0000)
]
interface ITravelLogClient : IUnknown
{
    [helpstring("Finds the window with the specified index."), helpcontext(0x0000)]
    HRESULT FindWindowByIndex(
        [in] DWORD dwID,
        [out] IUnknown ** ppunk);
    
    [helpstring("Finds and returns the travel entry containing the specified URL."), helpcontext(0x0000)]
    HRESULT GetWindowData(
        [in,out] LPWINDOWDATA pWinData);

    [helpstring("Loads the Url Location and position"), helpcontext(0x0000)]
    HRESULT LoadHistoryPosition(
        [in] LPOLESTR pszUrlLocation,
        [in] DWORD dwPosition);
};


[
    uuid(0AD364CE-ADCB-11d3-8269-00805FC732C0), // IID_ITravelLogClient2
    object,
    local,
    hidden,
    helpstring("ITravelClient2 interface"),
    helpcontext(0x0000)
]
interface ITravelLogClient2 : IUnknown
{
    [helpstring("Creates window data for an HTML page to be loaded from the specified URL."), helpcontext(0x0000)]
    HRESULT GetDummyWindowData(
        [in] LPWSTR pszUrl, 
        [in] LPWSTR pszTitle,
        [in,out] LPWINDOWDATA pWinData);
};


