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

View File

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

View File

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

View File

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