Introduce skeleton of taskbar button feature.

- Add classes: wxTaskBarButton and wxTaskBarButtonImpl.
- New interface in wxTopLevelWindowMSW to get its wxTaskBarButton:
    MSWGetTaskBarButton.
- A simple sample and build files under msvc.

Author: Chaobin Zhang

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77591 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2014-09-10 14:49:33 +00:00
parent 93d5b8bb0d
commit 076747aa81
8 changed files with 410 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////
// 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"
struct ITaskbarList3;
class wxTaskBarButtonImpl : public wxTaskBarButton {
public:
virtual ~wxTaskBarButtonImpl();
virtual void SetProgressValue(int value) wxOVERRIDE;
private:
friend class wxTopLevelWindowMSW;
wxTaskBarButtonImpl(WXWidget parent);
WXWidget m_hwnd;
ITaskbarList3 *m_taskbarList;
};
#endif // wxUSE_TASKBARBUTTON
#endif // _WX_MSW_TASKBARBUTTON_H_

View File

@@ -11,6 +11,8 @@
#ifndef _WX_MSW_TOPLEVEL_H_
#define _WX_MSW_TOPLEVEL_H_
class WXDLLIMPEXP_FWD_ADV wxTaskBarButton;
// ----------------------------------------------------------------------------
// wxTopLevelWindowMSW
// ----------------------------------------------------------------------------
@@ -121,6 +123,31 @@ public:
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const { return false; }
#if wxUSE_MENUS && !defined(__WXUNIVERSAL__)
bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
// handle WM_EXITMENULOOP message for Win95 only
bool HandleExitMenuLoop(WXWORD isPopup);
// handle WM_(UN)INITMENUPOPUP message to generate wxEVT_MENU_OPEN/CLOSE
bool HandleMenuPopup(wxEventType evtType, WXHMENU hMenu);
// Command part of HandleMenuPopup() and HandleExitMenuLoop().
bool DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu, bool popup);
// Find the menu corresponding to the given handle.
virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu);
#endif // wxUSE_MENUS && !__WXUNIVERSAL__
#if wxUSE_TASKBARBUTTON
// Return the taskbar button of the window.
//
// The pointer returned by this method belongs to the window and will be
// deleted when the window itself is, do not delete it yourself. May return
// NULL if the initialization of taskbar button failed.
wxTaskBarButton* MSWGetTaskBarButton();
#endif // wxUSE_TASKBARBUTTON
protected:
// common part of all ctors
void Init();
@@ -235,6 +262,14 @@ private:
// MSWGetSystemMenu(). Owned by this window.
wxMenu *m_menuSystem;
// The number of currently opened menus: 0 initially, 1 when a top level
// menu is opened, 2 when its submenu is opened and so on.
int m_menuDepth;
#if wxUSE_TASKBARBUTTON
wxTaskBarButton *m_taskBarButton;
#endif
DECLARE_EVENT_TABLE()
wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW);
};

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////
// Name: include/taskbarbutton.h
// Purpose: Defines wxTaskBarButton class for manipulating buttons on the
// windows taskbar.
// Author: Chaobin Zhang <zhchbin@gmail.com>
// Created: 2014-04-30
// Copyright: (c) 2014 wxWidgets development team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TASKBARBUTTON_H_
#define _WX_TASKBARBUTTON_H_
#if wxUSE_TASKBARBUTTON
// ----------------------------------------------------------------------------
// wxTaskBarButton: define wxTaskBarButton interface.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxTaskBarButton
{
public:
wxTaskBarButton() { }
virtual ~wxTaskBarButton() { }
// Operations:
virtual void SetProgressValue(int value) = 0;
private:
wxDECLARE_NO_COPY_CLASS(wxTaskBarButton);
};
#if defined(__WXMSW__)
#include "wx/msw/taskbarbutton.h"
#endif
#endif // wxUSE_TASKBARBUTTON
#endif // _WX_TASKBARBUTTON_H_