constrain tooltip rectangle to window (access to screen is very expensive under OSX)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17666 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2002-11-01 18:36:41 +00:00
parent 160c7ecbad
commit bc4103a66e
2 changed files with 58 additions and 14 deletions

View File

@@ -287,6 +287,28 @@ void wxMacToolTip::Draw()
m_rect.right += kTipBorder ;
#endif
m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
Rect r ;
GetPortBounds( GetWindowPort( m_window ) , &r ) ;
if ( m_rect.top < 0 )
{
m_rect.bottom += -m_rect.top ;
m_rect.top = 0 ;
}
if ( m_rect.left < 0 )
{
m_rect.right += -m_rect.left ;
m_rect.left = 0 ;
}
if ( m_rect.right > r.right )
{
m_rect.left -= (m_rect.right - r.right ) ;
m_rect.right = r.right ;
}
if ( m_rect.bottom > r.bottom )
{
m_rect.top -= (m_rect.bottom - r.bottom) ;
m_rect.bottom = r.bottom ;
}
ClipRect( &m_rect ) ;
BackColor( whiteColor ) ;
ForeColor(blackColor ) ;

View File

@@ -287,6 +287,28 @@ void wxMacToolTip::Draw()
m_rect.right += kTipBorder ;
#endif
m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
Rect r ;
GetPortBounds( GetWindowPort( m_window ) , &r ) ;
if ( m_rect.top < 0 )
{
m_rect.bottom += -m_rect.top ;
m_rect.top = 0 ;
}
if ( m_rect.left < 0 )
{
m_rect.right += -m_rect.left ;
m_rect.left = 0 ;
}
if ( m_rect.right > r.right )
{
m_rect.left -= (m_rect.right - r.right ) ;
m_rect.right = r.right ;
}
if ( m_rect.bottom > r.bottom )
{
m_rect.top -= (m_rect.bottom - r.bottom) ;
m_rect.bottom = r.bottom ;
}
ClipRect( &m_rect ) ;
BackColor( whiteColor ) ;
ForeColor(blackColor ) ;