/*
 * Copyright (C) 2005 Robert Shearman
 *
 * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 *
 */

#include "tmarshal_dispids.h"
import "ocidl.idl";

[
  uuid(d96d8a3e-78b6-4c8d-8f27-059db959be8a),
  version(1.0),
  helpstring("Test Typelib")
]
library TestTypelib
{
    importlib("stdole2.tlb");

    typedef enum tagSTATE
    {
        STATE_UNWIDGETIFIED = 1,
        STATE_WIDGETIFIED
    } STATE;

    coclass ApplicationObject2;

    [
        odl,
        uuid(a1f8cae3-c947-4c5f-b57d-c87b9b5f3586),
        oleautomation,
        dual
    ]
    interface IWidget : IDispatch
    {
        [propput, id(DISPID_TM_NAME)]
        HRESULT Name([in] BSTR name);
        [propget, id(DISPID_TM_NAME)]
        HRESULT Name([out, retval] BSTR *name);

        [id(DISPID_TM_DOSOMETHING)]
        HRESULT DoSomething([in] double number, [out] BSTR *str1, [in, defaultvalue("")] BSTR str2, [in, optional] VARIANT *opt);

        [propget, id(DISPID_TM_STATE)]
        HRESULT State([out, retval] STATE *state);
        [propput, id(DISPID_TM_STATE)]
        HRESULT State([in] STATE state);

        [id(DISPID_TM_MAP)]
        HRESULT Map([in] BSTR bstrId, [out, retval] BSTR *sValue);

        [id(DISPID_TM_SETOLECOLOR)]
        HRESULT SetOleColor([in] OLE_COLOR val);

        [id(DISPID_TM_GETOLECOLOR)]
        HRESULT GetOleColor([out, retval] OLE_COLOR *pVal);

        [propget, id(DISPID_TM_CLONE)]
        HRESULT Clone([out, retval] IWidget **ppVal);

        [propget, id(DISPID_TM_CLONEDISPATCH)]
        HRESULT CloneDispatch([out, retval] IDispatch **ppVal);

        [propget, id(DISPID_TM_CLONECOCLASS)]
        HRESULT CloneCoclass([out, retval] ApplicationObject2 **ppVal);

        [propget, id(DISPID_VALUE)]
        HRESULT Value([in] VARIANT *value, [out, retval] VARIANT *retval);

        [id(DISPID_TM_ARRAY)]
        HRESULT Array([in] SAFEARRAY(BSTR) values);

        [id(DISPID_TM_VARARRAYPTR)]
        HRESULT VariantArrayPtr([in] SAFEARRAY(VARIANT) *values);

        [id(DISPID_TM_VARIANT)]
        void Variant([in] VARIANT var);

        [id(DISPID_TM_ERROR)]
        HRESULT Error();
    }

    [
        odl,
        uuid(a028db05-30f0-4b93-b17a-41c72f831d84),
#if 0 /* FIXME: commented out as causes widl to generate incorrect typelib */
        dual,
#endif
        oleautomation
    ]
    interface IKindaEnumWidget : IUnknown
    {
        HRESULT Next(
                     [out] IWidget **widget);

        HRESULT Count(
                      [out] unsigned long *count);

        HRESULT Reset();

        HRESULT Clone(
                      [out] IKindaEnumWidget **ppenum);
    }

    [
        odl,
        uuid(a028db06-30f0-4b93-b17a-41c72f831d84),
    ]
    interface INonOleAutomation : IUnknown
    {
        [id(DISPID_NOA_BSTRRET)]
        BSTR BstrRet();
    }


    [
        dllname("comm.drv"),
        uuid(d377f60b-8639-4261-8ee7-75c8340d2cc9),
    ]
    module BadModule
    {
        [
            entry("Foo"),
        ]
        HRESULT BadModuleFoo();
    };

    [
        dllname("oleaut32.dll"),
        uuid(d377f60c-8639-4261-8ee7-75c8340d2cc9),
    ]
    module BadEntry
    {
        [
            entry("Foo"),
        ]
        HRESULT BadEntryFoo();
    };

    [
        uuid(bb171948-10ec-407a-9a57-2f85f797ff1a),
        appobject,
    ]
    coclass ApplicationObject2
    {
        interface IWidget;
        [source] interface IWidget;
    };
};
