// CommonControls.idl
//

import "oaidl.idl";
import "ocidl.idl";

cpp_quote("#ifdef MIDL_PASS")
typedef DWORD RGBQUAD;

typedef IUnknown* HIMAGELIST;
cpp_quote("typedef struct _IMAGELIST* HIMAGELIST;")

typedef struct
{
    DWORD       cbSize;
    HIMAGELIST  himl;
    int         i;
    HDC         hdcDst;
    int         x;
    int         y;
    int         cx;
    int         cy;
    int         xBitmap;        // x offest from the upperleft of bitmap
    int         yBitmap;        // y offset from the upperleft of bitmap
    COLORREF    rgbBk;
    COLORREF    rgbFg;
    UINT        fStyle;
    DWORD       dwRop;
    DWORD       fState;
    DWORD       Frame;
    COLORREF    crEffect;
} IMAGELISTDRAWPARAMS;

typedef IMAGELISTDRAWPARAMS* LPIMAGELISTDRAWPARAMS;
typedef struct
{
    HBITMAP hbmImage;
    HBITMAP hbmMask;
    int     Unused1;
    int     Unused2;
    RECT    rcImage;
} IMAGEINFO;

typedef IMAGEINFO* LPIMAGEINFO;
cpp_quote("#endif") // MIDL_PASS

cpp_quote("#define ILIF_ALPHA               0x00000001") // flag returned by GetItemFlags, indicating item has alpha

[
    uuid(46EB5926-582E-4017-9FDF-E8998DAA0950),

    helpstring("Image List"),
    local
]
interface IImageList : IUnknown
{
    HRESULT Add(HBITMAP hbmImage, HBITMAP hbmMask, int* pi);
    HRESULT ReplaceIcon(int i, HICON hicon, int* pi);
    HRESULT SetOverlayImage(int iImage, int iOverlay);
    HRESULT Replace(int i, HBITMAP hbmImage, HBITMAP hbmMask);
    HRESULT AddMasked(HBITMAP hbmImage, COLORREF crMask, int* pi);
    HRESULT Draw(IMAGELISTDRAWPARAMS* pimldp);
    HRESULT Remove(int i);
    HRESULT GetIcon(int i, UINT flags, HICON* picon);
    HRESULT GetImageInfo(int i, IMAGEINFO* pImageInfo);
    HRESULT Copy(int iDst, IUnknown* punkSrc, int iSrc, UINT uFlags);
    HRESULT Merge(int i1, IUnknown* punk2, int i2, int dx, int dy, REFIID riid, PVOID* ppv);
    HRESULT Clone(REFIID riid, PVOID* ppv);
    HRESULT GetImageRect(int i, RECT* prc);
    HRESULT GetIconSize(int* cx, int* cy);
    HRESULT SetIconSize(int cx, int cy);
    HRESULT GetImageCount(int* pi);
    HRESULT SetImageCount(UINT uNewCount);
    HRESULT SetBkColor(COLORREF clrBk, COLORREF* pclr);
    HRESULT GetBkColor(COLORREF* pclr);
    HRESULT BeginDrag(int iTrack, int dxHotspot, int dyHotspot);
    HRESULT EndDrag();
    HRESULT DragEnter(HWND hwndLock, int x, int y);
    HRESULT DragLeave(HWND hwndLock);
    HRESULT DragMove(int x, int y);
    HRESULT SetDragCursorImage(IUnknown* punk, int iDrag, int dxHotspot, int dyHotspot);
    HRESULT DragShowNolock(BOOL fShow);
    HRESULT GetDragImage(POINT * ppt, POINT * pptHotspot, REFIID riid, PVOID* ppv);
    HRESULT GetItemFlags(int i, DWORD *dwFlags);
    HRESULT GetOverlayImage(int iOverlay, int* piIndex);
};

[
    uuid(BCADA15B-B428-420c-8D28-023590924C9F)
]
library CommonControlObjects
{

    [
        uuid(7C476BA2-02B1-48f4-8048-B24619DDC058)  // CLSID_ImageList
    ]
    coclass ImageList
    {
        interface IImageList;
    }
};
