DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_UP,1554)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_DCLICK,1555)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_DCLICK,1556)
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_BALLOON_TIMEOUT,1557)
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_BALLOON_CLICK,1558)
END_DECLARE_EVENT_TYPES()
#define wxTaskBarIconEventHandler(func) \
#endif
#define EVT_TASKBAR_CLICK(fn) wx__DECLARE_TASKBAREVT(CLICK, fn)
+// these events are currently generated only under wxMSW and only after (MSW-
+// specific) ShowBalloon() had been called, don't use them in portable code
+#define EVT_TASKBAR_BALLOON_TIMEOUT(fn) \
+ wx__DECLARE_TASKBAREVT(BALLOON_TIMEOUT, fn)
+#define EVT_TASKBAR_BALLOON_CLICK(fn) \
+ wx__DECLARE_TASKBAREVT(BALLOON_CLICK, fn)
+
#endif // wxUSE_TASKBARICON
#endif // _WX_TASKBAR_H_BASE_
DEFINE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_UP )
DEFINE_EVENT_TYPE( wxEVT_TASKBAR_LEFT_DCLICK )
DEFINE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_DCLICK )
+DEFINE_EVENT_TYPE( wxEVT_TASKBAR_BALLOON_TIMEOUT )
+DEFINE_EVENT_TYPE( wxEVT_TASKBAR_BALLOON_CLICK )
BEGIN_EVENT_TABLE(wxTaskBarIconBase, wxEvtHandler)
wxCHECK_MSG( m_iconAdded, false,
_T("can't be used before the icon is created") );
- NotifyIconData notifyData(GetHwndOf(m_win));
+ const HWND hwnd = GetHwndOf(m_win);
+
+ // we need to enable version 5.0 behaviour to receive notifications about
+ // the balloon disappearance
+ NotifyIconData notifyData(hwnd);
+ notifyData.uFlags = 0;
+ notifyData.uVersion = 3 /* NOTIFYICON_VERSION for Windows XP */;
+
+ wxShellNotifyIcon(NIM_SETVERSION, ¬ifyData);
+
+
+ // do show the balloon now
+ notifyData = NotifyIconData(hwnd);
notifyData.uFlags |= NIF_INFO;
notifyData.uTimeout = msec;
wxStrncpy(notifyData.szInfo, text.wx_str(), WXSIZEOF(notifyData.szInfo));
unsigned int WXUNUSED(wParam),
long lParam)
{
- wxEventType eventType = 0;
-
- if (msg == gs_msgRestartTaskbar) // does the icon need to be redrawn?
+ if ( msg == gs_msgRestartTaskbar ) // does the icon need to be redrawn?
{
m_iconAdded = false;
SetIcon(m_icon, m_strTooltip);
}
// this function should only be called for gs_msg(Restart)Taskbar messages
- wxASSERT(msg == gs_msgTaskbar);
+ wxASSERT( msg == gs_msgTaskbar );
- switch (lParam)
+ wxEventType eventType = 0;
+ switch ( lParam )
{
case WM_LBUTTONDOWN:
eventType = wxEVT_TASKBAR_LEFT_DOWN;
eventType = wxEVT_TASKBAR_MOVE;
break;
- default:
+ case NIN_BALLOONTIMEOUT:
+ eventType = wxEVT_TASKBAR_BALLOON_TIMEOUT;
+ break;
+
+ case NIN_BALLOONUSERCLICK:
+ eventType = wxEVT_TASKBAR_BALLOON_CLICK;
break;
}
- if (eventType)
+ if ( eventType )
{
wxTaskBarIconEvent event(eventType, this);