// 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 <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#if wxUSE_RICHTOOLTIP
#ifndef WX_PRECOMP
+ #include "wx/treectrl.h"
#endif // WX_PRECOMP
#include "wx/private/richtooltip.h"
#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.
// ============================================================================
}
}
- 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)
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 )
// 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: