X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f048e32fcd5260f33fbebdafbe1a0deeda175419..342751763793b5cdad252d731aac0618d0674e5b:/src/msw/tooltip.cpp diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp index 0bac53472b..2b6f2f5575 100644 --- a/src/msw/tooltip.cpp +++ b/src/msw/tooltip.cpp @@ -32,7 +32,7 @@ #include "wx/tooltip.h" #include "wx/msw/private.h" -#if defined(__WIN95__) && !defined(__GNUWIN32_OLD__) +#if defined(__WIN95__) && (!defined(__GNUWIN32__) || defined(__MINGW32__)) #include #endif @@ -43,7 +43,7 @@ // For now, instead of this, we just add all radiobox buttons to the // tooltip control as well (see SetWindow) - this is probably less // efficient, but it works. -#define wxUSE_TTM_WINDOWFROMPOINT 0 +#define wxUSE_TTM_WINDOWFROMPOINT 1 // ---------------------------------------------------------------------------- // global variables @@ -63,10 +63,11 @@ static WNDPROC gs_wndprocToolTip = (WNDPROC)NULL; // private classes // ---------------------------------------------------------------------------- -// a simple wrapper around TOOLINFO Win32 structure +// a wrapper around TOOLINFO Win32 structure #ifdef __VISUALC__ #pragma warning( disable : 4097 ) // we inherit from a typedef - so what? #endif + class wxToolInfo : public TOOLINFO { public: @@ -75,11 +76,24 @@ public: // initialize all members ::ZeroMemory(this, sizeof(TOOLINFO)); + // the structure TOOLINFO has been extended with a 4 byte field in + // version 4.70 of comctl32.dll and if we compile on a newer machine + // but run on one with the old version of comctl32, nothing will work + // because the library will detect that we rely on a more recent + // version of it. So we always use the old size - if we ever start + // using our lParam member, we'd have to check for comctl32 version + // during run-time +#if defined(_WIN32_IE) && (_WIN32_IE >= 0x0300) + cbSize = sizeof(TOOLINFO) - sizeof(LPARAM); +#else // old headers cbSize = sizeof(TOOLINFO); +#endif // compile-time comctl32.dll version + uFlags = TTF_IDISHWND; uId = (UINT)hwnd; } }; + #ifdef __VISUALC__ #pragma warning( default : 4097 ) #endif @@ -252,8 +266,7 @@ void wxToolTip::Add(WXHWND hWnd) if ( !SendTooltipMessage(GetToolTipCtrl(), TTM_ADDTOOL, 0, &ti) ) { - wxLogSysError(_("Failed to create the tooltip '%s'"), - m_text.c_str()); + wxLogDebug(_T("Failed to create the tooltip '%s'"), m_text.c_str()); } } @@ -269,6 +282,7 @@ void wxToolTip::SetWindow(wxWindow *win) Add(m_window->GetHWND()); } +#if 1 //!wxUSE_TTM_WINDOWFROMPOINT // and all of its subcontrols (e.g. radiobuttons in a radiobox) as well wxControl *control = wxDynamicCast(m_window, wxControl); if ( control ) @@ -285,6 +299,7 @@ void wxToolTip::SetWindow(wxWindow *win) } } } +#endif // !wxUSE_TTM_WINDOWFROMPOINT } void wxToolTip::SetTip(const wxString& tip)