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
116 lines
3.9 KiB
C++
116 lines
3.9 KiB
C++
/////////////////////////////////////////////////////////////////////////////
|
|
// Name: include/wx/msw/taskbarbutton.h
|
|
// Purpose: Defines wxTaskBarButtonImpl class.
|
|
// Author: Chaobin Zhang <zhchbin@gmail.com>
|
|
// Created: 2014-06-01
|
|
// Copyright: (c) 2014 wxWidgets development team
|
|
// Licence: wxWindows licence
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef _WX_MSW_TASKBARBUTTON_H_
|
|
#define _WX_MSW_TASKBARBUTTON_H_
|
|
|
|
#if wxUSE_TASKBARBUTTON
|
|
|
|
#include "wx/defs.h"
|
|
#include "wx/vector.h"
|
|
#include "wx/taskbarbutton.h"
|
|
|
|
namespace {
|
|
class WXDLLIMPEXP_FWD_CORE ITaskbarList3;
|
|
class WXDLLIMPEXP_FWD_CORE IObjectArray;
|
|
class WXDLLIMPEXP_FWD_CORE ICustomDestinationList;
|
|
class WXDLLIMPEXP_FWD_CORE IApplicationDocumentLists;
|
|
}
|
|
|
|
class WXDLLIMPEXP_CORE wxTaskBarButtonImpl : public wxTaskBarButton {
|
|
public:
|
|
virtual ~wxTaskBarButtonImpl();
|
|
|
|
virtual void SetProgressRange(int range) wxOVERRIDE;
|
|
virtual void SetProgressValue(int value) wxOVERRIDE;
|
|
virtual void PulseProgress() wxOVERRIDE;
|
|
virtual void Show(bool show = true) wxOVERRIDE;
|
|
virtual void Hide() wxOVERRIDE;
|
|
virtual void SetThumbnailTooltip(const wxString& tooltip) wxOVERRIDE;
|
|
virtual void SetProgressState(wxTaskBarButtonState state) wxOVERRIDE;
|
|
virtual void SetOverlayIcon(const wxIcon& icon,
|
|
const wxString& description = wxString()) wxOVERRIDE;
|
|
virtual void SetThumbnailClip(const wxRect& rect) wxOVERRIDE;
|
|
virtual void SetThumbnailContents(const wxWindow *child) wxOVERRIDE;
|
|
virtual bool InsertThumbBarButton(size_t pos,
|
|
wxThumbBarButton *button) wxOVERRIDE;
|
|
virtual bool AppendThumbBarButton(wxThumbBarButton *button) wxOVERRIDE;
|
|
virtual bool AppendSeparatorInThumbBar() wxOVERRIDE;
|
|
virtual wxThumbBarButton* RemoveThumbBarButton(
|
|
wxThumbBarButton *button) wxOVERRIDE;
|
|
virtual wxThumbBarButton* RemoveThumbBarButton(int id) wxOVERRIDE;
|
|
|
|
private:
|
|
friend class wxFrame;
|
|
friend class wxThumbBarButton;
|
|
friend class wxAppProgressIndicator;
|
|
|
|
wxTaskBarButtonImpl(WXWidget parent);
|
|
|
|
bool InitOrUpdateThumbBarButtons();
|
|
wxThumbBarButton* GetThumbBarButtonByIndex(size_t index);
|
|
|
|
WXWidget m_hwnd;
|
|
ITaskbarList3 *m_taskbarList;
|
|
|
|
typedef wxVector<wxThumbBarButton*> wxThumbBarButtons;
|
|
wxThumbBarButtons m_thumbBarButtons;
|
|
|
|
int m_progressRange;
|
|
bool m_hasInitThumbnailToolbar;
|
|
};
|
|
|
|
class WXDLLIMPEXP_CORE wxTaskBarJumpListImpl
|
|
{
|
|
public:
|
|
wxTaskBarJumpListImpl(wxTaskBarJumpList *jumpList = NULL,
|
|
const wxString& appID = wxEmptyString);
|
|
virtual ~wxTaskBarJumpListImpl();
|
|
void ShowRecentCategory(bool shown = true);
|
|
void HideRecentCategory();
|
|
void ShowFrequentCategory(bool shown = true);
|
|
void HideFrequentCategory();
|
|
|
|
wxTaskBarJumpListCategory& GetTasks();
|
|
const wxTaskBarJumpListCategory& GetFrequentCategory();
|
|
const wxTaskBarJumpListCategory& GetRecentCategory();
|
|
const wxTaskBarJumpListCategories& GetCustomCategories() const;
|
|
|
|
void AddCustomCategory(wxTaskBarJumpListCategory* category);
|
|
wxTaskBarJumpListCategory* RemoveCustomCategory(const wxString& title);
|
|
void DeleteCustomCategory(const wxString& title);
|
|
void Update();
|
|
|
|
private:
|
|
bool BeginUpdate();
|
|
bool CommitUpdate();
|
|
void AddTasksToDestinationList();
|
|
void AddCustomCategoriesToDestionationList();
|
|
void LoadKnownCategory(const wxString& title);
|
|
|
|
wxTaskBarJumpList *m_jumpList;
|
|
|
|
ICustomDestinationList *m_destinationList;
|
|
IObjectArray *m_objectArray;
|
|
|
|
wxScopedPtr<wxTaskBarJumpListCategory> m_tasks;
|
|
wxScopedPtr<wxTaskBarJumpListCategory> m_frequent;
|
|
wxScopedPtr<wxTaskBarJumpListCategory> m_recent;
|
|
wxTaskBarJumpListCategories m_customCategories;
|
|
bool m_recent_visible;
|
|
bool m_frequent_visible;
|
|
|
|
// Application User Model ID.
|
|
wxString m_appID;
|
|
};
|
|
|
|
#endif // wxUSE_TASKBARBUTTON
|
|
|
|
#endif // _WX_MSW_TASKBARBUTTON_H_
|