X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/687537119b39c4708ba302fd327d80b6f7df2289..96c9640205933ad0673d5af2c96af0816c50160c:/src/msw/notifmsg.cpp diff --git a/src/msw/notifmsg.cpp b/src/msw/notifmsg.cpp index 748445e3ae..0b43293b4f 100644 --- a/src/msw/notifmsg.cpp +++ b/src/msw/notifmsg.cpp @@ -58,7 +58,7 @@ public: virtual bool DoClose() = 0; private: - DECLARE_NO_COPY_CLASS(wxNotifMsgImpl) + wxDECLARE_NO_COPY_CLASS(wxNotifMsgImpl); }; // implementation which is simply a bridge to wxGenericNotificationMessage @@ -134,11 +134,6 @@ public: // can't close automatic notification [currently] virtual bool DoClose() { return false; } - -private: - // custom event handler connected to m_icon which will receive the icon - // close event and delete it and itself when it happens - wxEvtHandler * const m_iconEvtHandler; }; // implementation for manually closed notifications @@ -184,7 +179,7 @@ private: wxTaskBarIcon * const m_icon; - DECLARE_NO_COPY_CLASS(wxNotificationIconEvtHandler) + wxDECLARE_NO_COPY_CLASS(wxNotificationIconEvtHandler); }; // ============================================================================ @@ -280,7 +275,7 @@ void wxBalloonNotifMsgImpl::SetUpIcon(wxWindow *win) if ( !icon.IsOk() ) { // we really must have some icon - icon = wxIcon(_T("wxICON_AAA")); + icon = wxIcon(wxT("wxICON_AAA")); } m_icon->SetIcon(icon); @@ -321,7 +316,7 @@ wxManualNotifMsgImpl::DoShow(const wxString& title, int flags) { wxASSERT_MSG( timeout == wxNotificationMessage::Timeout_Never, - _T("shouldn't be used") ); + wxT("shouldn't be used") ); // base class creates the icon for us initially but we could have destroyed // it in DoClose(), recreate it if this was the case @@ -356,9 +351,14 @@ bool wxManualNotifMsgImpl::DoClose() // ---------------------------------------------------------------------------- wxAutoNotifMsgImpl::wxAutoNotifMsgImpl(wxWindow *win) - : wxBalloonNotifMsgImpl(win), - m_iconEvtHandler(new wxNotificationIconEvtHandler(m_icon)) + : wxBalloonNotifMsgImpl(win) { + if ( m_ownsIcon ) + { + // This object will self-destruct and also delete the icon when the + // notification is hidden. + new wxNotificationIconEvtHandler(m_icon); + } } bool @@ -368,7 +368,7 @@ wxAutoNotifMsgImpl::DoShow(const wxString& title, int flags) { wxASSERT_MSG( timeout != wxNotificationMessage::Timeout_Never, - _T("shouldn't be used") ); + wxT("shouldn't be used") ); if ( timeout == wxNotificationMessage::Timeout_Auto ) {