APIs for adding a thumbnail toolbar with a specified set of buttons.

- AddThumbBarButton(wxThumbBarButton *button), ShowThumbnailToolbar().
- Add THBN_CLICKED message handler to top level window and generate a
  wxCommandEvent event.
- Sample.

Author: Chaobin Zhang

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77594 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2014-09-10 14:50:08 +00:00
parent 5f54995d63
commit 2fdf84c7e7
7 changed files with 179 additions and 4 deletions

View File

@@ -13,6 +13,7 @@
#if wxUSE_TASKBARBUTTON
#include "wx/defs.h"
#include "wx/vector.h"
struct ITaskbarList3;
@@ -27,6 +28,8 @@ public:
virtual void SetProgressState(wxTaskBarButtonState state) wxOVERRIDE;
virtual void SetOverlayIcon(const wxIcon& icon) wxOVERRIDE;
virtual void SetThumbnailClip(const wxRect& rect) wxOVERRIDE;
virtual bool AddThumbBarButton(wxThumbBarButton *button) wxOVERRIDE;
virtual void ShowThumbnailToolbar() wxOVERRIDE;
private:
friend class wxTopLevelWindowMSW;
@@ -34,6 +37,11 @@ private:
WXWidget m_hwnd;
ITaskbarList3 *m_taskbarList;
typedef wxVector<wxThumbBarButton*> wxThumbBarButtons;
wxThumbBarButtons m_thumbBarButtons;
bool m_hasShownThumbnailToolbar;
};
#endif // wxUSE_TASKBARBUTTON

View File

@@ -146,6 +146,8 @@ public:
// deleted when the window itself is, do not delete it yourself. May return
// NULL if the initialization of taskbar button failed.
wxTaskBarButton* MSWGetTaskBarButton();
bool HandleTHBNClickedCommand(WXWORD id);
#endif // wxUSE_TASKBARBUTTON
protected:

View File

@@ -29,6 +29,24 @@ enum wxTaskBarButtonState
wxTASKBAR_BUTTON_PAUSED = 8
};
class WXDLLIMPEXP_ADV wxThumbBarButton {
public:
wxThumbBarButton(int id,
const wxIcon& icon,
const wxString& tooltip = wxEmptyString);
virtual ~wxThumbBarButton() {}
int GetID() const { return m_id; }
const wxIcon& GetIcon() const { return m_icon; }
const wxString& GetTooltip() const { return m_tooltip; }
private:
int m_id;
wxIcon m_icon;
wxString m_tooltip;
};
class WXDLLIMPEXP_ADV wxTaskBarButton
{
public:
@@ -44,6 +62,16 @@ public:
virtual void SetOverlayIcon(const wxIcon& icon) = 0;
virtual void SetThumbnailClip(const wxRect& rect) = 0;
/**
Adds a thumbnail toolbar button to the thumbnail image of a window in
the taskbar button flyout. Note that a wxTaskbarButton can only have no
more than seven wxThumbBarButtons, and ShowThumbnailToolbar should be
called to show them, then these buttons cannot be added or removed until
the window is re-created.
*/
virtual bool AddThumbBarButton(wxThumbBarButton *button) = 0;
virtual void ShowThumbnailToolbar() = 0;
private:
wxDECLARE_NO_COPY_CLASS(wxTaskBarButton);
};