Add parent pointer of the classes: item -> category -> jump list.

The parent of wxTaskBarJumpListItem is wxTaskBarJumpListCategory, the
parent of wxTaskBarJumpListCategory is wxTaskBarJumpList. After this change,
users do not need to call the update method of jump list manually.

Author: Chaobin Zhang

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2014-09-10 14:55:21 +00:00
parent bb79e83528
commit 6b527d5eca
5 changed files with 121 additions and 38 deletions

View File

@@ -142,6 +142,7 @@ bool MyApp::OnInit()
wxTaskBarJumpList jumpList;
wxTaskBarJumpListItem *item1 = new wxTaskBarJumpListItem(
NULL,
wxTASKBAR_JUMP_LIST_TASK,
wxT("Task 1"),
wxStandardPaths::Get().GetExecutablePath(),
@@ -150,6 +151,7 @@ bool MyApp::OnInit()
wxStandardPaths::Get().GetExecutablePath(),
0);
wxTaskBarJumpListItem *item2 = new wxTaskBarJumpListItem(
NULL,
wxTASKBAR_JUMP_LIST_TASK,
wxT("Task 2"),
wxStandardPaths::Get().GetExecutablePath(),
@@ -159,12 +161,15 @@ bool MyApp::OnInit()
0);
jumpList.GetTasks().Append(item1);
jumpList.GetTasks().Append(
new wxTaskBarJumpListItem(wxTASKBAR_JUMP_LIST_SEPARATOR));
new wxTaskBarJumpListItem(NULL, wxTASKBAR_JUMP_LIST_SEPARATOR));
jumpList.GetTasks().Append(item2);
jumpList.ShowRecentCategory();
jumpList.ShowFrequentCategory();
wxTaskBarJumpListCategory* customCategory =
new wxTaskBarJumpListCategory(&jumpList, wxT("Custom"));
wxTaskBarJumpListItem* item3 = new wxTaskBarJumpListItem(
customCategory,
wxTASKBAR_JUMP_LIST_DESTIONATION,
wxT("Help"),
wxStandardPaths::Get().GetExecutablePath(),
@@ -172,13 +177,9 @@ bool MyApp::OnInit()
wxT("wxTaskBarButton help."),
wxStandardPaths::Get().GetExecutablePath(),
0);
wxTaskBarJumpListCategory* customCategory =
new wxTaskBarJumpListCategory(wxT("Custom"));
customCategory->Append(item3);
jumpList.AddCustomCategory(customCategory);
jumpList.Update();
const wxTaskBarJumpListCategory& frequentCategory =
jumpList.GetFrequentCategory();
const wxTaskBarJumpListItems& frequentItems = frequentCategory.GetItems();