X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e520c3f75cbfb0ed6a751576d7032ef196a1817d..43c42c18d36c703a88b1b7b697bac27fe5608eca:/src/msw/richtooltip.cpp diff --git a/src/msw/richtooltip.cpp b/src/msw/richtooltip.cpp index 1736eb0324..9a50ab2271 100644 --- a/src/msw/richtooltip.cpp +++ b/src/msw/richtooltip.cpp @@ -3,7 +3,7 @@ // Purpose: Native MSW implementation of wxRichToolTip. // Author: Vadim Zeitlin // Created: 2011-10-18 -// RCS-ID: $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $ +// RCS-ID: $Id$ // Copyright: (c) 2011 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -26,6 +26,7 @@ #if wxUSE_RICHTOOLTIP #ifndef WX_PRECOMP + #include "wx/treectrl.h" #endif // WX_PRECOMP #include "wx/private/richtooltip.h" @@ -33,6 +34,32 @@ #include "wx/msw/private.h" #include "wx/msw/uxtheme.h" +// Provide definitions missing from some compilers SDK headers. + +#ifndef TTI_NONE +enum +{ + TTI_NONE, + TTI_INFO, + TTI_WARNING, + TTI_ERROR +}; +#endif // !defined(TTI_XXX) + +#ifndef Edit_ShowBalloonTip +struct EDITBALLOONTIP +{ + DWORD cbStruct; + LPCWSTR pszTitle; + LPCWSTR pszText; + int ttiIcon; +}; + +#define Edit_ShowBalloonTip(hwnd, pebt) \ + (BOOL)::SendMessage((hwnd), 0x1503 /* EM_SHOWBALLOONTIP */, 0, (LPARAM)(pebt)) + +#endif // !defined(Edit_ShowBalloonTip) + // ============================================================================ // wxRichToolTipMSWImpl: the real implementation. // ============================================================================ @@ -96,13 +123,15 @@ public: } } - virtual void SetTimeout(unsigned milliseconds) + virtual void SetTimeout(unsigned millisecondsTimeout, + unsigned millisecondsDelay) { - // We don't support changing the timeout (maybe TTM_SETDELAYTIME could - // be used for this?). + // We don't support changing the timeout or the delay + // (maybe TTM_SETDELAYTIME could be used for this?). m_canUseNative = false; - wxRichToolTipGenericImpl::SetTimeout(milliseconds); + wxRichToolTipGenericImpl::SetTimeout(millisecondsTimeout, + millisecondsDelay); } virtual void SetTipKind(wxTipKind tipKind) @@ -122,13 +151,13 @@ public: wxRichToolTipGenericImpl::SetTitleFont(font); } - virtual void ShowFor(wxWindow* win) + virtual void ShowFor(wxWindow* win, const wxRect* rect) { // TODO: We could use native tooltip control to show native balloon // tooltips for any window but right now we use the simple // EM_SHOWBALLOONTIP API which can only be used with text // controls. - if ( m_canUseNative ) + if ( m_canUseNative && !rect ) { wxTextCtrl* const text = wxDynamicCast(win, wxTextCtrl); if ( text ) @@ -146,7 +175,7 @@ public: // Don't set m_canUseNative to false here, we could be able to use the // native tooltips if we're called for a different window the next // time. - wxRichToolTipGenericImpl::ShowFor(win); + wxRichToolTipGenericImpl::ShowFor(win, rect); } private: