/***********************************************************
** Copyright (c) 2009 NGuide
** 
** Contact: vasa_pmr@mail.ru
**
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact me   
 **********************************************************/

#ifndef COMINTF_H
#define COMINTF_H

#include <QtCore/qglobal.h>

#ifdef Q_OS_WIN
#include <windows.h>
#include <commctrl.h>

namespace Windows7Support {
namespace Private {

// interface ITaskbarList3

#include <initguid.h>

DEFINE_GUID(CLSID_TaskbarList, 0x56FDF344, 0xFD6D, 0x11d0, 0x95, 0x8A, 0x0, 0x60, 0x97, 0xC9, 0xA0, 0x90);
DEFINE_GUID(IID_ITaskbarList3, 0xEA1AFB91, 0x9E28, 0x4B86, 0x90, 0xE9, 0x9E, 0x9F, 0x8A, 0x5E, 0xEF, 0xAF);

enum THUMBBUTTONFLAGS
    {	THBF_ENABLED	= 0,
        THBF_DISABLED	= 0x1,
        THBF_DISMISSONCLICK	= 0x2,
        THBF_NOBACKGROUND	= 0x4,
        THBF_HIDDEN	= 0x8,
        THBF_NONINTERACTIVE	= 0x10
    };

enum THUMBBUTTONMASK
    {	THB_BITMAP	= 0x1,
        THB_ICON	= 0x2,
        THB_TOOLTIP	= 0x4,
        THB_FLAGS	= 0x8
    };

struct THUMBBUTTON
    {
    int dwMask;
    UINT iId;
    UINT iBitmap;
    HICON hIcon;
    WCHAR szTip[ 260 ];
    int dwFlags;
    };

typedef THUMBBUTTON *LPTHUMBBUTTON;

typedef /* [v1_enum] */
    enum TBPFLAG
        {
            TBPF_NOPROGRESS = 0,
            TBPF_INDETERMINATE      = 0x1,
            TBPF_NORMAL     = 0x2,
            TBPF_ERROR      = 0x4,
            TBPF_PAUSED     = 0x8
        } TBPFLAG;

MIDL_INTERFACE("56FDF342-FD6D-11d0-958A-006097C9A090")
ITaskbarList : public IUnknown
{
public:
    virtual HRESULT STDMETHODCALLTYPE HrInit( void) = 0;

    virtual HRESULT STDMETHODCALLTYPE AddTab(
        /* [in] */ HWND hwnd) = 0;

    virtual HRESULT STDMETHODCALLTYPE DeleteTab(
        /* [in] */ HWND hwnd) = 0;

    virtual HRESULT STDMETHODCALLTYPE ActivateTab(
        /* [in] */  HWND hwnd) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetActiveAlt(
        /* [in] */  HWND hwnd) = 0;
};

MIDL_INTERFACE("602D4995-B13A-429b-A66E-1935E44F4317")
ITaskbarList2 : public ITaskbarList
{
public:
    virtual HRESULT STDMETHODCALLTYPE MarkFullscreenWindow(
        /* [in] */  HWND hwnd,
        /* [in] */ BOOL fFullscreen) = 0;
};

MIDL_INTERFACE("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")
ITaskbarList3 : public ITaskbarList2
{
public:
    virtual HRESULT STDMETHODCALLTYPE SetProgressValue(
        /* [in] */  HWND hwnd,
        /* [in] */ ULONGLONG ullCompleted,
        /* [in] */ ULONGLONG ullTotal) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetProgressState(
        /* [in] */  HWND hwnd,
        /* [in] */ TBPFLAG tbpFlags) = 0;

    virtual HRESULT STDMETHODCALLTYPE RegisterTab(
        /* [in] */  HWND hwndTab,
        /* [in] */  HWND hwndMDI) = 0;

    virtual HRESULT STDMETHODCALLTYPE UnregisterTab(
        /* [in] */  HWND hwndTab) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetTabOrder(
        /* [in] */  HWND hwndTab,
        /* [in] */  HWND hwndInsertBefore) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetTabActive(
        /* [in] */  HWND hwndTab,
        /* [in] */  HWND hwndMDI,
        /* [in] */ DWORD dwReserved) = 0;

    virtual HRESULT STDMETHODCALLTYPE ThumbBarAddButtons(
        /* [in] */  HWND hwnd,
        /* [in] */ UINT cButtons,
        /* [size_is][in] */ LPTHUMBBUTTON pButton) = 0;

    virtual HRESULT STDMETHODCALLTYPE ThumbBarUpdateButtons(
        /* [in] */  HWND hwnd,
        /* [in] */ UINT cButtons,
        /* [size_is][in] */ LPTHUMBBUTTON pButton) = 0;

    virtual HRESULT STDMETHODCALLTYPE ThumbBarSetImageList(
        /* [in] */  HWND hwnd,
        /* [in] */  HIMAGELIST himl) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetOverlayIcon(
        /* [in] */  HWND hwnd,
        /* [in] */  HICON hIcon,
        /* [string][unique][in] */ LPCWSTR pszDescription) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetThumbnailTooltip(
        /* [in] */  HWND hwnd,
        /* [string][unique][in] */ LPCWSTR pszTip) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetThumbnailClip(
        /* [in] */  HWND hwnd,
        /* [in] */  RECT *prcClip) = 0;
};

#endif // Q_OS_WIN defined

} // namespace Private
} // namespace Windows7Support

#endif // COMINTF_H
