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:
@@ -69,7 +69,8 @@ private:
|
|||||||
class WXDLLIMPEXP_CORE wxTaskBarJumpListImpl
|
class WXDLLIMPEXP_CORE wxTaskBarJumpListImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxTaskBarJumpListImpl(const wxString& appID = wxEmptyString);
|
wxTaskBarJumpListImpl(wxTaskBarJumpList *jumpList = NULL,
|
||||||
|
const wxString& appID = wxEmptyString);
|
||||||
virtual ~wxTaskBarJumpListImpl();
|
virtual ~wxTaskBarJumpListImpl();
|
||||||
void ShowRecentCategory(bool shown = true);
|
void ShowRecentCategory(bool shown = true);
|
||||||
void HideRecentCategory();
|
void HideRecentCategory();
|
||||||
@@ -93,6 +94,8 @@ private:
|
|||||||
void AddCustomCategoriesToDestionationList();
|
void AddCustomCategoriesToDestionationList();
|
||||||
void LoadKnownCategory(const wxString& title);
|
void LoadKnownCategory(const wxString& title);
|
||||||
|
|
||||||
|
wxTaskBarJumpList *m_jumpList;
|
||||||
|
|
||||||
ICustomDestinationList *m_destinationList;
|
ICustomDestinationList *m_destinationList;
|
||||||
IObjectArray *m_objectArray;
|
IObjectArray *m_objectArray;
|
||||||
|
|
||||||
|
@@ -20,6 +20,8 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_FWD_CORE wxTaskBarButton;
|
class WXDLLIMPEXP_FWD_CORE wxTaskBarButton;
|
||||||
|
class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListCategory;
|
||||||
|
class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpList;
|
||||||
class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListImpl;
|
class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListImpl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,13 +153,14 @@ enum WXDLLIMPEXP_CORE wxTaskBarJumpListItemType
|
|||||||
class WXDLLIMPEXP_CORE wxTaskBarJumpListItem
|
class WXDLLIMPEXP_CORE wxTaskBarJumpListItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxTaskBarJumpListItem(wxTaskBarJumpListItemType type,
|
wxTaskBarJumpListItem(wxTaskBarJumpListCategory *parentCategory = NULL,
|
||||||
const wxString& title = wxEmptyString,
|
wxTaskBarJumpListItemType type = wxTASKBAR_JUMP_LIST_SEPARATOR,
|
||||||
const wxString& filePath = wxEmptyString,
|
const wxString& title = wxEmptyString,
|
||||||
const wxString& arguments = wxEmptyString,
|
const wxString& filePath = wxEmptyString,
|
||||||
const wxString& tooltip = wxEmptyString,
|
const wxString& arguments = wxEmptyString,
|
||||||
const wxString& iconPath = wxEmptyString,
|
const wxString& tooltip = wxEmptyString,
|
||||||
int iconIndex = 0);
|
const wxString& iconPath = wxEmptyString,
|
||||||
|
int iconIndex = 0);
|
||||||
|
|
||||||
wxTaskBarJumpListItemType GetType() const;
|
wxTaskBarJumpListItemType GetType() const;
|
||||||
void SetType(wxTaskBarJumpListItemType type);
|
void SetType(wxTaskBarJumpListItemType type);
|
||||||
@@ -173,8 +176,11 @@ public:
|
|||||||
void SetIconPath(const wxString& iconPath);
|
void SetIconPath(const wxString& iconPath);
|
||||||
int GetIconIndex() const;
|
int GetIconIndex() const;
|
||||||
void SetIconIndex(int iconIndex);
|
void SetIconIndex(int iconIndex);
|
||||||
|
wxTaskBarJumpListCategory* GetCategory() const;
|
||||||
|
void SetCategory(wxTaskBarJumpListCategory *category);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
wxTaskBarJumpListCategory *m_parentCategory;
|
||||||
wxTaskBarJumpListItemType m_type;
|
wxTaskBarJumpListItemType m_type;
|
||||||
wxString m_title;
|
wxString m_title;
|
||||||
wxString m_filePath;
|
wxString m_filePath;
|
||||||
@@ -189,7 +195,8 @@ typedef wxVector<wxTaskBarJumpListItem*> wxTaskBarJumpListItems;
|
|||||||
class WXDLLIMPEXP_CORE wxTaskBarJumpListCategory
|
class WXDLLIMPEXP_CORE wxTaskBarJumpListCategory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxTaskBarJumpListCategory(const wxString& title = wxEmptyString);
|
wxTaskBarJumpListCategory(wxTaskBarJumpList *parent = NULL,
|
||||||
|
const wxString& title = wxEmptyString);
|
||||||
virtual ~wxTaskBarJumpListCategory();
|
virtual ~wxTaskBarJumpListCategory();
|
||||||
|
|
||||||
wxTaskBarJumpListItem* Append(wxTaskBarJumpListItem *item);
|
wxTaskBarJumpListItem* Append(wxTaskBarJumpListItem *item);
|
||||||
@@ -203,6 +210,11 @@ public:
|
|||||||
const wxTaskBarJumpListItems& GetItems() const;
|
const wxTaskBarJumpListItems& GetItems() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class wxTaskBarJumpListItem;
|
||||||
|
|
||||||
|
void Update();
|
||||||
|
|
||||||
|
wxTaskBarJumpList *m_parent;
|
||||||
wxTaskBarJumpListItems m_items;
|
wxTaskBarJumpListItems m_items;
|
||||||
wxString m_title;
|
wxString m_title;
|
||||||
};
|
};
|
||||||
@@ -228,9 +240,11 @@ public:
|
|||||||
wxTaskBarJumpListCategory* RemoveCustomCategory(const wxString& title);
|
wxTaskBarJumpListCategory* RemoveCustomCategory(const wxString& title);
|
||||||
void DeleteCustomCategory(const wxString& title);
|
void DeleteCustomCategory(const wxString& title);
|
||||||
|
|
||||||
void Update();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class wxTaskBarJumpListCategory;
|
||||||
|
|
||||||
|
void Update();
|
||||||
wxTaskBarJumpListImpl *m_jumpListImpl;
|
wxTaskBarJumpListImpl *m_jumpListImpl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -399,6 +399,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
Constructs a jump list item.
|
Constructs a jump list item.
|
||||||
|
|
||||||
|
@param parentCategory
|
||||||
|
Category that the jump list item belongs to. Can be NULL if the item
|
||||||
|
is going to be added to the category later.
|
||||||
@param type
|
@param type
|
||||||
The type for this item.
|
The type for this item.
|
||||||
@param title
|
@param title
|
||||||
@@ -419,13 +422,14 @@ public:
|
|||||||
@param iconIndex
|
@param iconIndex
|
||||||
The index of the icon, which is specified by iconPath.
|
The index of the icon, which is specified by iconPath.
|
||||||
*/
|
*/
|
||||||
wxTaskBarJumpListItem(wxTaskBarJumpListItemType type,
|
wxTaskBarJumpListItem(wxTaskBarJumpListCategory *parentCategory = NULL,
|
||||||
const wxString& title = wxEmptyString,
|
wxTaskBarJumpListItemType type = wxTASKBAR_JUMP_LIST_SEPARATOR,
|
||||||
const wxString& filePath = wxEmptyString,
|
const wxString& title = wxEmptyString,
|
||||||
const wxString& arguments = wxEmptyString,
|
const wxString& filePath = wxEmptyString,
|
||||||
const wxString& tooltip = wxEmptyString,
|
const wxString& arguments = wxEmptyString,
|
||||||
const wxString& iconPath = wxEmptyString,
|
const wxString& tooltip = wxEmptyString,
|
||||||
int iconIndex = 0);
|
const wxString& iconPath = wxEmptyString,
|
||||||
|
int iconIndex = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the type of this item.
|
Returns the type of this item.
|
||||||
@@ -496,6 +500,17 @@ public:
|
|||||||
Sets the icon index of icon in this item.
|
Sets the icon index of icon in this item.
|
||||||
*/
|
*/
|
||||||
void SetIconIndex(int iconIndex);
|
void SetIconIndex(int iconIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the category this jump list item is in, or NULL if this jump
|
||||||
|
list item is not attached.
|
||||||
|
*/
|
||||||
|
wxTaskBarJumpListCategory* GetCategory() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the parent category which will contain this jump list item.
|
||||||
|
*/
|
||||||
|
void SetCategory(wxTaskBarJumpListCategory *category);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -523,17 +538,21 @@ public:
|
|||||||
/**
|
/**
|
||||||
Constructs the jump list category.
|
Constructs the jump list category.
|
||||||
|
|
||||||
|
@param parent
|
||||||
|
Jump list that the jump list category belongs to. Can be NULL if
|
||||||
|
the category is going to be added to the jump list later.
|
||||||
@param title
|
@param title
|
||||||
The title of the category.
|
The title of the category.
|
||||||
*/
|
*/
|
||||||
wxTaskBarJumpListCategory(const wxString& title = wxEmptyString);
|
wxTaskBarJumpListCategory(wxTaskBarJumpList *parent = NULL,
|
||||||
|
const wxString& title = wxEmptyString);
|
||||||
virtual ~wxTaskBarJumpListCategory();
|
virtual ~wxTaskBarJumpListCategory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Append a jump list item.
|
Append a jump list item.
|
||||||
|
|
||||||
@param item
|
@param item
|
||||||
The jump list item to be appended. It will be owned by the
|
The jump list item to be appended. It will be owned by the
|
||||||
wxTaskBarJumpListCategory object after this function is called, so
|
wxTaskBarJumpListCategory object after this function is called, so
|
||||||
do not delete it yourself.
|
do not delete it yourself.
|
||||||
|
|
||||||
@@ -619,6 +638,4 @@ public:
|
|||||||
void AddCustomCategory(wxTaskBarJumpListCategory* category);
|
void AddCustomCategory(wxTaskBarJumpListCategory* category);
|
||||||
wxTaskBarJumpListCategory* RemoveCustomCategory(const wxString& title);
|
wxTaskBarJumpListCategory* RemoveCustomCategory(const wxString& title);
|
||||||
void DeleteCustomCategory(const wxString& title);
|
void DeleteCustomCategory(const wxString& title);
|
||||||
|
|
||||||
void Update();
|
|
||||||
};
|
};
|
||||||
|
@@ -142,6 +142,7 @@ bool MyApp::OnInit()
|
|||||||
|
|
||||||
wxTaskBarJumpList jumpList;
|
wxTaskBarJumpList jumpList;
|
||||||
wxTaskBarJumpListItem *item1 = new wxTaskBarJumpListItem(
|
wxTaskBarJumpListItem *item1 = new wxTaskBarJumpListItem(
|
||||||
|
NULL,
|
||||||
wxTASKBAR_JUMP_LIST_TASK,
|
wxTASKBAR_JUMP_LIST_TASK,
|
||||||
wxT("Task 1"),
|
wxT("Task 1"),
|
||||||
wxStandardPaths::Get().GetExecutablePath(),
|
wxStandardPaths::Get().GetExecutablePath(),
|
||||||
@@ -150,6 +151,7 @@ bool MyApp::OnInit()
|
|||||||
wxStandardPaths::Get().GetExecutablePath(),
|
wxStandardPaths::Get().GetExecutablePath(),
|
||||||
0);
|
0);
|
||||||
wxTaskBarJumpListItem *item2 = new wxTaskBarJumpListItem(
|
wxTaskBarJumpListItem *item2 = new wxTaskBarJumpListItem(
|
||||||
|
NULL,
|
||||||
wxTASKBAR_JUMP_LIST_TASK,
|
wxTASKBAR_JUMP_LIST_TASK,
|
||||||
wxT("Task 2"),
|
wxT("Task 2"),
|
||||||
wxStandardPaths::Get().GetExecutablePath(),
|
wxStandardPaths::Get().GetExecutablePath(),
|
||||||
@@ -159,12 +161,15 @@ bool MyApp::OnInit()
|
|||||||
0);
|
0);
|
||||||
jumpList.GetTasks().Append(item1);
|
jumpList.GetTasks().Append(item1);
|
||||||
jumpList.GetTasks().Append(
|
jumpList.GetTasks().Append(
|
||||||
new wxTaskBarJumpListItem(wxTASKBAR_JUMP_LIST_SEPARATOR));
|
new wxTaskBarJumpListItem(NULL, wxTASKBAR_JUMP_LIST_SEPARATOR));
|
||||||
jumpList.GetTasks().Append(item2);
|
jumpList.GetTasks().Append(item2);
|
||||||
jumpList.ShowRecentCategory();
|
jumpList.ShowRecentCategory();
|
||||||
jumpList.ShowFrequentCategory();
|
jumpList.ShowFrequentCategory();
|
||||||
|
|
||||||
|
wxTaskBarJumpListCategory* customCategory =
|
||||||
|
new wxTaskBarJumpListCategory(&jumpList, wxT("Custom"));
|
||||||
wxTaskBarJumpListItem* item3 = new wxTaskBarJumpListItem(
|
wxTaskBarJumpListItem* item3 = new wxTaskBarJumpListItem(
|
||||||
|
customCategory,
|
||||||
wxTASKBAR_JUMP_LIST_DESTIONATION,
|
wxTASKBAR_JUMP_LIST_DESTIONATION,
|
||||||
wxT("Help"),
|
wxT("Help"),
|
||||||
wxStandardPaths::Get().GetExecutablePath(),
|
wxStandardPaths::Get().GetExecutablePath(),
|
||||||
@@ -172,13 +177,9 @@ bool MyApp::OnInit()
|
|||||||
wxT("wxTaskBarButton help."),
|
wxT("wxTaskBarButton help."),
|
||||||
wxStandardPaths::Get().GetExecutablePath(),
|
wxStandardPaths::Get().GetExecutablePath(),
|
||||||
0);
|
0);
|
||||||
wxTaskBarJumpListCategory* customCategory =
|
|
||||||
new wxTaskBarJumpListCategory(wxT("Custom"));
|
|
||||||
customCategory->Append(item3);
|
customCategory->Append(item3);
|
||||||
jumpList.AddCustomCategory(customCategory);
|
jumpList.AddCustomCategory(customCategory);
|
||||||
|
|
||||||
jumpList.Update();
|
|
||||||
|
|
||||||
const wxTaskBarJumpListCategory& frequentCategory =
|
const wxTaskBarJumpListCategory& frequentCategory =
|
||||||
jumpList.GetFrequentCategory();
|
jumpList.GetFrequentCategory();
|
||||||
const wxTaskBarJumpListItems& frequentItems = frequentCategory.GetItems();
|
const wxTaskBarJumpListItems& frequentItems = frequentCategory.GetItems();
|
||||||
|
@@ -435,7 +435,7 @@ wxTaskBarJumpListItem* GetItemFromIShellLink(IShellLink* link)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
wxTaskBarJumpListItem* item =
|
wxTaskBarJumpListItem* item =
|
||||||
new wxTaskBarJumpListItem(wxTASKBAR_JUMP_LIST_DESTIONATION);
|
new wxTaskBarJumpListItem(NULL, wxTASKBAR_JUMP_LIST_DESTIONATION);
|
||||||
|
|
||||||
IPropertyStore *linkProps;
|
IPropertyStore *linkProps;
|
||||||
HRESULT hr = link->QueryInterface
|
HRESULT hr = link->QueryInterface
|
||||||
@@ -477,7 +477,7 @@ wxTaskBarJumpListItem* GetItemFromIShellItem(IShellItem *shellItem)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
wxTaskBarJumpListItem *item =
|
wxTaskBarJumpListItem *item =
|
||||||
new wxTaskBarJumpListItem(wxTASKBAR_JUMP_LIST_DESTIONATION);
|
new wxTaskBarJumpListItem(NULL, wxTASKBAR_JUMP_LIST_DESTIONATION);
|
||||||
|
|
||||||
wchar_t *name;
|
wchar_t *name;
|
||||||
shellItem->GetDisplayName(SIGDN_FILESYSPATH, &name);
|
shellItem->GetDisplayName(SIGDN_FILESYSPATH, &name);
|
||||||
@@ -902,14 +902,16 @@ void wxAppProgressIndicator::Init()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxTaskBarJumpListItem Implementation.
|
// wxTaskBarJumpListItem Implementation.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
wxTaskBarJumpListItem::wxTaskBarJumpListItem(wxTaskBarJumpListItemType type,
|
wxTaskBarJumpListItem::wxTaskBarJumpListItem(wxTaskBarJumpListCategory *parent,
|
||||||
|
wxTaskBarJumpListItemType type,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxString& filePath,
|
const wxString& filePath,
|
||||||
const wxString& arguments,
|
const wxString& arguments,
|
||||||
const wxString& tooltip,
|
const wxString& tooltip,
|
||||||
const wxString& iconPath,
|
const wxString& iconPath,
|
||||||
int iconIndex)
|
int iconIndex)
|
||||||
: m_type(type),
|
: m_parentCategory(parent),
|
||||||
|
m_type(type),
|
||||||
m_title(title),
|
m_title(title),
|
||||||
m_filePath(filePath),
|
m_filePath(filePath),
|
||||||
m_arguments(arguments),
|
m_arguments(arguments),
|
||||||
@@ -927,6 +929,8 @@ wxTaskBarJumpListItemType wxTaskBarJumpListItem::GetType() const
|
|||||||
void wxTaskBarJumpListItem::SetType(wxTaskBarJumpListItemType type)
|
void wxTaskBarJumpListItem::SetType(wxTaskBarJumpListItemType type)
|
||||||
{
|
{
|
||||||
m_type = type;
|
m_type = type;
|
||||||
|
if ( m_parentCategory )
|
||||||
|
m_parentCategory->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString& wxTaskBarJumpListItem::GetTitle() const
|
const wxString& wxTaskBarJumpListItem::GetTitle() const
|
||||||
@@ -937,6 +941,8 @@ const wxString& wxTaskBarJumpListItem::GetTitle() const
|
|||||||
void wxTaskBarJumpListItem::SetTitle(const wxString& title)
|
void wxTaskBarJumpListItem::SetTitle(const wxString& title)
|
||||||
{
|
{
|
||||||
m_title = title;
|
m_title = title;
|
||||||
|
if ( m_parentCategory )
|
||||||
|
m_parentCategory->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString& wxTaskBarJumpListItem::GetFilePath() const
|
const wxString& wxTaskBarJumpListItem::GetFilePath() const
|
||||||
@@ -947,6 +953,8 @@ const wxString& wxTaskBarJumpListItem::GetFilePath() const
|
|||||||
void wxTaskBarJumpListItem::SetFilePath(const wxString& filePath)
|
void wxTaskBarJumpListItem::SetFilePath(const wxString& filePath)
|
||||||
{
|
{
|
||||||
m_filePath = filePath;
|
m_filePath = filePath;
|
||||||
|
if ( m_parentCategory )
|
||||||
|
m_parentCategory->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString& wxTaskBarJumpListItem::GetArguments() const
|
const wxString& wxTaskBarJumpListItem::GetArguments() const
|
||||||
@@ -957,6 +965,8 @@ const wxString& wxTaskBarJumpListItem::GetArguments() const
|
|||||||
void wxTaskBarJumpListItem::SetArguments(const wxString& arguments)
|
void wxTaskBarJumpListItem::SetArguments(const wxString& arguments)
|
||||||
{
|
{
|
||||||
m_arguments = arguments;
|
m_arguments = arguments;
|
||||||
|
if ( m_parentCategory )
|
||||||
|
m_parentCategory->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString& wxTaskBarJumpListItem::GetTooltip() const
|
const wxString& wxTaskBarJumpListItem::GetTooltip() const
|
||||||
@@ -967,6 +977,8 @@ const wxString& wxTaskBarJumpListItem::GetTooltip() const
|
|||||||
void wxTaskBarJumpListItem::SetTooltip(const wxString& tooltip)
|
void wxTaskBarJumpListItem::SetTooltip(const wxString& tooltip)
|
||||||
{
|
{
|
||||||
m_tooltip = tooltip;
|
m_tooltip = tooltip;
|
||||||
|
if ( m_parentCategory )
|
||||||
|
m_parentCategory->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString& wxTaskBarJumpListItem::GetIconPath() const
|
const wxString& wxTaskBarJumpListItem::GetIconPath() const
|
||||||
@@ -977,6 +989,8 @@ const wxString& wxTaskBarJumpListItem::GetIconPath() const
|
|||||||
void wxTaskBarJumpListItem::SetIconPath(const wxString& iconPath)
|
void wxTaskBarJumpListItem::SetIconPath(const wxString& iconPath)
|
||||||
{
|
{
|
||||||
m_iconPath = iconPath;
|
m_iconPath = iconPath;
|
||||||
|
if ( m_parentCategory )
|
||||||
|
m_parentCategory->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxTaskBarJumpListItem::GetIconIndex() const
|
int wxTaskBarJumpListItem::GetIconIndex() const
|
||||||
@@ -987,13 +1001,27 @@ int wxTaskBarJumpListItem::GetIconIndex() const
|
|||||||
void wxTaskBarJumpListItem::SetIconIndex(int iconIndex)
|
void wxTaskBarJumpListItem::SetIconIndex(int iconIndex)
|
||||||
{
|
{
|
||||||
m_iconIndex = iconIndex;
|
m_iconIndex = iconIndex;
|
||||||
|
if ( m_parentCategory )
|
||||||
|
m_parentCategory->Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxTaskBarJumpListCategory* wxTaskBarJumpListItem::GetCategory() const
|
||||||
|
{
|
||||||
|
return m_parentCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxTaskBarJumpListItem::SetCategory(wxTaskBarJumpListCategory *category)
|
||||||
|
{
|
||||||
|
m_parentCategory = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxTaskBarJumpListCategory Implementation.
|
// wxTaskBarJumpListCategory Implementation.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
wxTaskBarJumpListCategory::wxTaskBarJumpListCategory(const wxString& title)
|
wxTaskBarJumpListCategory::wxTaskBarJumpListCategory(wxTaskBarJumpList *parent,
|
||||||
: m_title(title)
|
const wxString& title)
|
||||||
|
: m_parent(parent),
|
||||||
|
m_title(title)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1011,12 +1039,18 @@ wxTaskBarJumpListItem*
|
|||||||
wxTaskBarJumpListCategory::Append(wxTaskBarJumpListItem *item)
|
wxTaskBarJumpListCategory::Append(wxTaskBarJumpListItem *item)
|
||||||
{
|
{
|
||||||
m_items.push_back(item);
|
m_items.push_back(item);
|
||||||
|
item->SetCategory(this);
|
||||||
|
Update();
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTaskBarJumpListCategory::Delete(wxTaskBarJumpListItem *item)
|
void wxTaskBarJumpListCategory::Delete(wxTaskBarJumpListItem *item)
|
||||||
{
|
{
|
||||||
item = Remove(item);
|
item = Remove(item);
|
||||||
|
item->SetCategory(NULL);
|
||||||
|
Update();
|
||||||
|
|
||||||
if ( item )
|
if ( item )
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
@@ -1031,6 +1065,8 @@ wxTaskBarJumpListCategory::Remove(wxTaskBarJumpListItem *item)
|
|||||||
if ( *it == item )
|
if ( *it == item )
|
||||||
{
|
{
|
||||||
m_items.erase(it);
|
m_items.erase(it);
|
||||||
|
item->SetCategory(NULL);
|
||||||
|
Update();
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1050,6 +1086,9 @@ 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);
|
||||||
|
item->SetCategory(this);
|
||||||
|
Update();
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1062,6 +1101,7 @@ wxTaskBarJumpListCategory::Prepend(wxTaskBarJumpListItem *item)
|
|||||||
void wxTaskBarJumpListCategory::SetTitle(const wxString& title)
|
void wxTaskBarJumpListCategory::SetTitle(const wxString& title)
|
||||||
{
|
{
|
||||||
m_title = title;
|
m_title = title;
|
||||||
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString& wxTaskBarJumpListCategory::GetTitle() const
|
const wxString& wxTaskBarJumpListCategory::GetTitle() const
|
||||||
@@ -1074,11 +1114,17 @@ const wxTaskBarJumpListItems& wxTaskBarJumpListCategory::GetItems() const
|
|||||||
return m_items;
|
return m_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxTaskBarJumpListCategory::Update()
|
||||||
|
{
|
||||||
|
if ( m_parent )
|
||||||
|
m_parent->Update();
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxTaskBarJumpList Implementation.
|
// wxTaskBarJumpList Implementation.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
wxTaskBarJumpList::wxTaskBarJumpList(const wxString& appID)
|
wxTaskBarJumpList::wxTaskBarJumpList(const wxString& appID)
|
||||||
: m_jumpListImpl(new wxTaskBarJumpListImpl(appID))
|
: m_jumpListImpl(new wxTaskBarJumpListImpl(this, appID))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1152,8 +1198,10 @@ void wxTaskBarJumpList::Update()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxTaskBarJumpListImpl Implementation.
|
// wxTaskBarJumpListImpl Implementation.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
wxTaskBarJumpListImpl::wxTaskBarJumpListImpl(const wxString& appID)
|
wxTaskBarJumpListImpl::wxTaskBarJumpListImpl(wxTaskBarJumpList *jumpList,
|
||||||
: m_appID(appID),
|
const wxString& appID)
|
||||||
|
: m_jumpList(jumpList),
|
||||||
|
m_appID(appID),
|
||||||
m_destinationList(NULL)
|
m_destinationList(NULL)
|
||||||
{
|
{
|
||||||
HRESULT hr = CoCreateInstance
|
HRESULT hr = CoCreateInstance
|
||||||
@@ -1201,7 +1249,7 @@ void wxTaskBarJumpListImpl::Update()
|
|||||||
wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetTasks()
|
wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetTasks()
|
||||||
{
|
{
|
||||||
if ( m_tasks.get() == NULL )
|
if ( m_tasks.get() == NULL )
|
||||||
m_tasks.reset(new wxTaskBarJumpListCategory(wxT("Tasks")));
|
m_tasks.reset(new wxTaskBarJumpListCategory(m_jumpList, wxT("Tasks")));
|
||||||
|
|
||||||
return *(m_tasks.get());
|
return *(m_tasks.get());
|
||||||
}
|
}
|
||||||
@@ -1230,7 +1278,7 @@ 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 wxTaskBarJumpListCategory(title));
|
m_frequent.reset(new wxTaskBarJumpListCategory(m_jumpList, title));
|
||||||
LoadKnownCategory(title);
|
LoadKnownCategory(title);
|
||||||
|
|
||||||
return *m_frequent.get();
|
return *m_frequent.get();
|
||||||
@@ -1240,7 +1288,7 @@ 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 wxTaskBarJumpListCategory(title));
|
m_recent.reset(new wxTaskBarJumpListCategory(m_jumpList, title));
|
||||||
LoadKnownCategory(title);
|
LoadKnownCategory(title);
|
||||||
|
|
||||||
return *m_recent.get();
|
return *m_recent.get();
|
||||||
|
Reference in New Issue
Block a user