From 1ef98f25335b1fba4870a2fe2677f60633a98100 Mon Sep 17 00:00:00 2001 From: Bryan Petty Date: Wed, 10 Sep 2014 14:55:01 +0000 Subject: [PATCH] Support setting AppUserModelID of wxTaskBarJumpList. Specifies a unique Application User Model ID (AppUserModelID) for the application whose taskbar button will hold the custom Jump List built through the methods of this class. This parameter is optional. Author: Chaobin Zhang git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77622 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/taskbarbutton.h | 5 ++++- include/wx/taskbarbutton.h | 2 +- src/msw/taskbarbutton.cpp | 12 +++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/wx/msw/taskbarbutton.h b/include/wx/msw/taskbarbutton.h index 537f2f361d..04a368281e 100644 --- a/include/wx/msw/taskbarbutton.h +++ b/include/wx/msw/taskbarbutton.h @@ -69,7 +69,7 @@ private: class WXDLLIMPEXP_CORE wxTaskBarJumpListImpl { public: - wxTaskBarJumpListImpl(); + wxTaskBarJumpListImpl(const wxString& appID = wxEmptyString); virtual ~wxTaskBarJumpListImpl(); void ShowRecentCategory(bool shown = true); void HideRecentCategory(); @@ -102,6 +102,9 @@ private: wxTaskBarJumpListCategories m_customCategories; bool m_recent_visible; bool m_frequent_visible; + + // Application User Model ID. + wxString m_appID; }; #endif // wxUSE_TASKBARBUTTON diff --git a/include/wx/taskbarbutton.h b/include/wx/taskbarbutton.h index c513bdc8dc..c6fa6a23ee 100644 --- a/include/wx/taskbarbutton.h +++ b/include/wx/taskbarbutton.h @@ -212,7 +212,7 @@ typedef wxVector wxTaskBarJumpListCategories; class WXDLLIMPEXP_CORE wxTaskBarJumpList { public: - wxTaskBarJumpList(); + wxTaskBarJumpList(const wxString& appID = wxEmptyString); virtual ~wxTaskBarJumpList(); void ShowRecentCategory(bool shown = true); void HideRecentCategory(); diff --git a/src/msw/taskbarbutton.cpp b/src/msw/taskbarbutton.cpp index 89effdb1a6..3c3ee5b235 100644 --- a/src/msw/taskbarbutton.cpp +++ b/src/msw/taskbarbutton.cpp @@ -1077,8 +1077,8 @@ const wxTaskBarJumpListItems& wxTaskBarJumpListCategory::GetItems() const // ---------------------------------------------------------------------------- // wxTaskBarJumpList Implementation. // ---------------------------------------------------------------------------- -wxTaskBarJumpList::wxTaskBarJumpList() - : m_jumpListImpl(new wxTaskBarJumpListImpl()) +wxTaskBarJumpList::wxTaskBarJumpList(const wxString& appID) + : m_jumpListImpl(new wxTaskBarJumpListImpl(appID)) { } @@ -1152,7 +1152,9 @@ void wxTaskBarJumpList::Update() // ---------------------------------------------------------------------------- // wxTaskBarJumpListImpl Implementation. // ---------------------------------------------------------------------------- -wxTaskBarJumpListImpl::wxTaskBarJumpListImpl() : m_destinationList(NULL) +wxTaskBarJumpListImpl::wxTaskBarJumpListImpl(const wxString& appID) + : m_appID(appID), + m_destinationList(NULL) { HRESULT hr = CoCreateInstance ( @@ -1289,6 +1291,8 @@ bool wxTaskBarJumpListImpl::BeginUpdate() unsigned int max_count = 0; HRESULT hr = m_destinationList->BeginList(&max_count, wxIID_IObjectArray, reinterpret_cast(&(m_objectArray))); + if ( !m_appID.empty() ) + m_destinationList->SetAppID(m_appID.wc_str()); return SUCCEEDED(hr); } @@ -1364,6 +1368,8 @@ void wxTaskBarJumpListImpl::LoadKnownCategory(const wxString& title) wxLogApiError("CoCreateInstance(wxCLSID_ApplicationDocumentLists)", hr); return; } + if ( !m_appID.empty() ) + docList->SetAppID(m_appID.wc_str()); IObjectArray *array = NULL; wxASSERT_MSG( title == "Recent" || title == "Frequent", "Invalid title." );