Work around the limitation of windows API when setting thumbnail toolbar buttons.

- New API: InsertThumbBarButton, AppendThumbBarButton, RemoveThumbBarButton.
- Though MSDN said that "Buttons cannot be added or deleted later, so this must
  be the full defined set. Buttons also cannot be reordered.", we can work
  around it by: when first time adding button, initialize all of the possible
  seven buttons and hide them, except the button adding. In the next time adding
  button, just show it, which can make it looks like it is added on the fly.

Author: Chaobin Zhang

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2014-09-10 14:51:29 +00:00
parent a7145e561d
commit 1580848eeb
5 changed files with 186 additions and 47 deletions

View File

@@ -32,13 +32,19 @@ public:
const wxString& description = wxString()) wxOVERRIDE;
virtual void SetThumbnailClip(const wxRect& rect) wxOVERRIDE;
virtual void SetThumbnailContents(const wxWindow *child) wxOVERRIDE;
virtual bool AddThumbBarButton(wxThumbBarButton *button) wxOVERRIDE;
virtual void ShowThumbnailToolbar() wxOVERRIDE;
virtual bool InsertThumbBarButton(size_t pos,
wxThumbBarButton *button) wxOVERRIDE;
virtual bool AppendThumbBarButton(wxThumbBarButton *button) wxOVERRIDE;
virtual bool RemoveThumbBarButton(wxThumbBarButton *button) wxOVERRIDE;
virtual bool RemoveThumbBarButton(int id) wxOVERRIDE;
private:
friend class wxFrame;
wxTaskBarButtonImpl(WXWidget parent);
bool InitOrUpdateThumbBarButtons();
int GetThumbBarButtonID(size_t index);
WXWidget m_hwnd;
ITaskbarList3 *m_taskbarList;
@@ -46,8 +52,7 @@ private:
wxThumbBarButtons m_thumbBarButtons;
int m_progressRange;
bool m_hasShownThumbnailToolbar;
bool m_hasInitThumbnailToolbar;
};
#endif // wxUSE_TASKBARBUTTON