#pragma interface "taskbar.h"
#endif
+#include <wx/event.h>
#include <wx/list.h>
#include <wx/icon.h>
-class wxTaskBarIcon: public wxObject
-{
+class wxTaskBarIcon: public wxEvtHandler {
+ DECLARE_DYNAMIC_CLASS(wxTaskBarIcon)
public:
- wxTaskBarIcon(void);
- virtual ~wxTaskBarIcon(void);
+ wxTaskBarIcon(void);
+ virtual ~wxTaskBarIcon(void);
// Accessors
inline WXHWND GetHWND() const { return m_hWnd; }
bool RemoveIcon(void);
// Overridables
- virtual void OnMouseMove(void);
- virtual void OnLButtonDown(void);
- virtual void OnLButtonUp(void);
- virtual void OnRButtonDown(void);
- virtual void OnRButtonUp(void);
- virtual void OnLButtonDClick(void);
- virtual void OnRButtonDClick(void);
+ virtual void OnMouseMove(wxEvent&);
+ virtual void OnLButtonDown(wxEvent&);
+ virtual void OnLButtonUp(wxEvent&);
+ virtual void OnRButtonDown(wxEvent&);
+ virtual void OnRButtonUp(wxEvent&);
+ virtual void OnLButtonDClick(wxEvent&);
+ virtual void OnRButtonDClick(wxEvent&);
// Implementation
static wxTaskBarIcon* FindObjectForHWND(WXHWND hWnd);
static wxList sm_taskBarIcons;
static bool sm_registeredClass;
static unsigned int sm_taskbarMsg;
+
+ DECLARE_EVENT_TABLE();
};
+
+
+const wxEventType wxEVT_TASKBAR_MOVE = wxEVT_FIRST + 1550;
+const wxEventType wxEVT_TASKBAR_LEFT_DOWN = wxEVT_FIRST + 1551;
+const wxEventType wxEVT_TASKBAR_LEFT_UP = wxEVT_FIRST + 1552;
+const wxEventType wxEVT_TASKBAR_RIGHT_DOWN = wxEVT_FIRST + 1553;
+const wxEventType wxEVT_TASKBAR_RIGHT_UP = wxEVT_FIRST + 1554;
+const wxEventType wxEVT_TASKBAR_LEFT_DCLICK = wxEVT_FIRST + 1555;
+const wxEventType wxEVT_TASKBAR_RIGHT_DCLICK = wxEVT_FIRST + 1556;
+
+
+#define EVT_TASKBAR_MOVE(fn) { wxEVT_TASKBAR_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
+#define EVT_TASKBAR_LEFT_DOWN(fn) { wxEVT_TASKBAR_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
+#define EVT_TASKBAR_LEFT_UP(fn) { wxEVT_TASKBAR_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
+#define EVT_TASKBAR_RIGHT_DOWN(fn) { wxEVT_TASKBAR_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
+#define EVT_TASKBAR_RIGHT_UP(fn) { wxEVT_TASKBAR_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
+#define EVT_TASKBAR_LEFT_DCLICK(fn) { wxEVT_TASKBAR_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
+#define EVT_TASKBAR_RIGHT_DCLICK(fn) { wxEVT_TASKBAR_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
+
#endif
// _TASKBAR_H_
+
+
+
+
bool wxTaskBarIcon::sm_registeredClass = FALSE;
UINT wxTaskBarIcon::sm_taskbarMsg = 0;
+
+#if !USE_SHARED_LIBRARY
+BEGIN_EVENT_TABLE(wxTaskBarIcon, wxEvtHandler)
+ EVT_TASKBAR_MOVE (wxTaskBarIcon::OnMouseMove)
+ EVT_TASKBAR_LEFT_DOWN (wxTaskBarIcon::OnLButtonDown)
+ EVT_TASKBAR_LEFT_UP (wxTaskBarIcon::OnLButtonUp)
+ EVT_TASKBAR_RIGHT_DOWN (wxTaskBarIcon::OnRButtonDown)
+ EVT_TASKBAR_RIGHT_UP (wxTaskBarIcon::OnRButtonUp)
+ EVT_TASKBAR_LEFT_DCLICK (wxTaskBarIcon::OnLButtonDClick)
+ EVT_TASKBAR_RIGHT_DCLICK (wxTaskBarIcon::OnRButtonDClick)
+END_EVENT_TABLE()
+
+
+IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler)
+#endif
+
+
wxTaskBarIcon::wxTaskBarIcon(void)
{
m_hWnd = 0;
}
// Overridables
-void wxTaskBarIcon::OnMouseMove(void)
+void wxTaskBarIcon::OnMouseMove(wxEvent&)
{
}
-void wxTaskBarIcon::OnLButtonDown(void)
+void wxTaskBarIcon::OnLButtonDown(wxEvent&)
{
}
-void wxTaskBarIcon::OnLButtonUp(void)
+void wxTaskBarIcon::OnLButtonUp(wxEvent&)
{
}
-void wxTaskBarIcon::OnRButtonDown(void)
+void wxTaskBarIcon::OnRButtonDown(wxEvent&)
{
}
-void wxTaskBarIcon::OnRButtonUp(void)
+void wxTaskBarIcon::OnRButtonUp(wxEvent&)
{
}
-void wxTaskBarIcon::OnLButtonDClick(void)
+void wxTaskBarIcon::OnLButtonDClick(wxEvent&)
{
}
-void wxTaskBarIcon::OnRButtonDClick(void)
+void wxTaskBarIcon::OnRButtonDClick(wxEvent&)
{
}
long wxTaskBarIcon::WindowProc( WXHWND hWnd, unsigned int msg, unsigned int wParam, long lParam )
{
+ wxEventType eventType = 0;
+
if (msg != sm_taskbarMsg)
return DefWindowProc((HWND) hWnd, msg, wParam, lParam);
switch (lParam)
{
case WM_LBUTTONDOWN:
- OnLButtonDown();
- break;
+ eventType = wxEVT_TASKBAR_LEFT_DOWN;
+ break;
case WM_LBUTTONUP:
- OnLButtonUp();
- break;
+ eventType = wxEVT_TASKBAR_LEFT_UP;
+ break;
case WM_RBUTTONDOWN:
- OnRButtonDown();
- break;
+ eventType = wxEVT_TASKBAR_RIGHT_DOWN;
+ break;
case WM_RBUTTONUP:
- OnRButtonUp();
- break;
+ eventType = wxEVT_TASKBAR_RIGHT_UP;
+ break;
case WM_LBUTTONDBLCLK:
- OnLButtonDClick();
- break;
+ eventType = wxEVT_TASKBAR_LEFT_DCLICK;
+ break;
case WM_RBUTTONDBLCLK:
- OnRButtonDClick();
- break;
+ eventType = wxEVT_TASKBAR_RIGHT_DCLICK;
+ break;
case WM_MOUSEMOVE:
- OnMouseMove();
- break;
+ eventType = wxEVT_TASKBAR_MOVE;
+ break;
default:
- break;
+ break;
}
+
+ if (eventType) {
+ wxEvent event;
+ event.SetEventType(eventType);
+ event.SetEventObject(this);
+
+ ProcessEvent(event);
+ }
return 0;
}