Implement getting recent and frequent category.

- New class wxJumpListCategory to represent a category in the jump list.
- Api for accessing recent and frequent category.

Author: Chaobin Zhang

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2014-09-10 14:53:57 +00:00
parent e903ebda55
commit dc51580b1a
3 changed files with 442 additions and 35 deletions

View File

@@ -139,26 +139,42 @@ bool MyApp::OnInit()
{
if ( !wxApp::OnInit() )
return false;
wxJumpList jump;
wxJumpListItems tasks;
wxJumpListItem item1(wxJUMP_LIST_TASK,
wxT("Task 1"),
wxStandardPaths::Get().GetExecutablePath(),
wxEmptyString,
wxT("Test Task"),
wxStandardPaths::Get().GetExecutablePath(),
0);
wxJumpListItem item2(wxJUMP_LIST_TASK,
wxT("Task 2"),
wxStandardPaths::Get().GetExecutablePath(),
wxEmptyString,
wxT("Test Task"),
wxStandardPaths::Get().GetExecutablePath(),
0);
tasks.push_back(item1);
tasks.push_back(wxJumpListItem(wxJUMP_LIST_SEPARATOR));
tasks.push_back(item2);
jump.SetTasks(tasks);
wxJumpList jumpList;
wxJumpListItem *item1 = new wxJumpListItem(
wxJUMP_LIST_TASK,
wxT("Task 1"),
wxStandardPaths::Get().GetExecutablePath(),
wxEmptyString,
wxT("Test Task"),
wxStandardPaths::Get().GetExecutablePath(),
0);
wxJumpListItem *item2 = new wxJumpListItem(
wxJUMP_LIST_TASK,
wxT("Task 2"),
wxStandardPaths::Get().GetExecutablePath(),
wxEmptyString,
wxT("Test Task"),
wxStandardPaths::Get().GetExecutablePath(),
0);
jumpList.GetTasks()->Append(item1);
jumpList.GetTasks()->Append(new wxJumpListItem(wxJUMP_LIST_SEPARATOR));
jumpList.GetTasks()->Append(item2);
jumpList.ShowRecentCategory();
jumpList.ShowFrequentCategory();
jumpList.Update();
const wxJumpListCategory* category = jumpList.GetFrequentCategory();
const wxJumpListItems& frequentItems = category->GetItems();
for ( size_t i = 0; i < frequentItems.size(); ++i )
{
wxLogMessage(frequentItems[i]->GetFilePath());
}
category = jumpList.GetRecentCategory();
const wxJumpListItems& recentItems = category->GetItems();
for ( size_t i = 0; i < recentItems.size(); ++i )
{
wxLogMessage(recentItems[i]->GetFilePath());
}
MyFrame *frame = new MyFrame("wxTaskBarButton App");
frame->Show(true);