Fix mingw build error of ITaskbarList3.

Author: Chaobin Zhang

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77584 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Chaobin, Zhang
2014-09-10 09:11:53 +00:00
parent c27103f8e1
commit b1971e614c
2 changed files with 12 additions and 7 deletions

View File

@@ -17,7 +17,7 @@
struct ITaskbarList3; struct ITaskbarList3;
class wxTaskBarButtonImpl : public wxTaskBarButton { class WXDLLIMPEXP_ADV wxTaskBarButtonImpl : public wxTaskBarButton {
public: public:
virtual ~wxTaskBarButtonImpl(); virtual ~wxTaskBarButtonImpl();

View File

@@ -25,12 +25,16 @@
#include "wx/taskbarbutton.h" #include "wx/taskbarbutton.h"
#include <Shobjidl.h> #include <Shobjidl.h>
#include <initguid.h>
namespace { namespace {
// The maximum number of thumbnail toolbar buttons allowed on windows is 7. // The maximum number of thumbnail toolbar buttons allowed on windows is 7.
static const int LIMITED_BUTTON_SIZE = 7; static const int LIMITED_BUTTON_SIZE = 7;
DEFINE_GUID(wxCLSID_TaskbarList,
0x56fdf344, 0xfd6d, 0x11d0, 0x95, 0x8a, 0x0, 0x60, 0x97, 0xc9, 0xa0, 0x90);
THUMBBUTTONFLAGS GetNativeThumbButtonFlags(const wxThumbBarButton& button) THUMBBUTTONFLAGS GetNativeThumbButtonFlags(const wxThumbBarButton& button)
{ {
WXUINT flags = 0; WXUINT flags = 0;
@@ -75,15 +79,15 @@ wxTaskBarButtonImpl::wxTaskBarButtonImpl(WXWidget parent)
{ {
HRESULT hr = CoCreateInstance HRESULT hr = CoCreateInstance
( (
CLSID_TaskbarList, wxCLSID_TaskbarList,
NULL, NULL,
CLSCTX_ALL, CLSCTX_INPROC_SERVER,
IID_ITaskbarList3, IID_ITaskbarList3,
reinterpret_cast<void **>(&m_taskbarList) reinterpret_cast<void **>(&m_taskbarList)
); );
if ( FAILED(hr) ) if ( FAILED(hr) )
{ {
wxLogApiError(wxT("CoCreateInstance(CLSID_TaskbarButtonList)"), hr); wxLogApiError(wxT("CoCreateInstance(CLSID_TaskbarList)"), hr);
return; return;
} }
@@ -230,14 +234,14 @@ bool wxTaskBarButtonImpl::InitOrUpdateThumbBarButtons()
memset(&buttons[i], 0, sizeof buttons[i]); memset(&buttons[i], 0, sizeof buttons[i]);
buttons[i].iId = i; buttons[i].iId = i;
buttons[i].dwFlags = THBF_HIDDEN; buttons[i].dwFlags = THBF_HIDDEN;
buttons[i].dwMask = THB_FLAGS; buttons[i].dwMask = static_cast<THUMBBUTTONMASK>(THB_FLAGS);
} }
for ( i = 0; i < m_thumbBarButtons.size(); ++i ) for ( i = 0; i < m_thumbBarButtons.size(); ++i )
{ {
buttons[i].hIcon = GetHiconOf(m_thumbBarButtons[i]->GetIcon()); buttons[i].hIcon = GetHiconOf(m_thumbBarButtons[i]->GetIcon());
buttons[i].dwFlags = GetNativeThumbButtonFlags(*m_thumbBarButtons[i]); buttons[i].dwFlags = GetNativeThumbButtonFlags(*m_thumbBarButtons[i]);
buttons[i].dwMask = THB_ICON | THB_FLAGS; buttons[i].dwMask = static_cast<THUMBBUTTONMASK>(THB_ICON | THB_FLAGS);
wxString tooltip = m_thumbBarButtons[i]->GetTooltip(); wxString tooltip = m_thumbBarButtons[i]->GetTooltip();
if ( tooltip.empty() ) if ( tooltip.empty() )
continue; continue;
@@ -247,7 +251,8 @@ bool wxTaskBarButtonImpl::InitOrUpdateThumbBarButtons()
if ( tooltip.length() > WXSIZEOF(buttons[i].szTip) ) if ( tooltip.length() > WXSIZEOF(buttons[i].szTip) )
tooltip = tooltip.SubString(0, WXSIZEOF(buttons[i].szTip) - 1); tooltip = tooltip.SubString(0, WXSIZEOF(buttons[i].szTip) - 1);
wxStrlcpy(buttons[i].szTip, tooltip.t_str(), tooltip.length()); wxStrlcpy(buttons[i].szTip, tooltip.t_str(), tooltip.length());
buttons[i].dwMask |= THB_TOOLTIP; buttons[i].dwMask =
static_cast<THUMBBUTTONMASK>(buttons[i].dwMask | THB_TOOLTIP);
} }
if ( !m_hasInitThumbnailToolbar ) if ( !m_hasInitThumbnailToolbar )