added MSW-specific wxTaskBarIcon::ShowBalloon() method; use it in the taskbar sample (and also clean it up significantly)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-12-01 16:25:30 +00:00
parent 3ecee463f5
commit cdcfde5d20
4 changed files with 150 additions and 48 deletions

View File

@@ -177,7 +177,7 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
notifyData.uFlags |= NIF_TIP;
if ( !tooltip.empty() )
{
wxStrncpy(notifyData.szTip, tooltip.c_str(), WXSIZEOF(notifyData.szTip));
wxStrncpy(notifyData.szTip, tooltip.wx_str(), WXSIZEOF(notifyData.szTip));
}
bool ok = wxShellNotifyIcon(m_iconAdded ? NIM_MODIFY
@@ -189,6 +189,32 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
return ok;
}
bool
wxTaskBarIcon::ShowBalloon(const wxString& title,
const wxString& text,
unsigned msec,
int flags)
{
wxCHECK_MSG( m_iconAdded, false,
_T("can't be used before the icon is created") );
NotifyIconData notifyData(GetHwndOf(m_win));
notifyData.uFlags |= NIF_INFO;
notifyData.uTimeout = msec;
wxStrncpy(notifyData.szInfo, text.wx_str(), WXSIZEOF(notifyData.szInfo));
wxStrncpy(notifyData.szInfoTitle, title.wx_str(),
WXSIZEOF(notifyData.szInfoTitle));
if ( flags & wxICON_INFORMATION )
notifyData.dwInfoFlags |= NIIF_INFO;
else if ( flags & wxICON_WARNING )
notifyData.dwInfoFlags |= NIIF_WARNING;
else if ( flags & wxICON_ERROR )
notifyData.dwInfoFlags |= NIIF_ERROR;
return wxShellNotifyIcon(NIM_MODIFY, &notifyData) != 0;
}
bool wxTaskBarIcon::RemoveIcon()
{
if (!m_iconAdded)