add wxUSE_TASKBARICON_BALLOONS to make it possible to turn off their usage if our SDK is too old (mainly for VC6 with its original ancient SDK)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-12-08 20:51:21 +00:00
parent 174e8f45df
commit 23bd008a7f
6 changed files with 43 additions and 16 deletions

View File

@@ -79,6 +79,14 @@
# endif # endif
#endif /* !defined(wxUSE_OLE_AUTOMATION) */ #endif /* !defined(wxUSE_OLE_AUTOMATION) */
#ifndef wxUSE_TASKBARICON_BALLOONS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_TASKBARICON_BALLOONS must be defined."
# else
# define wxUSE_TASKBARICON_BALLOONS 0
# endif
#endif /* wxUSE_TASKBARICON_BALLOONS */
#ifndef wxUSE_UNICODE_MSLU #ifndef wxUSE_UNICODE_MSLU
# ifdef wxABORT_ON_CONFIG_ERROR # ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_UNICODE_MSLU must be defined." # error "wxUSE_UNICODE_MSLU must be defined."
@@ -121,6 +129,16 @@
# endif # endif
#endif #endif
/*
* See WINVER definition in wx/msw/wrapwin.h for the explanation of this test
* logic.
*/
#if (defined(__VISUALC__) && (__VISUALC__ < 1300)) && \
(!defined(WINVER) || WINVER < 0x0500)
# undef wxUSE_TASKBARICON_BALLOONS
# define wxUSE_TASKBARICON_BALLOONS 0
#endif
/* /*
* All of the settings below require SEH support (__try/__catch) and can't work * All of the settings below require SEH support (__try/__catch) and can't work
* without it. * without it.

View File

@@ -1332,6 +1332,15 @@
// Recommended setting: 1, set to 0 for a small library size reduction // Recommended setting: 1, set to 0 for a small library size reduction
#define wxUSE_OWNER_DRAWN 1 #define wxUSE_OWNER_DRAWN 1
// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It
// is required by native wxNotificationMessage implementation.
//
// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain
// the necessary declarations.
//
// Recommended setting: 1, set to 0 for a tiny library size reduction
#define wxUSE_TASKBARICON_BALLOONS 1
// Set to 1 to compile MS Windows XP theme engine support // Set to 1 to compile MS Windows XP theme engine support
#define wxUSE_UXTHEME 1 #define wxUSE_UXTHEME 1
@@ -1368,17 +1377,6 @@
// //
// Recommended setting: 1, set to 0 if your programs never crash // Recommended setting: 1, set to 0 if your programs never crash
#define wxUSE_CRASHREPORT 1 #define wxUSE_CRASHREPORT 1
// ----------------------------------------------------------------------------
// obsolete settings
// ----------------------------------------------------------------------------
// NB: all settings in this section are obsolete and should not be used/changed
// at all, they will disappear
// Define 1 to use bitmap messages.
#define wxUSE_BITMAP_MESSAGE 1
/* --- end MSW options --- */ /* --- end MSW options --- */
#endif // _WX_SETUP_H_ #endif // _WX_SETUP_H_

View File

@@ -110,6 +110,15 @@
// Recommended setting: 1, set to 0 for a small library size reduction // Recommended setting: 1, set to 0 for a small library size reduction
#define wxUSE_OWNER_DRAWN 1 #define wxUSE_OWNER_DRAWN 1
// Set this to 1 to enable MSW-specific wxTaskBarIcon::ShowBalloon() method. It
// is required by native wxNotificationMessage implementation.
//
// Default is 1 but disabled in wx/msw/chkconf.h if SDK is too old to contain
// the necessary declarations.
//
// Recommended setting: 1, set to 0 for a tiny library size reduction
#define wxUSE_TASKBARICON_BALLOONS 1
// Set to 1 to compile MS Windows XP theme engine support // Set to 1 to compile MS Windows XP theme engine support
#define wxUSE_UXTHEME 1 #define wxUSE_UXTHEME 1

View File

@@ -35,6 +35,7 @@ public:
// MSW-specific class methods // MSW-specific class methods
#if wxUSE_TASKBARICON_BALLOONS
// show a balloon notification (the icon must have been already initialized // show a balloon notification (the icon must have been already initialized
// using SetIcon) // using SetIcon)
// //
@@ -50,6 +51,7 @@ public:
const wxString& text, const wxString& text,
unsigned msec = 0, unsigned msec = 0,
int flags = 0); int flags = 0);
#endif // wxUSE_TASKBARICON_BALLOONS
protected: protected:
friend class wxTaskBarIconWindow; friend class wxTaskBarIconWindow;

View File

@@ -134,7 +134,7 @@ private:
- libnotify (Gnome) - libnotify (Gnome)
- Growl (http://growl.info/, OS X) - Growl (http://growl.info/, OS X)
*/ */
#elif defined(__WXMSW__) && wxUSE_TASKBARICON #elif defined(__WXMSW__) && wxUSE_TASKBARICON && wxUSE_TASKBARICON_BALLOONS
#include "wx/msw/notifmsg.h" #include "wx/msw/notifmsg.h"
#else #else
#include "wx/generic/notifmsg.h" #include "wx/generic/notifmsg.h"

View File

@@ -209,6 +209,8 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
return ok; return ok;
} }
#if wxUSE_TASKBARICON_BALLOONS
bool bool
wxTaskBarIcon::ShowBalloon(const wxString& title, wxTaskBarIcon::ShowBalloon(const wxString& title,
const wxString& text, const wxString& text,
@@ -224,9 +226,7 @@ wxTaskBarIcon::ShowBalloon(const wxString& title,
// the balloon disappearance // the balloon disappearance
NotifyIconData notifyData(hwnd); NotifyIconData notifyData(hwnd);
notifyData.uFlags = 0; notifyData.uFlags = 0;
#if (WINVER >= 0x0500)
notifyData.uVersion = 3 /* NOTIFYICON_VERSION for Windows XP */; notifyData.uVersion = 3 /* NOTIFYICON_VERSION for Windows XP */;
#endif
wxShellNotifyIcon(NIM_SETVERSION, &notifyData); wxShellNotifyIcon(NIM_SETVERSION, &notifyData);
@@ -234,7 +234,6 @@ wxTaskBarIcon::ShowBalloon(const wxString& title,
// do show the balloon now // do show the balloon now
notifyData = NotifyIconData(hwnd); notifyData = NotifyIconData(hwnd);
notifyData.uFlags |= NIF_INFO; notifyData.uFlags |= NIF_INFO;
#if (WINVER >= 0x0500)
notifyData.uTimeout = msec; notifyData.uTimeout = msec;
wxStrncpy(notifyData.szInfo, text.wx_str(), WXSIZEOF(notifyData.szInfo)); wxStrncpy(notifyData.szInfo, text.wx_str(), WXSIZEOF(notifyData.szInfo));
wxStrncpy(notifyData.szInfoTitle, title.wx_str(), wxStrncpy(notifyData.szInfoTitle, title.wx_str(),
@@ -246,11 +245,12 @@ wxTaskBarIcon::ShowBalloon(const wxString& title,
notifyData.dwInfoFlags |= NIIF_WARNING; notifyData.dwInfoFlags |= NIIF_WARNING;
else if ( flags & wxICON_ERROR ) else if ( flags & wxICON_ERROR )
notifyData.dwInfoFlags |= NIIF_ERROR; notifyData.dwInfoFlags |= NIIF_ERROR;
#endif
return wxShellNotifyIcon(NIM_MODIFY, &notifyData) != 0; return wxShellNotifyIcon(NIM_MODIFY, &notifyData) != 0;
} }
#endif // wxUSE_TASKBARICON_BALLOONS
bool wxTaskBarIcon::RemoveIcon() bool wxTaskBarIcon::RemoveIcon()
{ {
if (!m_iconAdded) if (!m_iconAdded)