/*
 * Defines the COM interfaces and APIs related to the IE Web browser
 *
 * Copyright (C) 2001 John R. Sheets (for CodeWeavers)
 * Copyright (C) 2003 Alexandre Julliard
 * Copuright (C) 2004 Jacek Caban
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

import "ocidl.idl";
import "docobj.idl";

#include <olectl.h>
#include <exdispid.h>

/*****************************************************************************
 * IWebBrowser interface
 */
[
    object,
    oleautomation,
    uuid(eab22ac1-30c1-11cf-a7eb-0000c05bae0b)
]
interface IWebBrowser : IDispatch
{
    typedef enum BrowserNavConstants
    {
        navOpenInNewWindow   = 0x1,
        navNoHistory         = 0x2,
        navNoReadFromCache   = 0x4,
        navNoWriteToCache    = 0x8,
        navAllowAutosearch   = 0x10,
        navBrowserBar        = 0x20,
        navHyperlink         = 0x40,
        navEnforceRestricted = 0x80
    } BrowserNavConstants;

    typedef enum RefreshConstants
    {
        REFRESH_NORMAL     = 0,
        REFRESH_IFEXPIRED  = 1,
        REFRESH_COMPLETELY = 3
    } RefreshConstants;

    [id(100)] HRESULT GoBack();
    [id(101)] HRESULT GoForward();
    [id(102)] HRESULT GoHome();
    [id(103)] HRESULT GoSearch();

    [id(104)]
    HRESULT Navigate(
        [in] BSTR URL,
        [in, optional] VARIANT *Flags,
        [in, optional] VARIANT *TargetFrameName,
        [in, optional] VARIANT *PostData,
        [in, optional] VARIANT *Headers);

    [id(DISPID_REFRESH)] HRESULT Refresh();
    [id(105)] HRESULT Refresh2([in, optional] VARIANT *Level);
    [id(106)] HRESULT Stop();
    [id(200), propget] HRESULT Application([out, retval] IDispatch** ppDisp);
    [id(201), propget] HRESULT Parent([out, retval] IDispatch** ppDisp);
    [id(202), propget] HRESULT Container([out, retval] IDispatch** ppDisp);
    [id(203), propget] HRESULT Document([out] IDispatch** ppDisp);
    [id(204), propget] HRESULT TopLevelContainer([out, retval] VARIANT_BOOL* pBool);
    [id(205), propget] HRESULT Type([out, retval] BSTR* Type);
    [id(206), propget] HRESULT Left([out, retval] long *pl);
    [id(206), propput] HRESULT Left([in] long Left);
    [id(207), propget] HRESULT Top([out, retval] long *pl);
    [id(207), propput] HRESULT Top([in] long Top);
    [id(208), propget] HRESULT Width([out, retval] long *pl);
    [id(208), propput] HRESULT Width([in] long Width);
    [id(209), propget] HRESULT Height([out, retval] long *pl);
    [id(209), propput] HRESULT Height([in] long Height);
    [id(210), propget] HRESULT LocationName([out, retval] BSTR *LocationName);
    [id(211), propget] HRESULT LocationURL([out, retval] BSTR * LocationURL);
    [id(212), propget] HRESULT Busy([out, retval] VARIANT_BOOL *pBool);
}


/*****************************************************************************
 * IWebBrowserApp interface
 */
[
    object,
    oleautomation,
    uuid(0002df05-0000-0000-c000-000000000046)
]
interface IWebBrowserApp : IWebBrowser
{
    [id(300)] HRESULT Quit();
    [id(301)] HRESULT ClientToWindow([in,out] int* pcx, [in,out] int* pcy);
    [id(302)] HRESULT PutProperty([in] BSTR szProperty, [in] VARIANT vtValue);
    [id(303)] HRESULT GetProperty([in] BSTR szProperty, [out, retval] VARIANT *pvtValue);
    [id(0), propget] HRESULT Name([out, retval] BSTR* Name);
    [id(DISPID_HWND), propget] HRESULT HWND([out, retval] long *pHWND);
    [id(400), propget] HRESULT FullName([out, retval] BSTR* FullName);
    [id(401), propget] HRESULT Path([out, retval] BSTR* Path);
    [id(402), propget] HRESULT Visible([out, retval] VARIANT_BOOL* pBool);
    [id(402), propput] HRESULT Visible([in] VARIANT_BOOL Value);
    [id(403), propget] HRESULT StatusBar([out, retval] VARIANT_BOOL* pBool);
    [id(403), propput] HRESULT StatusBar([in] VARIANT_BOOL Value);
    [id(404), propget] HRESULT StatusText([out, retval] BSTR *StatusText);
    [id(404), propput] HRESULT StatusText([in] BSTR StatusText);
    [id(405), propget] HRESULT ToolBar([out, retval] int * Value);
    [id(405), propput] HRESULT ToolBar([in] int Value);
    [id(406), propget] HRESULT MenuBar([out, retval] VARIANT_BOOL * Value);
    [id(406), propput] HRESULT MenuBar([in] VARIANT_BOOL Value);
    [id(407), propget] HRESULT FullScreen([out, retval] VARIANT_BOOL * pbFullScreen);
    [id(407), propput] HRESULT FullScreen([in] VARIANT_BOOL bFullScreen);
}

/*****************************************************************************
 * IWebBrowser2 interface
 */
[
    object,
    oleautomation,
    uuid(d30c1661-cdaf-11d0-8a3e-00c04fc9e26e)
]
interface IWebBrowser2 : IWebBrowserApp
{
    [id(500)] HRESULT Navigate2(
        [in] VARIANT *URL,
        [in, optional] VARIANT *Flags,
        [in, optional] VARIANT *TargetFrameName,
        [in, optional] VARIANT *PostData,
        [in, optional] VARIANT *Headers);

    [id(501)] HRESULT QueryStatusWB(
        [in] OLECMDID cmdID,
        [out, retval] OLECMDF *pcmdf);

    [id(502)] HRESULT ExecWB(
        [in] OLECMDID cmdID,
        [in] OLECMDEXECOPT cmdexecopt,
        [in, optional] VARIANT *pvaIn,
        [out, in, optional] VARIANT *pvaOut);

    [id(503)] HRESULT ShowBrowserBar(
        [in] VARIANT *pvaClsid,
        [in, optional] VARIANT *pvarShow,
        [in, optional] VARIANT *pvarSize);

    [id(DISPID_READYSTATE), propget] HRESULT ReadyState([out, retval] READYSTATE *plReadyState);
    [id(550), propget] HRESULT Offline([out, retval] VARIANT_BOOL *pbOffline);
    [id(550), propput] HRESULT Offline([in] VARIANT_BOOL bOffline);
    [id(551), propget] HRESULT Silent([out, retval] VARIANT_BOOL *pbSilent);
    [id(551), propput] HRESULT Silent([in] VARIANT_BOOL bSilent);
    [id(552), propget] HRESULT RegisterAsBrowser([out, retval] VARIANT_BOOL *pbRegister);
    [id(552), propput] HRESULT RegisterAsBrowser([in] VARIANT_BOOL bRegister);
    [id(553), propget] HRESULT RegisterAsDropTarget([out, retval] VARIANT_BOOL *pbRegister);
    [id(553), propput] HRESULT RegisterAsDropTarget([in] VARIANT_BOOL bRegister);
    [id(554), propget] HRESULT TheaterMode([out, retval] VARIANT_BOOL *pbRegister);
    [id(554), propput] HRESULT TheaterMode([in] VARIANT_BOOL bRegister);
    [id(555), propget] HRESULT AddressBar([out, retval] VARIANT_BOOL *Value);
    [id(555), propput] HRESULT AddressBar([in] VARIANT_BOOL Value);
    [id(556), propget] HRESULT Resizable([out, retval] VARIANT_BOOL *Value);
    [id(556), propput] HRESULT Resizable([in] VARIANT_BOOL Value);
}

[
    uuid(eab22ac2-30c1-11CF-a7eb-0000C05bae0b)
]
dispinterface DWebBrowserEvents
{
    properties:
    methods:
    [id(DISPID_BEFORENAVIGATE)]
    void BeforeNavigate(
        [in] BSTR URL,
        [in] long Flags,
        [in] BSTR TargetFrameName,
        [in] VARIANT *PostData,
        [in] BSTR Headers,
        [in, out] VARIANT_BOOL *Cancel);

    [id(DISPID_NAVIGATECOMPLETE)]
    void NavigateComplete([in] BSTR URL);

    [id(DISPID_STATUSTEXTCHANGE)]
    void StatusTextChange([in] BSTR Text);

    [id(DISPID_PROGRESSCHANGE)]
    void ProgressChange([in] long Progress, [in] long ProgressMax);

    [id(DISPID_DOWNLOADCOMPLETE)]
    void DownloadComplete();

    [id(DISPID_COMMANDSTATECHANGE)]
    void CommandStateChange([in] long Command, [in]VARIANT_BOOL Enable);

    [id(DISPID_DOWNLOADBEGIN)]
    void DownloadBegin();

    [id(DISPID_NEWWINDOW)]
    void NewWindow(
        [in] BSTR URL,
        [in] long Flags,
        [in] BSTR TargetFrameName,
        [in] VARIANT *PostData,
        [in] BSTR Headers,
        [in,out] VARIANT_BOOL *Processed);

    [id(DISPID_TITLECHANGE)]
    void TitleChange([in] BSTR Text);

    [id(DISPID_FRAMEBEFORENAVIGATE)]
    void FrameBeforeNavigate(
        [in] BSTR URL,
        [in] long Flags,
        [in] BSTR TargetFrameName,
        [in] VARIANT *PostData,
        [in] BSTR Headers,
        [in, out]VARIANT_BOOL *Cancel);

    [id(DISPID_FRAMENAVIGATECOMPLETE)]
    void FrameNavigateComplete([in] BSTR URL);

    [id(DISPID_FRAMENEWWINDOW)]
    void FrameNewWindow(
        [in] BSTR URL,
        [in] long Flags,
        [in] BSTR TargetFrameName,
        [in] VARIANT *PostData,
        [in] BSTR Headers,
        [in,out] VARIANT_BOOL *Processed);

    [id(DISPID_QUIT)]
    void Quit([in, out] VARIANT_BOOL *Cancel);

    [id(DISPID_WINDOWMOVE)]
    void WindowMove();

    [id(DISPID_WINDOWRESIZE)]
    void WindowResize();

    [id(DISPID_WINDOWACTIVATE)]
    void WindowActivate();

    [id(DISPID_PROPERTYCHANGE)]
    void PropertyChange([in] BSTR Property);
}

[
    uuid(34a715a0-6587-11d0-924a-0020afc7ac4d)
]
dispinterface DWebBrowserEvents2
{
    properties:
    methods:
    [id(DISPID_STATUSTEXTCHANGE)]
    void StatusTextChange([in] BSTR Text);

    [id(DISPID_PROGRESSCHANGE)]
    void ProgressChange([in] long Progress, [in] long ProgressMax);

    [id(DISPID_COMMANDSTATECHANGE)]
    void CommandStateChange([in] long Command, [in] VARIANT_BOOL Enable);

    [id(DISPID_DOWNLOADBEGIN)]
    void DownloadBegin();

    [id(DISPID_DOWNLOADCOMPLETE)]
    void DownloadComplete();

    [id(DISPID_TITLECHANGE)]
    void TitleChange([in] BSTR szProperty);

    [id(DISPID_PROPERTYCHANGE)]
    void PropertyChange([in] BSTR szProperty);

    [id(DISPID_BEFORENAVIGATE2)]
    void BeforeNavigate2(
        [in] IDispatch *pDisp,
        [in] VARIANT *URL,
        [in] VARIANT *Flags,
        [in] VARIANT *TargetFrameName,
        [in] VARIANT *PostData,
        [in] VARIANT *Headers,
        [in, out] VARIANT_BOOL *Cancel);

    [id(DISPID_NEWWINDOW2)]
    void NewWindow2([in, out] IDispatch **ppDisp, [in, out] VARIANT_BOOL *Cancel);

    [id(DISPID_NAVIGATECOMPLETE2)]
    void NavigateComplete2([in] IDispatch *pDisp, [in] VARIANT *URL);

    [id(DISPID_DOCUMENTCOMPLETE)]
    void DocumentComplete([in] IDispatch *pDisp, [in] VARIANT *URL);

    [id(DISPID_ONQUIT)]
    void OnQuit();

    [id(DISPID_ONVISIBLE)]
    void OnVisible([in] VARIANT_BOOL Visible);

    [id(DISPID_ONTOOLBAR)]
    void OnToolBar([in] VARIANT_BOOL ToolBar);

    [id(DISPID_ONMENUBAR)]
    void OnMenuBar([in] VARIANT_BOOL MenuBar);

    [id(DISPID_ONSTATUSBAR)]
    void OnStatusBar([in] VARIANT_BOOL StatusBar);

    [id(DISPID_ONFULLSCREEN)]
    void OnFullScreen([in] VARIANT_BOOL FullScreen);

    [id(DISPID_ONTHEATERMODE)]
    void OnTheaterMode([in] VARIANT_BOOL TheaterMode);
}

[
    uuid(8856f961-340a-11d0-a96b-00c04fd705a2)
]
coclass WebBrowser
{
    [default] interface IWebBrowser2;
    interface IWebBrowser;
    [default, source] dispinterface DWebBrowserEvents2;
    [source] dispinterface DWebBrowserEvents;
}

[
    object,
    oleautomation,
    uuid(85cb6900-4d95-11cf-960c-0080c7f4ee85)
]
interface IShellWindows : IDispatch
{
    [propget] HRESULT Count( [out] long *Count );
    [id(0)] HRESULT Item( [in] VARIANT index, [out] IDispatch **Folder );
    [id(-4)] HRESULT _NewEnum( [out] IUnknown **ppunk );
    [hidden] HRESULT Register( [in] IDispatch *pid, [in] long hWnd, [in] int swClass,
                [out] long *plCookie );
    [hidden] HRESULT RegisterPending( [in] long lThread, [in] VARIANT *pvarloc,
                [in] VARIANT *varlocRoot, [in] int swClass, [out] long *plCookie );
    [hidden] HRESULT Revoke( [in] long Cookie );
    [hidden] HRESULT OnNavigate( [in] long Cookie, [out] VARIANT *pvarLoc );
    [hidden] HRESULT OnActivated( [in] long Cookie, [in] VARIANT fActive );
    [hidden] HRESULT FindWindowSW( [in] VARIANT *pvarLoc, [in] VARIANT *pvarLocRoot, 
                [in] int swClass, [out] long *phwnd, int swfwOptions,
                IDispatch **ppdispOut );
    [hidden] HRESULT OnCreated( [in] long lCookie, [in] IUnknown *punk );
    [hidden] HRESULT ProcessAttachDetach( [in] VARIANT_BOOL fAttach );
}

[
    uuid(9ba05972-f6a8-11cf-a442-00a0c90a8f39)
]
coclass ShellWindows
{
    [default] interface IShellWindows;
    [default, source] dispinterface DShellWindowsEvents;
}
