From 23bd008a7fc66db7294762349399c0efbd012957 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 8 Dec 2007 20:51:21 +0000 Subject: [PATCH] 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 --- include/wx/msw/chkconf.h | 18 ++++++++++++++++++ include/wx/msw/setup0.h | 20 +++++++++----------- include/wx/msw/setup_inc.h | 9 +++++++++ include/wx/msw/taskbar.h | 2 ++ include/wx/notifmsg.h | 2 +- src/msw/taskbar.cpp | 8 ++++---- 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/include/wx/msw/chkconf.h b/include/wx/msw/chkconf.h index 59d5dbc433..930edc47a4 100644 --- a/include/wx/msw/chkconf.h +++ b/include/wx/msw/chkconf.h @@ -79,6 +79,14 @@ # endif #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 # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_UNICODE_MSLU must be defined." @@ -121,6 +129,16 @@ # 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 * without it. diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 709b7fe5f9..d1527cfde0 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -1332,6 +1332,15 @@ // Recommended setting: 1, set to 0 for a small library size reduction #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 #define wxUSE_UXTHEME 1 @@ -1368,17 +1377,6 @@ // // Recommended setting: 1, set to 0 if your programs never crash #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 --- */ #endif // _WX_SETUP_H_ diff --git a/include/wx/msw/setup_inc.h b/include/wx/msw/setup_inc.h index 50c99f02dc..95a314740b 100644 --- a/include/wx/msw/setup_inc.h +++ b/include/wx/msw/setup_inc.h @@ -110,6 +110,15 @@ // Recommended setting: 1, set to 0 for a small library size reduction #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 #define wxUSE_UXTHEME 1 diff --git a/include/wx/msw/taskbar.h b/include/wx/msw/taskbar.h index b6399dad35..629b540763 100644 --- a/include/wx/msw/taskbar.h +++ b/include/wx/msw/taskbar.h @@ -35,6 +35,7 @@ public: // MSW-specific class methods +#if wxUSE_TASKBARICON_BALLOONS // show a balloon notification (the icon must have been already initialized // using SetIcon) // @@ -50,6 +51,7 @@ public: const wxString& text, unsigned msec = 0, int flags = 0); +#endif // wxUSE_TASKBARICON_BALLOONS protected: friend class wxTaskBarIconWindow; diff --git a/include/wx/notifmsg.h b/include/wx/notifmsg.h index 08f0672c2f..90239b354b 100644 --- a/include/wx/notifmsg.h +++ b/include/wx/notifmsg.h @@ -134,7 +134,7 @@ private: - libnotify (Gnome) - Growl (http://growl.info/, OS X) */ -#elif defined(__WXMSW__) && wxUSE_TASKBARICON +#elif defined(__WXMSW__) && wxUSE_TASKBARICON && wxUSE_TASKBARICON_BALLOONS #include "wx/msw/notifmsg.h" #else #include "wx/generic/notifmsg.h" diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index d42b08fe47..cc52113434 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -209,6 +209,8 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) return ok; } +#if wxUSE_TASKBARICON_BALLOONS + bool wxTaskBarIcon::ShowBalloon(const wxString& title, const wxString& text, @@ -224,9 +226,7 @@ wxTaskBarIcon::ShowBalloon(const wxString& title, // the balloon disappearance NotifyIconData notifyData(hwnd); notifyData.uFlags = 0; -#if (WINVER >= 0x0500) notifyData.uVersion = 3 /* NOTIFYICON_VERSION for Windows XP */; -#endif wxShellNotifyIcon(NIM_SETVERSION, ¬ifyData); @@ -234,7 +234,6 @@ wxTaskBarIcon::ShowBalloon(const wxString& title, // do show the balloon now notifyData = NotifyIconData(hwnd); notifyData.uFlags |= NIF_INFO; -#if (WINVER >= 0x0500) notifyData.uTimeout = msec; wxStrncpy(notifyData.szInfo, text.wx_str(), WXSIZEOF(notifyData.szInfo)); wxStrncpy(notifyData.szInfoTitle, title.wx_str(), @@ -246,11 +245,12 @@ wxTaskBarIcon::ShowBalloon(const wxString& title, notifyData.dwInfoFlags |= NIIF_WARNING; else if ( flags & wxICON_ERROR ) notifyData.dwInfoFlags |= NIIF_ERROR; -#endif return wxShellNotifyIcon(NIM_MODIFY, ¬ifyData) != 0; } +#endif // wxUSE_TASKBARICON_BALLOONS + bool wxTaskBarIcon::RemoveIcon() { if (!m_iconAdded)