added wxEVT_TASKBAR_BALLOON_TIMEOUT/CLICK which will be used by the wxMSW wxNotificationMessage implementation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
83aa1cf4db
commit
d3f1209867
@ -96,6 +96,8 @@ BEGIN_DECLARE_EVENT_TYPES()
|
||||
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) \
|
||||
@ -122,6 +124,13 @@ END_DECLARE_EVENT_TYPES()
|
||||
#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_
|
||||
|
@ -38,6 +38,8 @@ DEFINE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_DOWN )
|
||||
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)
|
||||
|
@ -198,7 +198,19 @@ wxTaskBarIcon::ShowBalloon(const wxString& title,
|
||||
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));
|
||||
@ -289,9 +301,7 @@ long wxTaskBarIcon::WindowProc(unsigned int msg,
|
||||
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);
|
||||
@ -299,9 +309,10 @@ long wxTaskBarIcon::WindowProc(unsigned int msg,
|
||||
}
|
||||
|
||||
// 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;
|
||||
@ -331,11 +342,16 @@ long wxTaskBarIcon::WindowProc(unsigned int msg,
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user