1 /////////////////////////////////////////////////////////////////////////
3 // Purpose: Defines wxTaskBarIcon class for manipulating icons on the
5 // Author: Julian Smart
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////
17 #pragma interface "taskbar.h"
24 class wxTaskBarIcon
: public wxEvtHandler
{
25 DECLARE_DYNAMIC_CLASS(wxTaskBarIcon
)
28 virtual ~wxTaskBarIcon(void);
31 inline WXHWND
GetHWND() const { return m_hWnd
; }
32 inline bool IsOK() const { return (m_hWnd
!= 0) ; }
33 inline bool IsIconInstalled() const { return m_iconAdded
; }
36 bool SetIcon(const wxIcon
& icon
, const wxString
& tooltip
= "");
37 bool RemoveIcon(void);
38 bool PopupMenu(wxMenu
*menu
); //, int x, int y);
41 virtual void OnMouseMove(wxEvent
&);
42 virtual void OnLButtonDown(wxEvent
&);
43 virtual void OnLButtonUp(wxEvent
&);
44 virtual void OnRButtonDown(wxEvent
&);
45 virtual void OnRButtonUp(wxEvent
&);
46 virtual void OnLButtonDClick(wxEvent
&);
47 virtual void OnRButtonDClick(wxEvent
&);
50 static wxTaskBarIcon
* FindObjectForHWND(WXHWND hWnd
);
51 static void AddObject(wxTaskBarIcon
* obj
);
52 static void RemoveObject(wxTaskBarIcon
* obj
);
53 static bool RegisterWindowClass();
54 static WXHWND
CreateTaskBarWindow();
55 long WindowProc( WXHWND hWnd
, unsigned int msg
, unsigned int wParam
, long lParam
);
61 static wxList sm_taskBarIcons
;
62 static bool sm_registeredClass
;
63 static unsigned int sm_taskbarMsg
;
65 // non-virtual default event handlers to forward events to the virtuals
66 void _OnMouseMove(wxEvent
&);
67 void _OnLButtonDown(wxEvent
&);
68 void _OnLButtonUp(wxEvent
&);
69 void _OnRButtonDown(wxEvent
&);
70 void _OnRButtonUp(wxEvent
&);
71 void _OnLButtonDClick(wxEvent
&);
72 void _OnRButtonDClick(wxEvent
&);
80 const wxEventType wxEVT_TASKBAR_MOVE
= wxEVT_FIRST
+ 1550;
81 const wxEventType wxEVT_TASKBAR_LEFT_DOWN
= wxEVT_FIRST
+ 1551;
82 const wxEventType wxEVT_TASKBAR_LEFT_UP
= wxEVT_FIRST
+ 1552;
83 const wxEventType wxEVT_TASKBAR_RIGHT_DOWN
= wxEVT_FIRST
+ 1553;
84 const wxEventType wxEVT_TASKBAR_RIGHT_UP
= wxEVT_FIRST
+ 1554;
85 const wxEventType wxEVT_TASKBAR_LEFT_DCLICK
= wxEVT_FIRST
+ 1555;
86 const wxEventType wxEVT_TASKBAR_RIGHT_DCLICK
= wxEVT_FIRST
+ 1556;
89 #define EVT_TASKBAR_MOVE(fn) { wxEVT_TASKBAR_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
90 #define EVT_TASKBAR_LEFT_DOWN(fn) { wxEVT_TASKBAR_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
91 #define EVT_TASKBAR_LEFT_UP(fn) { wxEVT_TASKBAR_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
92 #define EVT_TASKBAR_RIGHT_DOWN(fn) { wxEVT_TASKBAR_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
93 #define EVT_TASKBAR_RIGHT_UP(fn) { wxEVT_TASKBAR_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
94 #define EVT_TASKBAR_LEFT_DCLICK(fn) { wxEVT_TASKBAR_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },
95 #define EVT_TASKBAR_RIGHT_DCLICK(fn) { wxEVT_TASKBAR_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL },