Rename wxJumpList to wxTaskBarJumpList etc.

Class name wxJumpList is overly generic.

Author: Chaobin Zhang

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77620 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty 2014-09-10 14:54:40 +00:00
parent de7b819cdc
commit 2b8c76daff
4 changed files with 200 additions and 177 deletions

View File

@ -66,23 +66,23 @@ private:
bool m_hasInitThumbnailToolbar; bool m_hasInitThumbnailToolbar;
}; };
class WXDLLIMPEXP_CORE wxJumpListImpl class WXDLLIMPEXP_CORE wxTaskBarJumpListImpl
{ {
public: public:
wxJumpListImpl(); wxTaskBarJumpListImpl();
virtual ~wxJumpListImpl(); virtual ~wxTaskBarJumpListImpl();
void ShowRecentCategory(bool shown = true); void ShowRecentCategory(bool shown = true);
void HideRecentCategory(); void HideRecentCategory();
void ShowFrequentCategory(bool shown = true); void ShowFrequentCategory(bool shown = true);
void HideFrequentCategory(); void HideFrequentCategory();
wxJumpListCategory* GetTasks(); wxTaskBarJumpListCategory& GetTasks();
const wxJumpListCategory* GetFrequentCategory(); const wxTaskBarJumpListCategory& GetFrequentCategory();
const wxJumpListCategory* GetRecentCategory(); const wxTaskBarJumpListCategory& GetRecentCategory();
const wxJumpListCategories& GetCustomCategories(); const wxTaskBarJumpListCategories& GetCustomCategories() const;
void AddCategory(wxJumpListCategory* category); void AddCategory(wxTaskBarJumpListCategory* category);
wxJumpListCategory* RemoveCategory(const wxString& title); wxTaskBarJumpListCategory* RemoveCategory(const wxString& title);
void DeleteCategory(const wxString& title); void DeleteCategory(const wxString& title);
void Update(); void Update();
@ -96,10 +96,10 @@ private:
ICustomDestinationList *m_destinationList; ICustomDestinationList *m_destinationList;
IObjectArray *m_objectArray; IObjectArray *m_objectArray;
wxScopedPtr<wxJumpListCategory> m_tasks; wxScopedPtr<wxTaskBarJumpListCategory> m_tasks;
wxScopedPtr<wxJumpListCategory> m_frequent; wxScopedPtr<wxTaskBarJumpListCategory> m_frequent;
wxScopedPtr<wxJumpListCategory> m_recent; wxScopedPtr<wxTaskBarJumpListCategory> m_recent;
wxJumpListCategories m_customCategories; wxTaskBarJumpListCategories m_customCategories;
bool m_recent_visible; bool m_recent_visible;
bool m_frequent_visible; bool m_frequent_visible;
}; };

View File

@ -20,7 +20,7 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxTaskBarButton; class WXDLLIMPEXP_FWD_CORE wxTaskBarButton;
class WXDLLIMPEXP_FWD_CORE wxJumpListImpl; class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListImpl;
/** /**
State of the task bar button. State of the task bar button.
@ -141,17 +141,17 @@ private:
wxScopedPtr<wxTaskBarButton> m_taskBarButton; wxScopedPtr<wxTaskBarButton> m_taskBarButton;
}; };
enum WXDLLIMPEXP_CORE wxJumpListItemType enum WXDLLIMPEXP_CORE wxTaskBarJumpListItemType
{ {
wxJUMP_LIST_SEPARATOR, wxTASKBAR_JUMP_LIST_SEPARATOR,
wxJUMP_LIST_TASK, wxTASKBAR_JUMP_LIST_TASK,
wxJUMP_LIST_DESTIONATION wxTASKBAR_JUMP_LIST_DESTIONATION
}; };
class WXDLLIMPEXP_CORE wxJumpListItem class WXDLLIMPEXP_CORE wxTaskBarJumpListItem
{ {
public: public:
wxJumpListItem(wxJumpListItemType type, wxTaskBarJumpListItem(wxTaskBarJumpListItemType type,
const wxString& title = wxEmptyString, const wxString& title = wxEmptyString,
const wxString& filePath = wxEmptyString, const wxString& filePath = wxEmptyString,
const wxString& arguments = wxEmptyString, const wxString& arguments = wxEmptyString,
@ -159,8 +159,8 @@ public:
const wxString& iconPath = wxEmptyString, const wxString& iconPath = wxEmptyString,
int iconIndex = 0); int iconIndex = 0);
wxJumpListItemType GetType() const; wxTaskBarJumpListItemType GetType() const;
void SetType(wxJumpListItemType type); void SetType(wxTaskBarJumpListItemType type);
const wxString& GetTitle() const; const wxString& GetTitle() const;
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
const wxString& GetFilePath() const; const wxString& GetFilePath() const;
@ -175,7 +175,7 @@ public:
void SetIconIndex(int iconIndex); void SetIconIndex(int iconIndex);
private: private:
wxJumpListItemType m_type; wxTaskBarJumpListItemType m_type;
wxString m_title; wxString m_title;
wxString m_filePath; wxString m_filePath;
wxString m_arguments; wxString m_arguments;
@ -184,53 +184,53 @@ private:
int m_iconIndex; int m_iconIndex;
}; };
typedef wxVector<wxJumpListItem*> wxJumpListItems; typedef wxVector<wxTaskBarJumpListItem*> wxTaskBarJumpListItems;
class WXDLLIMPEXP_CORE wxJumpListCategory class WXDLLIMPEXP_CORE wxTaskBarJumpListCategory
{ {
public: public:
wxJumpListCategory(const wxString& title = wxEmptyString); wxTaskBarJumpListCategory(const wxString& title = wxEmptyString);
virtual ~wxJumpListCategory(); virtual ~wxTaskBarJumpListCategory();
wxJumpListItem* Append(wxJumpListItem *item); wxTaskBarJumpListItem* Append(wxTaskBarJumpListItem *item);
void Delete(wxJumpListItem *item); void Delete(wxTaskBarJumpListItem *item);
wxJumpListItem* Remove(wxJumpListItem *item); wxTaskBarJumpListItem* Remove(wxTaskBarJumpListItem *item);
wxJumpListItem* FindItemByPosition (size_t pos) const; wxTaskBarJumpListItem* FindItemByPosition(size_t pos) const;
wxJumpListItem* Insert(size_t pos, wxJumpListItem *item); wxTaskBarJumpListItem* Insert(size_t pos, wxTaskBarJumpListItem *item);
wxJumpListItem* Prepend(wxJumpListItem *item); wxTaskBarJumpListItem* Prepend(wxTaskBarJumpListItem *item);
void SetTitle(const wxString& title); void SetTitle(const wxString& title);
const wxString& GetTitle() const; const wxString& GetTitle() const;
const wxJumpListItems& GetItems() const; const wxTaskBarJumpListItems& GetItems() const;
private: private:
wxJumpListItems m_items; wxTaskBarJumpListItems m_items;
wxString m_title; wxString m_title;
}; };
typedef wxVector<wxJumpListCategory*> wxJumpListCategories; typedef wxVector<wxTaskBarJumpListCategory*> wxTaskBarJumpListCategories;
class WXDLLIMPEXP_CORE wxJumpList class WXDLLIMPEXP_CORE wxTaskBarJumpList
{ {
public: public:
wxJumpList(); wxTaskBarJumpList();
virtual ~wxJumpList(); virtual ~wxTaskBarJumpList();
void ShowRecentCategory(bool shown = true); void ShowRecentCategory(bool shown = true);
void HideRecentCategory(); void HideRecentCategory();
void ShowFrequentCategory(bool shown = true); void ShowFrequentCategory(bool shown = true);
void HideFrequentCategory(); void HideFrequentCategory();
wxJumpListCategory* GetTasks(); wxTaskBarJumpListCategory& GetTasks() const;
const wxJumpListCategory* GetFrequentCategory(); const wxTaskBarJumpListCategory& GetFrequentCategory() const;
const wxJumpListCategory* GetRecentCategory(); const wxTaskBarJumpListCategory& GetRecentCategory() const;
const wxJumpListCategories& GetCustomCategories(); const wxTaskBarJumpListCategories& GetCustomCategories() const;
void AddCategory(wxJumpListCategory* category); void AddCategory(wxTaskBarJumpListCategory* category);
wxJumpListCategory* RemoveCategory(const wxString& title); wxTaskBarJumpListCategory* RemoveCategory(const wxString& title);
void DeleteCategory(const wxString& title); void DeleteCategory(const wxString& title);
void Update(); void Update();
private: private:
wxJumpListImpl *m_jumpListImpl; wxTaskBarJumpListImpl *m_jumpListImpl;
}; };
#endif // wxUSE_TASKBARBUTTON #endif // wxUSE_TASKBARBUTTON

View File

@ -139,51 +139,56 @@ bool MyApp::OnInit()
{ {
if ( !wxApp::OnInit() ) if ( !wxApp::OnInit() )
return false; return false;
wxJumpList jumpList; wxTaskBarJumpList jumpList;
wxJumpListItem *item1 = new wxJumpListItem( wxTaskBarJumpListItem *item1 = new wxTaskBarJumpListItem(
wxJUMP_LIST_TASK, wxTASKBAR_JUMP_LIST_TASK,
wxT("Task 1"), wxT("Task 1"),
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
wxEmptyString, wxEmptyString,
wxT("Test Task"), wxT("Test Task"),
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
0); 0);
wxJumpListItem *item2 = new wxJumpListItem( wxTaskBarJumpListItem *item2 = new wxTaskBarJumpListItem(
wxJUMP_LIST_TASK, wxTASKBAR_JUMP_LIST_TASK,
wxT("Task 2"), wxT("Task 2"),
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
wxEmptyString, wxEmptyString,
wxT("Test Task"), wxT("Test Task"),
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
0); 0);
jumpList.GetTasks()->Append(item1); jumpList.GetTasks().Append(item1);
jumpList.GetTasks()->Append(new wxJumpListItem(wxJUMP_LIST_SEPARATOR)); jumpList.GetTasks().Append(
jumpList.GetTasks()->Append(item2); new wxTaskBarJumpListItem(wxTASKBAR_JUMP_LIST_SEPARATOR));
jumpList.GetTasks().Append(item2);
jumpList.ShowRecentCategory(); jumpList.ShowRecentCategory();
jumpList.ShowFrequentCategory(); jumpList.ShowFrequentCategory();
wxJumpListItem* item3 = new wxJumpListItem( wxTaskBarJumpListItem* item3 = new wxTaskBarJumpListItem(
wxJUMP_LIST_DESTIONATION, wxTASKBAR_JUMP_LIST_DESTIONATION,
wxT("Custom Item - Help"), wxT("Custom Item - Help"),
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
wxT("--help"), wxT("--help"),
wxT("Test Custom Category."), wxT("Test Custom Category."),
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
0); 0);
wxJumpListCategory* customCategory = new wxJumpListCategory(wxT("Custom")); wxTaskBarJumpListCategory* customCategory =
new wxTaskBarJumpListCategory(wxT("Custom"));
customCategory->Append(item3); customCategory->Append(item3);
jumpList.AddCategory(customCategory); jumpList.AddCategory(customCategory);
jumpList.Update(); jumpList.Update();
const wxJumpListCategory* category = jumpList.GetFrequentCategory(); const wxTaskBarJumpListCategory& frequentCategory =
const wxJumpListItems& frequentItems = category->GetItems(); jumpList.GetFrequentCategory();
const wxTaskBarJumpListItems& frequentItems = frequentCategory.GetItems();
for ( size_t i = 0; i < frequentItems.size(); ++i ) for ( size_t i = 0; i < frequentItems.size(); ++i )
{ {
wxLogMessage(frequentItems[i]->GetFilePath()); wxLogMessage(frequentItems[i]->GetFilePath());
} }
category = jumpList.GetRecentCategory();
const wxJumpListItems& recentItems = category->GetItems(); const wxTaskBarJumpListCategory& recentCategory =
jumpList.GetRecentCategory();
const wxTaskBarJumpListItems& recentItems = recentCategory.GetItems();
for ( size_t i = 0; i < recentItems.size(); ++i ) for ( size_t i = 0; i < recentItems.size(); ++i )
{ {
wxLogMessage(recentItems[i]->GetFilePath()); wxLogMessage(recentItems[i]->GetFilePath());

View File

@ -352,7 +352,8 @@ THUMBBUTTONFLAGS GetNativeThumbButtonFlags(const wxThumbBarButton& button)
return static_cast<THUMBBUTTONFLAGS>(flags); return static_cast<THUMBBUTTONFLAGS>(flags);
} }
bool AddShellLink(IObjectCollection *collection, const wxJumpListItem& item) bool AddShellLink(IObjectCollection *collection,
const wxTaskBarJumpListItem& item)
{ {
IShellLink* shellLink = NULL; IShellLink* shellLink = NULL;
IPropertyStore* propertyStore = NULL; IPropertyStore* propertyStore = NULL;
@ -371,8 +372,8 @@ bool AddShellLink(IObjectCollection *collection, const wxJumpListItem& item)
return false; return false;
} }
if ( item.GetType() == wxJUMP_LIST_TASK || if ( item.GetType() == wxTASKBAR_JUMP_LIST_TASK ||
item.GetType() == wxJUMP_LIST_DESTIONATION ) item.GetType() == wxTASKBAR_JUMP_LIST_DESTIONATION )
{ {
if ( !item.GetFilePath().IsEmpty() ) if ( !item.GetFilePath().IsEmpty() )
shellLink->SetPath(item.GetFilePath().wc_str()); shellLink->SetPath(item.GetFilePath().wc_str());
@ -397,8 +398,8 @@ bool AddShellLink(IObjectCollection *collection, const wxJumpListItem& item)
} }
PROPVARIANT pv; PROPVARIANT pv;
if ( item.GetType() == wxJUMP_LIST_TASK || if ( item.GetType() == wxTASKBAR_JUMP_LIST_TASK ||
item.GetType() == wxJUMP_LIST_DESTIONATION ) item.GetType() == wxTASKBAR_JUMP_LIST_DESTIONATION )
{ {
hr = InitPropVariantFromString(item.GetTitle().wc_str(), &pv); hr = InitPropVariantFromString(item.GetTitle().wc_str(), &pv);
if ( SUCCEEDED(hr) ) if ( SUCCEEDED(hr) )
@ -406,7 +407,7 @@ bool AddShellLink(IObjectCollection *collection, const wxJumpListItem& item)
hr = propertyStore->SetValue(PKEY_Title, pv); hr = propertyStore->SetValue(PKEY_Title, pv);
} }
} }
else if ( item.GetType() == wxJUMP_LIST_SEPARATOR ) else if ( item.GetType() == wxTASKBAR_JUMP_LIST_SEPARATOR )
{ {
hr = InitPropVariantFromBoolean(TRUE, &pv); hr = InitPropVariantFromBoolean(TRUE, &pv);
if ( SUCCEEDED(hr) ) if ( SUCCEEDED(hr) )
@ -428,12 +429,13 @@ bool AddShellLink(IObjectCollection *collection, const wxJumpListItem& item)
return SUCCEEDED(hr); return SUCCEEDED(hr);
} }
wxJumpListItem* GetItemFromIShellLink(IShellLink* link) wxTaskBarJumpListItem* GetItemFromIShellLink(IShellLink* link)
{ {
if ( !link ) if ( !link )
return NULL; return NULL;
wxJumpListItem *item = new wxJumpListItem(wxJUMP_LIST_DESTIONATION); wxTaskBarJumpListItem* item =
new wxTaskBarJumpListItem(wxTASKBAR_JUMP_LIST_DESTIONATION);
IPropertyStore *linkProps; IPropertyStore *linkProps;
HRESULT hr = link->QueryInterface HRESULT hr = link->QueryInterface
@ -469,12 +471,13 @@ wxJumpListItem* GetItemFromIShellLink(IShellLink* link)
return item; return item;
} }
wxJumpListItem* GetItemFromIShellItem(IShellItem *shellItem) wxTaskBarJumpListItem* GetItemFromIShellItem(IShellItem *shellItem)
{ {
if ( !shellItem ) if ( !shellItem )
return NULL; return NULL;
wxJumpListItem *item = new wxJumpListItem(wxJUMP_LIST_DESTIONATION); wxTaskBarJumpListItem *item =
new wxTaskBarJumpListItem(wxTASKBAR_JUMP_LIST_DESTIONATION);
wchar_t *name; wchar_t *name;
shellItem->GetDisplayName(SIGDN_FILESYSPATH, &name); shellItem->GetDisplayName(SIGDN_FILESYSPATH, &name);
@ -855,8 +858,10 @@ wxThumbBarButton* wxTaskBarButtonImpl::GetThumbBarButtonByIndex(size_t index)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxAppProgressIndicator Implementation. // wxAppProgressIndicator Implementation.
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxAppProgressIndicator::wxAppProgressIndicator(wxTopLevelWindow *parent, int maxValue) wxAppProgressIndicator::wxAppProgressIndicator(wxTopLevelWindow *parent,
: m_parent(parent), m_maxValue(maxValue) int maxValue)
: m_parent(parent),
m_maxValue(maxValue)
{ {
} }
@ -895,9 +900,9 @@ void wxAppProgressIndicator::Init()
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxJumpListItem Implementation. // wxTaskBarJumpListItem Implementation.
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxJumpListItem::wxJumpListItem(wxJumpListItemType type, wxTaskBarJumpListItem::wxTaskBarJumpListItem(wxTaskBarJumpListItemType type,
const wxString& title, const wxString& title,
const wxString& filePath, const wxString& filePath,
const wxString& arguments, const wxString& arguments,
@ -915,87 +920,87 @@ wxJumpListItem::wxJumpListItem(wxJumpListItemType type,
} }
wxJumpListItemType wxJumpListItem::GetType() const wxTaskBarJumpListItemType wxTaskBarJumpListItem::GetType() const
{ {
return m_type; return m_type;
} }
void wxJumpListItem::SetType(wxJumpListItemType type) void wxTaskBarJumpListItem::SetType(wxTaskBarJumpListItemType type)
{ {
m_type = type; m_type = type;
} }
const wxString& wxJumpListItem::GetTitle() const const wxString& wxTaskBarJumpListItem::GetTitle() const
{ {
return m_title; return m_title;
} }
void wxJumpListItem::SetTitle(const wxString& title) void wxTaskBarJumpListItem::SetTitle(const wxString& title)
{ {
m_title = title; m_title = title;
} }
const wxString& wxJumpListItem::GetFilePath() const const wxString& wxTaskBarJumpListItem::GetFilePath() const
{ {
return m_filePath; return m_filePath;
} }
void wxJumpListItem::SetFilePath(const wxString& filePath) void wxTaskBarJumpListItem::SetFilePath(const wxString& filePath)
{ {
m_filePath = filePath; m_filePath = filePath;
} }
const wxString& wxJumpListItem::GetArguments() const const wxString& wxTaskBarJumpListItem::GetArguments() const
{ {
return m_arguments; return m_arguments;
} }
void wxJumpListItem::SetArguments(const wxString& arguments) void wxTaskBarJumpListItem::SetArguments(const wxString& arguments)
{ {
m_arguments = arguments; m_arguments = arguments;
} }
const wxString& wxJumpListItem::GetTooltip() const const wxString& wxTaskBarJumpListItem::GetTooltip() const
{ {
return m_tooltip; return m_tooltip;
} }
void wxJumpListItem::SetTooltip(const wxString& tooltip) void wxTaskBarJumpListItem::SetTooltip(const wxString& tooltip)
{ {
m_tooltip = tooltip; m_tooltip = tooltip;
} }
const wxString& wxJumpListItem::GetIconPath() const const wxString& wxTaskBarJumpListItem::GetIconPath() const
{ {
return m_iconPath; return m_iconPath;
} }
void wxJumpListItem::SetIconPath(const wxString& iconPath) void wxTaskBarJumpListItem::SetIconPath(const wxString& iconPath)
{ {
m_iconPath = iconPath; m_iconPath = iconPath;
} }
int wxJumpListItem::GetIconIndex() const int wxTaskBarJumpListItem::GetIconIndex() const
{ {
return m_iconIndex; return m_iconIndex;
} }
void wxJumpListItem::SetIconIndex(int iconIndex) void wxTaskBarJumpListItem::SetIconIndex(int iconIndex)
{ {
m_iconIndex = iconIndex; m_iconIndex = iconIndex;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxJumpListCategory Implementation. // wxTaskBarJumpListCategory Implementation.
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxJumpListCategory::wxJumpListCategory(const wxString& title) wxTaskBarJumpListCategory::wxTaskBarJumpListCategory(const wxString& title)
: m_title(title) : m_title(title)
{ {
} }
wxJumpListCategory::~wxJumpListCategory() wxTaskBarJumpListCategory::~wxTaskBarJumpListCategory()
{ {
for (wxJumpListItems::iterator it = m_items.begin(); for ( wxTaskBarJumpListItems::iterator it = m_items.begin();
it != m_items.end(); it != m_items.end();
++it ) ++it )
{ {
@ -1003,22 +1008,24 @@ wxJumpListCategory::~wxJumpListCategory()
} }
} }
wxJumpListItem* wxJumpListCategory::Append(wxJumpListItem *item) wxTaskBarJumpListItem*
wxTaskBarJumpListCategory::Append(wxTaskBarJumpListItem *item)
{ {
m_items.push_back(item); m_items.push_back(item);
return item; return item;
} }
void wxJumpListCategory::Delete(wxJumpListItem *item) void wxTaskBarJumpListCategory::Delete(wxTaskBarJumpListItem *item)
{ {
item = Remove(item); item = Remove(item);
if ( item ) if ( item )
delete item; delete item;
} }
wxJumpListItem* wxJumpListCategory::Remove(wxJumpListItem *item) wxTaskBarJumpListItem*
wxTaskBarJumpListCategory::Remove(wxTaskBarJumpListItem *item)
{ {
for (wxJumpListItems::iterator it = m_items.begin(); for (wxTaskBarJumpListItems::iterator it = m_items.begin();
it != m_items.end(); it != m_items.end();
++it) ++it)
{ {
@ -1032,115 +1039,121 @@ wxJumpListItem* wxJumpListCategory::Remove(wxJumpListItem *item)
return NULL; return NULL;
} }
wxJumpListItem* wxJumpListCategory::FindItemByPosition(size_t pos) const wxTaskBarJumpListItem*
wxTaskBarJumpListCategory::FindItemByPosition(size_t pos) const
{ {
wxASSERT_MSG( pos < m_items.size(), "invalid pos." ); wxASSERT_MSG( pos < m_items.size(), "invalid pos." );
return m_items[pos]; return m_items[pos];
} }
wxJumpListItem* wxJumpListCategory::Insert(size_t pos, wxJumpListItem *item) wxTaskBarJumpListItem*
wxTaskBarJumpListCategory::Insert(size_t pos, wxTaskBarJumpListItem *item)
{ {
wxASSERT_MSG( pos <= m_items.size(), "invalid pos." ); wxASSERT_MSG( pos <= m_items.size(), "invalid pos." );
m_items.insert(m_items.begin() + pos, item); m_items.insert(m_items.begin() + pos, item);
return item; return item;
} }
wxJumpListItem* wxJumpListCategory::Prepend(wxJumpListItem *item) wxTaskBarJumpListItem*
wxTaskBarJumpListCategory::Prepend(wxTaskBarJumpListItem *item)
{ {
return Insert(0, item); return Insert(0, item);
} }
void wxJumpListCategory::SetTitle(const wxString& title) void wxTaskBarJumpListCategory::SetTitle(const wxString& title)
{ {
m_title = title; m_title = title;
} }
const wxString& wxJumpListCategory::GetTitle() const const wxString& wxTaskBarJumpListCategory::GetTitle() const
{ {
return m_title; return m_title;
} }
const wxJumpListItems& wxJumpListCategory::GetItems() const const wxTaskBarJumpListItems& wxTaskBarJumpListCategory::GetItems() const
{ {
return m_items; return m_items;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxJumpList Implementation. // wxTaskBarJumpList Implementation.
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxJumpList::wxJumpList() : m_jumpListImpl(new wxJumpListImpl()) wxTaskBarJumpList::wxTaskBarJumpList()
: m_jumpListImpl(new wxTaskBarJumpListImpl())
{ {
} }
wxJumpList::~wxJumpList() wxTaskBarJumpList::~wxTaskBarJumpList()
{ {
delete m_jumpListImpl; delete m_jumpListImpl;
} }
wxJumpListCategory* wxJumpList::GetTasks() wxTaskBarJumpListCategory& wxTaskBarJumpList::GetTasks() const
{ {
return m_jumpListImpl->GetTasks(); return m_jumpListImpl->GetTasks();
} }
void wxJumpList::ShowRecentCategory(bool shown) void wxTaskBarJumpList::ShowRecentCategory(bool shown)
{ {
m_jumpListImpl->ShowRecentCategory(shown); m_jumpListImpl->ShowRecentCategory(shown);
} }
void wxJumpList::HideRecentCategory() void wxTaskBarJumpList::HideRecentCategory()
{ {
m_jumpListImpl->HideRecentCategory(); m_jumpListImpl->HideRecentCategory();
} }
void wxJumpList::ShowFrequentCategory(bool shown) void wxTaskBarJumpList::ShowFrequentCategory(bool shown)
{ {
m_jumpListImpl->ShowFrequentCategory(shown); m_jumpListImpl->ShowFrequentCategory(shown);
} }
void wxJumpList::HideFrequentCategory() void wxTaskBarJumpList::HideFrequentCategory()
{ {
m_jumpListImpl->HideFrequentCategory(); m_jumpListImpl->HideFrequentCategory();
} }
const wxJumpListCategory* wxJumpList::GetFrequentCategory() const wxTaskBarJumpListCategory& wxTaskBarJumpList::GetFrequentCategory() const
{ {
return m_jumpListImpl->GetFrequentCategory(); return m_jumpListImpl->GetFrequentCategory();
} }
const wxJumpListCategory* wxJumpList::GetRecentCategory() const wxTaskBarJumpListCategory& wxTaskBarJumpList::GetRecentCategory() const
{ {
return m_jumpListImpl->GetRecentCategory(); return m_jumpListImpl->GetRecentCategory();
} }
const wxJumpListCategories& wxJumpList::GetCustomCategories() const wxTaskBarJumpListCategories&
wxTaskBarJumpList::GetCustomCategories() const
{ {
return m_jumpListImpl->GetCustomCategories(); return m_jumpListImpl->GetCustomCategories();
} }
void wxJumpList::AddCategory(wxJumpListCategory* category) void wxTaskBarJumpList::AddCategory(wxTaskBarJumpListCategory* category)
{ {
m_jumpListImpl->AddCategory(category); m_jumpListImpl->AddCategory(category);
} }
wxJumpListCategory* wxJumpList::RemoveCategory(const wxString& title) wxTaskBarJumpListCategory* wxTaskBarJumpList::RemoveCategory(
const wxString& title)
{ {
return m_jumpListImpl->RemoveCategory(title); return m_jumpListImpl->RemoveCategory(title);
} }
void wxJumpList::DeleteCategory(const wxString& title) void wxTaskBarJumpList::DeleteCategory(const wxString& title)
{ {
m_jumpListImpl->DeleteCategory(title); m_jumpListImpl->DeleteCategory(title);
} }
void wxJumpList::Update() void wxTaskBarJumpList::Update()
{ {
m_jumpListImpl->Update(); m_jumpListImpl->Update();
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxJumpListImpl Implementation. // wxTaskBarJumpListImpl Implementation.
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxJumpListImpl::wxJumpListImpl() : m_destinationList(NULL) wxTaskBarJumpListImpl::wxTaskBarJumpListImpl() : m_destinationList(NULL)
{ {
HRESULT hr = CoCreateInstance HRESULT hr = CoCreateInstance
( (
@ -1157,12 +1170,12 @@ wxJumpListImpl::wxJumpListImpl() : m_destinationList(NULL)
} }
} }
wxJumpListImpl::~wxJumpListImpl() wxTaskBarJumpListImpl::~wxTaskBarJumpListImpl()
{ {
if ( m_destinationList ) if ( m_destinationList )
m_destinationList->Release(); m_destinationList->Release();
for ( wxJumpListCategories::iterator it = m_customCategories.begin(); for ( wxTaskBarJumpListCategories::iterator it = m_customCategories.begin();
it != m_customCategories.end(); it != m_customCategories.end();
++it ) ++it )
{ {
@ -1170,7 +1183,7 @@ wxJumpListImpl::~wxJumpListImpl()
} }
} }
void wxJumpListImpl::Update() void wxTaskBarJumpListImpl::Update()
{ {
if ( !BeginUpdate() ) if ( !BeginUpdate() )
return; return;
@ -1184,65 +1197,69 @@ void wxJumpListImpl::Update()
CommitUpdate(); CommitUpdate();
} }
wxJumpListCategory* wxJumpListImpl::GetTasks() wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetTasks()
{ {
if ( m_tasks.get() == NULL ) if ( m_tasks.get() == NULL )
m_tasks.reset(new wxJumpListCategory(wxT("Tasks"))); m_tasks.reset(new wxTaskBarJumpListCategory(wxT("Tasks")));
return m_tasks.get(); return *(m_tasks.get());
} }
void wxJumpListImpl::ShowRecentCategory(bool shown) void wxTaskBarJumpListImpl::ShowRecentCategory(bool shown)
{ {
m_recent_visible = shown; m_recent_visible = shown;
} }
void wxJumpListImpl::HideRecentCategory() void wxTaskBarJumpListImpl::HideRecentCategory()
{ {
ShowRecentCategory(false); ShowRecentCategory(false);
} }
void wxJumpListImpl::ShowFrequentCategory(bool shown) void wxTaskBarJumpListImpl::ShowFrequentCategory(bool shown)
{ {
m_frequent_visible = shown; m_frequent_visible = shown;
} }
void wxJumpListImpl::HideFrequentCategory() void wxTaskBarJumpListImpl::HideFrequentCategory()
{ {
ShowFrequentCategory(false); ShowFrequentCategory(false);
} }
const wxJumpListCategory* wxJumpListImpl::GetFrequentCategory() const wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetFrequentCategory()
{ {
wxString title = wxT("Frequent"); wxString title = wxT("Frequent");
if ( m_frequent.get() == NULL ) if ( m_frequent.get() == NULL )
m_frequent.reset(new wxJumpListCategory(title)); m_frequent.reset(new wxTaskBarJumpListCategory(title));
LoadKnownCategory(title); LoadKnownCategory(title);
return m_frequent.get();
return *m_frequent.get();
} }
const wxJumpListCategory* wxJumpListImpl::GetRecentCategory() const wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetRecentCategory()
{ {
wxString title = wxT("Recent"); wxString title = wxT("Recent");
if ( m_recent.get() == NULL ) if ( m_recent.get() == NULL )
m_recent.reset(new wxJumpListCategory(title)); m_recent.reset(new wxTaskBarJumpListCategory(title));
LoadKnownCategory(title); LoadKnownCategory(title);
return m_recent.get();
return *m_recent.get();
} }
const wxJumpListCategories& wxJumpListImpl::GetCustomCategories() const wxTaskBarJumpListCategories&
wxTaskBarJumpListImpl::GetCustomCategories() const
{ {
return m_customCategories; return m_customCategories;
} }
void wxJumpListImpl::AddCategory(wxJumpListCategory *category) void wxTaskBarJumpListImpl::AddCategory(wxTaskBarJumpListCategory *category)
{ {
m_customCategories.push_back(category); m_customCategories.push_back(category);
} }
wxJumpListCategory* wxJumpListImpl::RemoveCategory(const wxString& title) wxTaskBarJumpListCategory*
wxTaskBarJumpListImpl::RemoveCategory(const wxString& title)
{ {
for ( wxJumpListCategories::iterator it = m_customCategories.begin(); for ( wxTaskBarJumpListCategories::iterator it = m_customCategories.begin();
it != m_customCategories.end(); it != m_customCategories.end();
++it ) ++it )
{ {
@ -1256,14 +1273,14 @@ wxJumpListCategory* wxJumpListImpl::RemoveCategory(const wxString& title)
return NULL; return NULL;
} }
void wxJumpListImpl::DeleteCategory(const wxString& title) void wxTaskBarJumpListImpl::DeleteCategory(const wxString& title)
{ {
wxJumpListCategory* category = RemoveCategory(title); wxTaskBarJumpListCategory* category = RemoveCategory(title);
if ( category ) if ( category )
delete category; delete category;
} }
bool wxJumpListImpl::BeginUpdate() bool wxTaskBarJumpListImpl::BeginUpdate()
{ {
if ( m_destinationList == NULL ) if ( m_destinationList == NULL )
return false; return false;
@ -1275,13 +1292,13 @@ bool wxJumpListImpl::BeginUpdate()
return SUCCEEDED(hr); return SUCCEEDED(hr);
} }
bool wxJumpListImpl::CommitUpdate() bool wxTaskBarJumpListImpl::CommitUpdate()
{ {
m_objectArray->Release(); m_objectArray->Release();
return SUCCEEDED(m_destinationList->CommitList()); return SUCCEEDED(m_destinationList->CommitList());
} }
void wxJumpListImpl::AddTasksToDestinationList() void wxTaskBarJumpListImpl::AddTasksToDestinationList()
{ {
if ( !m_tasks.get() ) if ( !m_tasks.get() )
return; return;
@ -1290,13 +1307,13 @@ void wxJumpListImpl::AddTasksToDestinationList()
if ( !collection ) if ( !collection )
return; return;
const wxJumpListItems& tasks = m_tasks->GetItems(); const wxTaskBarJumpListItems& tasks = m_tasks->GetItems();
for ( wxJumpListItems::const_iterator it = tasks.begin(); for ( wxTaskBarJumpListItems::const_iterator it = tasks.begin();
it != tasks.end(); it != tasks.end();
++it ) ++it )
{ {
wxASSERT_MSG( ((*it)->GetType() == wxJUMP_LIST_TASK || wxASSERT_MSG( ((*it)->GetType() == wxTASKBAR_JUMP_LIST_TASK ||
(*it)->GetType() == wxJUMP_LIST_SEPARATOR), (*it)->GetType() == wxTASKBAR_JUMP_LIST_SEPARATOR),
"Invalid task Item." ); "Invalid task Item." );
AddShellLink(collection, *(*it)); AddShellLink(collection, *(*it));
} }
@ -1304,32 +1321,33 @@ void wxJumpListImpl::AddTasksToDestinationList()
collection->Release(); collection->Release();
} }
void wxJumpListImpl::AddCustomCategoriesToDestionationList() void wxTaskBarJumpListImpl::AddCustomCategoriesToDestionationList()
{ {
for ( wxJumpListCategories::iterator iter = m_customCategories.begin(); for ( wxTaskBarJumpListCategories::iterator it = m_customCategories.begin();
iter != m_customCategories.end(); it != m_customCategories.end();
++iter ) ++it )
{ {
IObjectCollection* collection = CreateObjectCollection(); IObjectCollection* collection = CreateObjectCollection();
if ( !collection ) if ( !collection )
continue; continue;
const wxJumpListItems& tasks = (*iter)->GetItems(); const wxTaskBarJumpListItems& tasks = (*it)->GetItems();
for ( wxJumpListItems::const_iterator it = tasks.begin(); for ( wxTaskBarJumpListItems::const_iterator iter = tasks.begin();
it != tasks.end(); iter != tasks.end();
++it ) ++iter )
{ {
wxASSERT_MSG( (*it)->GetType() == wxJUMP_LIST_DESTIONATION, wxASSERT_MSG(
(*iter)->GetType() == wxTASKBAR_JUMP_LIST_DESTIONATION,
"Invalid category item." ); "Invalid category item." );
AddShellLink(collection, *(*it)); AddShellLink(collection, *(*iter));
} }
m_destinationList->AppendCategory((*iter)->GetTitle().wc_str(), m_destinationList->AppendCategory((*it)->GetTitle().wc_str(),
collection); collection);
collection->Release(); collection->Release();
} }
} }
void wxJumpListImpl::LoadKnownCategory(const wxString& title) void wxTaskBarJumpListImpl::LoadKnownCategory(const wxString& title)
{ {
IApplicationDocumentLists *docList = 0; IApplicationDocumentLists *docList = 0;
HRESULT hr = CoCreateInstance HRESULT hr = CoCreateInstance
@ -1376,7 +1394,7 @@ void wxJumpListImpl::LoadKnownCategory(const wxString& title)
IShellLink *shellLink = NULL; IShellLink *shellLink = NULL;
IShellItem *shellItem = NULL; IShellItem *shellItem = NULL;
wxJumpListItem* item = NULL; wxTaskBarJumpListItem* item = NULL;
if ( SUCCEEDED(collectionItem->QueryInterface( if ( SUCCEEDED(collectionItem->QueryInterface(
wxIID_IShellLink, reinterpret_cast<void**>(&shellLink))) ) wxIID_IShellLink, reinterpret_cast<void**>(&shellLink))) )