X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3c3b6f606364ae8bd86eeeb3e129636c5294ea85..6f026b5b63fe7ccb025e84509886f74772b9df13:/src/generic/richtooltipg.cpp diff --git a/src/generic/richtooltipg.cpp b/src/generic/richtooltipg.cpp index b37410fd57..2986f9be31 100644 --- a/src/generic/richtooltipg.cpp +++ b/src/generic/richtooltipg.cpp @@ -3,7 +3,6 @@ // Purpose: Implementation of wxRichToolTip. // Author: Vadim Zeitlin // Created: 2011-10-07 -// RCS-ID: $Id$ // Copyright: (c) 2011 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -232,9 +231,14 @@ public: } } - void SetPosition() + void SetPosition(const wxRect* rect) { - wxPoint pos = GetTipPoint(); + wxPoint pos; + + if ( !rect || rect->IsEmpty() ) + pos = GetTipPoint(); + else + pos = GetParent()->ClientToScreen( wxPoint( rect->x + rect->width / 2, rect->y + rect->height / 2 ) ); // We want our anchor point to coincide with this position so offset // the position of the top left corner passed to Move() accordingly. @@ -556,6 +560,8 @@ private: SetShape(path); #else // !wxUSE_GRAPHICS_CONTEXT + wxUnusedVar(tipKind); + int x = contentSize.x/2, yApex = 0, dy = 0; @@ -668,7 +674,7 @@ void wxRichToolTipGenericImpl::SetTitleFont(const wxFont& font) m_titleFont = font; } -void wxRichToolTipGenericImpl::ShowFor(wxWindow* win) +void wxRichToolTipGenericImpl::ShowFor(wxWindow* win, const wxRect* rect) { // Set the focus to the window the tooltip refers to to make it look active. win->SetFocus(); @@ -685,7 +691,7 @@ void wxRichToolTipGenericImpl::ShowFor(wxWindow* win) popup->SetBackgroundColours(m_colStart, m_colEnd); - popup->SetPosition(); + popup->SetPosition(rect); // show or start the timer to delay showing the popup popup->SetTimeoutAndShow( m_timeout, m_delay ); }