Fix wxClipboard.

Fix enter and leave events.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-01-14 20:29:18 +00:00
parent 2078220ed6
commit ed60b5022b
8 changed files with 318 additions and 296 deletions

View File

@@ -1676,7 +1676,6 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
&currentMouseWindow ) ;
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
{
wxMouseEvent event ;
@@ -1698,14 +1697,18 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
if ( wxWindow::s_lastMouseWindow )
{
wxMouseEvent eventleave(event ) ;
eventleave.SetEventType( wxEVT_LEAVE_WINDOW ) ;
wxMouseEvent eventleave(event);
eventleave.SetEventType( wxEVT_LEAVE_WINDOW );
wxWindow::s_lastMouseWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y );
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
}
if ( currentMouseWindow )
{
wxMouseEvent evententer(event ) ;
evententer.SetEventType( wxEVT_ENTER_WINDOW ) ;
wxMouseEvent evententer(event);
evententer.SetEventType( wxEVT_ENTER_WINDOW );
currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y );
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
}
wxWindow::s_lastMouseWindow = currentMouseWindow ;

View File

@@ -1676,7 +1676,6 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
&currentMouseWindow ) ;
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
{
wxMouseEvent event ;
@@ -1698,14 +1697,18 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
if ( wxWindow::s_lastMouseWindow )
{
wxMouseEvent eventleave(event ) ;
eventleave.SetEventType( wxEVT_LEAVE_WINDOW ) ;
wxMouseEvent eventleave(event);
eventleave.SetEventType( wxEVT_LEAVE_WINDOW );
wxWindow::s_lastMouseWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y );
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
}
if ( currentMouseWindow )
{
wxMouseEvent evententer(event ) ;
evententer.SetEventType( wxEVT_ENTER_WINDOW ) ;
wxMouseEvent evententer(event);
evententer.SetEventType( wxEVT_ENTER_WINDOW );
currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y );
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
}
wxWindow::s_lastMouseWindow = currentMouseWindow ;

View File

@@ -252,6 +252,7 @@ bool wxClipboard::AddData( wxDataObject *data )
}
#endif
}
break;
#if wxUSE_DRAG_AND_DROP
case wxDF_METAFILE:
@@ -273,6 +274,7 @@ bool wxClipboard::AddData( wxDataObject *data )
#endif
HUnlock( (Handle) pict ) ;
}
break;
#endif
case wxDF_BITMAP:
case wxDF_DIB:

View File

@@ -420,13 +420,6 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
event.m_x += m_x;
event.m_y += m_y;
/*
wxPoint origin = GetClientAreaOrigin() ;
event.m_x += origin.x ;
event.m_y += origin.y ;
*/
event.m_timeStamp = ev->when;
event.SetEventObject(this);
if ( wxTheApp->s_captureWindow )
@@ -437,6 +430,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
event.m_x = x ;
event.m_y = y ;
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
if ( ev->what == mouseUp )
{
wxTheApp->s_captureWindow = NULL ;

View File

@@ -1350,15 +1350,25 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
{
WindowRef window ;
Point pt = { screenpoint.y , screenpoint.x } ;
if ( ::FindWindow( pt , &window ) == 3 )
{
wxPoint point( screenpoint ) ;
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
if ( win )
{
point = win->ScreenToClient( point ) ;
point += win->GetClientAreaOrigin() ;
// No, this yields the CLIENT are, we need the whole frame. RR.
// point = win->ScreenToClient( point ) ;
GrafPtr port;
::GetPort( &port ) ;
::SetPort( UMAGetWindowPort( window ) ) ;
::GlobalToLocal( &pt ) ;
::SetPort( port ) ;
wxPoint point( pt.h, pt.v ) ;
return win->MacGetWindowFromPointSub( point , outWin ) ;
}
}
@@ -1416,7 +1426,9 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
wxToolTip::RelayEvent( this , event);
#endif // wxUSE_TOOLTIPS
GetEventHandler()->ProcessEvent( event ) ;
return TRUE;
}

View File

@@ -252,6 +252,7 @@ bool wxClipboard::AddData( wxDataObject *data )
}
#endif
}
break;
#if wxUSE_DRAG_AND_DROP
case wxDF_METAFILE:
@@ -273,6 +274,7 @@ bool wxClipboard::AddData( wxDataObject *data )
#endif
HUnlock( (Handle) pict ) ;
}
break;
#endif
case wxDF_BITMAP:
case wxDF_DIB:

View File

@@ -420,13 +420,6 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
event.m_x += m_x;
event.m_y += m_y;
/*
wxPoint origin = GetClientAreaOrigin() ;
event.m_x += origin.x ;
event.m_y += origin.y ;
*/
event.m_timeStamp = ev->when;
event.SetEventObject(this);
if ( wxTheApp->s_captureWindow )
@@ -437,6 +430,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
event.m_x = x ;
event.m_y = y ;
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
if ( ev->what == mouseUp )
{
wxTheApp->s_captureWindow = NULL ;

View File

@@ -1350,15 +1350,25 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
{
WindowRef window ;
Point pt = { screenpoint.y , screenpoint.x } ;
if ( ::FindWindow( pt , &window ) == 3 )
{
wxPoint point( screenpoint ) ;
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
if ( win )
{
point = win->ScreenToClient( point ) ;
point += win->GetClientAreaOrigin() ;
// No, this yields the CLIENT are, we need the whole frame. RR.
// point = win->ScreenToClient( point ) ;
GrafPtr port;
::GetPort( &port ) ;
::SetPort( UMAGetWindowPort( window ) ) ;
::GlobalToLocal( &pt ) ;
::SetPort( port ) ;
wxPoint point( pt.h, pt.v ) ;
return win->MacGetWindowFromPointSub( point , outWin ) ;
}
}
@@ -1416,7 +1426,9 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
wxToolTip::RelayEvent( this , event);
#endif // wxUSE_TOOLTIPS
GetEventHandler()->ProcessEvent( event ) ;
return TRUE;
}