}
}
- 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.
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();
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 );
}