X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/489468feaa08b8f504735eecca522fb8d0f825d2..62265c2c67bd9ee1c78e57700277dc0baf2f14d6:/src/osx/carbon/tooltip.cpp?ds=inline diff --git a/src/osx/carbon/tooltip.cpp b/src/osx/carbon/tooltip.cpp index 957feb0491..0b7630ac79 100644 --- a/src/osx/carbon/tooltip.cpp +++ b/src/osx/carbon/tooltip.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/mac/carbon/tooltip.cpp +// Name: src/osx/carbon/tooltip.cpp // Purpose: wxToolTip implementation // Author: Stefan Csomor // Id: $Id$ @@ -18,10 +18,11 @@ #include "wx/window.h" #include "wx/dc.h" #include "wx/timer.h" + #include "wx/nonownedwnd.h" #endif // WX_PRECOMP #include "wx/geometry.h" -#include "wx/mac/uma.h" +#include "wx/osx/uma.h" //----------------------------------------------------------------------------- // global data @@ -63,7 +64,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject) wxToolTip::wxToolTip( const wxString &tip ) { m_text = tip; - m_window = (wxWindow*) NULL; + m_window = NULL; } wxToolTip::~wxToolTip() @@ -158,7 +159,7 @@ void wxToolTip::RemoveToolTips() } // --- mac specific -#if wxUSE_TIMER +#if wxUSE_TIMER wxMacToolTipTimer::wxMacToolTipTimer( wxMacToolTip *tip , int msec ) { m_tip = tip; @@ -171,7 +172,7 @@ wxMacToolTip::wxMacToolTip() { m_window = NULL ; m_backpict = NULL ; -#if wxUSE_TIMER +#if wxUSE_TIMER m_timer = NULL ; #endif m_mark = 0 ; @@ -188,9 +189,8 @@ void wxMacToolTip::Setup( WindowRef win , const wxString& text , const wxPoint& m_window =win; s_ToolTipWindowRef = m_window ; m_backpict = NULL ; -#if wxUSE_TIMER - if ( m_timer ) - delete m_timer ; +#if wxUSE_TIMER + delete m_timer ; m_timer = new wxMacToolTipTimer( this , s_ToolTipDelay ) ; #endif // wxUSE_TIMER @@ -198,7 +198,7 @@ void wxMacToolTip::Setup( WindowRef win , const wxString& text , const wxPoint& wxMacToolTip::~wxMacToolTip() { -#if wxUSE_TIMER +#if wxUSE_TIMER if ( m_timer ) { delete m_timer ; @@ -224,9 +224,12 @@ void wxMacToolTip::Draw() HMHelpContentRec tag ; tag.version = kMacHelpVersion; - Point p = { m_position.y , m_position.x }; - wxMacLocalToGlobal( m_window , &p ) ; - SetRect( &tag.absHotRect , p.h - 2 , p.v - 2 , p.h + 2 , p.v + 2 ); + int x = m_position.x; + int y = m_position.y; + wxNonOwnedWindow* tlw = wxNonOwnedWindow::GetFromWXWindow((WXWindow) m_window); + if ( tlw ) + tlw->GetNonOwnedPeer()->WindowToScreen( &x, &y ); + SetRect( &tag.absHotRect , x - 2 , y - 2 , x + 2 , y + 2 ); m_helpTextRef = wxCFStringRef( m_label , wxFONTENCODING_DEFAULT ) ; tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ; @@ -247,7 +250,7 @@ void wxToolTip::NotifyWindowDelete( WXHWND win ) void wxMacToolTip::Clear() { m_mark++ ; -#if wxUSE_TIMER +#if wxUSE_TIMER if ( m_timer ) { delete m_timer ;