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
This commit is contained in:
Bryan Petty
2014-09-10 14:55:01 +00:00
parent e464ed176f
commit 1ef98f2533
3 changed files with 14 additions and 5 deletions

View File

@@ -69,7 +69,7 @@ private:
class WXDLLIMPEXP_CORE wxTaskBarJumpListImpl class WXDLLIMPEXP_CORE wxTaskBarJumpListImpl
{ {
public: public:
wxTaskBarJumpListImpl(); wxTaskBarJumpListImpl(const wxString& appID = wxEmptyString);
virtual ~wxTaskBarJumpListImpl(); virtual ~wxTaskBarJumpListImpl();
void ShowRecentCategory(bool shown = true); void ShowRecentCategory(bool shown = true);
void HideRecentCategory(); void HideRecentCategory();
@@ -102,6 +102,9 @@ private:
wxTaskBarJumpListCategories m_customCategories; wxTaskBarJumpListCategories m_customCategories;
bool m_recent_visible; bool m_recent_visible;
bool m_frequent_visible; bool m_frequent_visible;
// Application User Model ID.
wxString m_appID;
}; };
#endif // wxUSE_TASKBARBUTTON #endif // wxUSE_TASKBARBUTTON

View File

@@ -212,7 +212,7 @@ typedef wxVector<wxTaskBarJumpListCategory*> wxTaskBarJumpListCategories;
class WXDLLIMPEXP_CORE wxTaskBarJumpList class WXDLLIMPEXP_CORE wxTaskBarJumpList
{ {
public: public:
wxTaskBarJumpList(); wxTaskBarJumpList(const wxString& appID = wxEmptyString);
virtual ~wxTaskBarJumpList(); virtual ~wxTaskBarJumpList();
void ShowRecentCategory(bool shown = true); void ShowRecentCategory(bool shown = true);
void HideRecentCategory(); void HideRecentCategory();

View File

@@ -1077,8 +1077,8 @@ const wxTaskBarJumpListItems& wxTaskBarJumpListCategory::GetItems() const
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxTaskBarJumpList Implementation. // wxTaskBarJumpList Implementation.
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxTaskBarJumpList::wxTaskBarJumpList() wxTaskBarJumpList::wxTaskBarJumpList(const wxString& appID)
: m_jumpListImpl(new wxTaskBarJumpListImpl()) : m_jumpListImpl(new wxTaskBarJumpListImpl(appID))
{ {
} }
@@ -1152,7 +1152,9 @@ void wxTaskBarJumpList::Update()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxTaskBarJumpListImpl Implementation. // wxTaskBarJumpListImpl Implementation.
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxTaskBarJumpListImpl::wxTaskBarJumpListImpl() : m_destinationList(NULL) wxTaskBarJumpListImpl::wxTaskBarJumpListImpl(const wxString& appID)
: m_appID(appID),
m_destinationList(NULL)
{ {
HRESULT hr = CoCreateInstance HRESULT hr = CoCreateInstance
( (
@@ -1289,6 +1291,8 @@ bool wxTaskBarJumpListImpl::BeginUpdate()
unsigned int max_count = 0; unsigned int max_count = 0;
HRESULT hr = m_destinationList->BeginList(&max_count, HRESULT hr = m_destinationList->BeginList(&max_count,
wxIID_IObjectArray, reinterpret_cast<void**>(&(m_objectArray))); wxIID_IObjectArray, reinterpret_cast<void**>(&(m_objectArray)));
if ( !m_appID.empty() )
m_destinationList->SetAppID(m_appID.wc_str());
return SUCCEEDED(hr); return SUCCEEDED(hr);
} }
@@ -1364,6 +1368,8 @@ void wxTaskBarJumpListImpl::LoadKnownCategory(const wxString& title)
wxLogApiError("CoCreateInstance(wxCLSID_ApplicationDocumentLists)", hr); wxLogApiError("CoCreateInstance(wxCLSID_ApplicationDocumentLists)", hr);
return; return;
} }
if ( !m_appID.empty() )
docList->SetAppID(m_appID.wc_str());
IObjectArray *array = NULL; IObjectArray *array = NULL;
wxASSERT_MSG( title == "Recent" || title == "Frequent", "Invalid title." ); wxASSERT_MSG( title == "Recent" || title == "Frequent", "Invalid title." );