1 /////////////////////////////////////////////////////////////////////////
2 // File: wx/msw/taskbar.h
3 // Purpose: Defines wxTaskBarIcon class for manipulating icons on the
5 // Author: Julian Smart
9 // Copyright: (c) Julian Smart
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////
17 #pragma interface "taskbar.h"
26 WX_DECLARE_LIST(wxTaskBarIcon
, wxTaskBarIconList
);
28 class WXDLLEXPORT wxTaskBarIcon
: public wxEvtHandler
{
29 DECLARE_DYNAMIC_CLASS(wxTaskBarIcon
)
32 virtual ~wxTaskBarIcon(void);
35 inline WXHWND
GetHWND() const { return m_hWnd
; }
36 inline bool IsOK() const { return (m_hWnd
!= 0) ; }
37 inline bool IsIconInstalled() const { return m_iconAdded
; }
40 bool SetIcon(const wxIcon
& icon
, const wxString
& tooltip
= wxEmptyString
);
41 bool RemoveIcon(void);
42 bool PopupMenu(wxMenu
*menu
); //, int x, int y);
45 virtual void OnMouseMove(wxEvent
&);
46 virtual void OnLButtonDown(wxEvent
&);
47 virtual void OnLButtonUp(wxEvent
&);
48 virtual void OnRButtonDown(wxEvent
&);
49 virtual void OnRButtonUp(wxEvent
&);
50 virtual void OnLButtonDClick(wxEvent
&);
51 virtual void OnRButtonDClick(wxEvent
&);
54 static wxTaskBarIcon
* FindObjectForHWND(WXHWND hWnd
);
55 static void AddObject(wxTaskBarIcon
* obj
);
56 static void RemoveObject(wxTaskBarIcon
* obj
);
57 static bool RegisterWindowClass();
58 static WXHWND
CreateTaskBarWindow();
59 long WindowProc( WXHWND hWnd
, unsigned int msg
, unsigned int wParam
, long lParam
);
65 static wxTaskBarIconList sm_taskBarIcons
;
66 static bool sm_registeredClass
;
67 static unsigned int sm_taskbarMsg
;
69 // non-virtual default event handlers to forward events to the virtuals
70 void _OnMouseMove(wxEvent
&);
71 void _OnLButtonDown(wxEvent
&);
72 void _OnLButtonUp(wxEvent
&);
73 void _OnRButtonDown(wxEvent
&);
74 void _OnRButtonUp(wxEvent
&);
75 void _OnLButtonDClick(wxEvent
&);
76 void _OnRButtonDClick(wxEvent
&);
83 // ----------------------------------------------------------------------------
84 // wxTaskBarIcon events
85 // ----------------------------------------------------------------------------
87 class WXDLLEXPORT wxTaskBarIconEvent
: public wxEvent
90 wxTaskBarIconEvent(wxEventType evtType
, wxTaskBarIcon
*tbIcon
)
91 : wxEvent(-1, evtType
)
93 SetEventObject(tbIcon
);
96 virtual wxEvent
*Clone() const { return new wxTaskBarIconEvent(*this); }
99 BEGIN_DECLARE_EVENT_TYPES()
100 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_MOVE
, 1550 )
101 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_LEFT_DOWN
, 1551 )
102 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_LEFT_UP
, 1552 )
103 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_DOWN
, 1553 )
104 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_UP
, 1554 )
105 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_LEFT_DCLICK
, 1555 )
106 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_DCLICK
, 1556 )
107 END_DECLARE_EVENT_TYPES()
109 #define EVT_TASKBAR_MOVE(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
110 #define EVT_TASKBAR_LEFT_DOWN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
111 #define EVT_TASKBAR_LEFT_UP(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
112 #define EVT_TASKBAR_RIGHT_DOWN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
113 #define EVT_TASKBAR_RIGHT_UP(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
114 #define EVT_TASKBAR_LEFT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
115 #define EVT_TASKBAR_RIGHT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),