1 /////////////////////////////////////////////////////////////////////////
3 // Purpose: Defines wxTaskBarIcon class for manipulating icons on the
5 // Author: David Webster
9 // Copyright: (c) David Webster
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_TASKBAR_H_
14 #define _WX_TASKBAR_H_
20 class WXDLLEXPORT wxTaskBarIcon
: public wxEvtHandler
{
21 DECLARE_DYNAMIC_CLASS(wxTaskBarIcon
)
24 virtual ~wxTaskBarIcon(void);
27 inline WXHWND
GetHWND() const { return m_hWnd
; }
28 inline bool IsOK() const { return (m_hWnd
!= 0) ; }
29 inline bool IsIconInstalled() const { return m_iconAdded
; }
32 bool SetIcon(const wxIcon
& icon
, const wxString
& tooltip
= "");
33 bool RemoveIcon(void);
34 bool PopupMenu(wxMenu
*menu
); //, int x, int y);
37 virtual void OnMouseMove(wxEvent
&);
38 virtual void OnLButtonDown(wxEvent
&);
39 virtual void OnLButtonUp(wxEvent
&);
40 virtual void OnRButtonDown(wxEvent
&);
41 virtual void OnRButtonUp(wxEvent
&);
42 virtual void OnLButtonDClick(wxEvent
&);
43 virtual void OnRButtonDClick(wxEvent
&);
46 static wxTaskBarIcon
* FindObjectForHWND(WXHWND hWnd
);
47 static void AddObject(wxTaskBarIcon
* obj
);
48 static void RemoveObject(wxTaskBarIcon
* obj
);
49 static bool RegisterWindowClass();
50 static WXHWND
CreateTaskBarWindow();
51 MRESULT
WindowProc( WXHWND hWnd
, UINT msg
, MPARAM wParam
, MPARAM lParam
);
57 static wxList sm_taskBarIcons
;
58 static bool sm_registeredClass
;
59 static unsigned int sm_taskbarMsg
;
61 // non-virtual default event handlers to forward events to the virtuals
62 void _OnMouseMove(wxEvent
&);
63 void _OnLButtonDown(wxEvent
&);
64 void _OnLButtonUp(wxEvent
&);
65 void _OnRButtonDown(wxEvent
&);
66 void _OnRButtonUp(wxEvent
&);
67 void _OnLButtonDClick(wxEvent
&);
68 void _OnRButtonDClick(wxEvent
&);
73 const wxEventType wxEVT_TASKBAR_MOVE
= wxEVT_FIRST
+ 1550;
74 const wxEventType wxEVT_TASKBAR_LEFT_DOWN
= wxEVT_FIRST
+ 1551;
75 const wxEventType wxEVT_TASKBAR_LEFT_UP
= wxEVT_FIRST
+ 1552;
76 const wxEventType wxEVT_TASKBAR_RIGHT_DOWN
= wxEVT_FIRST
+ 1553;
77 const wxEventType wxEVT_TASKBAR_RIGHT_UP
= wxEVT_FIRST
+ 1554;
78 const wxEventType wxEVT_TASKBAR_LEFT_DCLICK
= wxEVT_FIRST
+ 1555;
79 const wxEventType wxEVT_TASKBAR_RIGHT_DCLICK
= wxEVT_FIRST
+ 1556;
81 #define EVT_TASKBAR_MOVE(fn) { wxEVT_TASKBAR_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
82 #define EVT_TASKBAR_LEFT_DOWN(fn) { wxEVT_TASKBAR_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
83 #define EVT_TASKBAR_LEFT_UP(fn) { wxEVT_TASKBAR_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
84 #define EVT_TASKBAR_RIGHT_DOWN(fn) { wxEVT_TASKBAR_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
85 #define EVT_TASKBAR_RIGHT_UP(fn) { wxEVT_TASKBAR_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
86 #define EVT_TASKBAR_LEFT_DCLICK(fn) { wxEVT_TASKBAR_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
87 #define EVT_TASKBAR_RIGHT_DCLICK(fn) { wxEVT_TASKBAR_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },