cleanup in toplevel activation, and switching to native carbon event notification for window visibility etc.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26453 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2004-03-29 11:35:04 +00:00
parent f009156727
commit 73fe67bd60
2 changed files with 25 additions and 5 deletions

View File

@ -512,12 +512,11 @@ static pascal OSStatus wxMacTopLevelWindowEventHandler( EventHandlerCallRef hand
case kEventWindowActivated : case kEventWindowActivated :
{ {
toplevelWindow->MacActivate( cEvent.GetTicks() , true) ; toplevelWindow->MacActivate( cEvent.GetTicks() , true) ;
wxActivateEvent wxevent(wxEVT_ACTIVATE, true , toplevelWindow->GetId()); wxActivateEvent wxevent(wxEVT_ACTIVATE, true , toplevelWindow->GetId());
wxevent.SetTimestamp( cEvent.GetTicks() ) ; wxevent.SetTimestamp( cEvent.GetTicks() ) ;
wxevent.SetEventObject(toplevelWindow); wxevent.SetEventObject(toplevelWindow);
toplevelWindow->GetEventHandler()->ProcessEvent(wxevent); toplevelWindow->GetEventHandler()->ProcessEvent(wxevent);
result = noErr ; // we still sending an eventNotHandledErr in order to allow for default processing
break ; break ;
} }
case kEventWindowDeactivated : case kEventWindowDeactivated :
@ -527,7 +526,7 @@ static pascal OSStatus wxMacTopLevelWindowEventHandler( EventHandlerCallRef hand
wxevent.SetTimestamp( cEvent.GetTicks() ) ; wxevent.SetTimestamp( cEvent.GetTicks() ) ;
wxevent.SetEventObject(toplevelWindow); wxevent.SetEventObject(toplevelWindow);
toplevelWindow->GetEventHandler()->ProcessEvent(wxevent); toplevelWindow->GetEventHandler()->ProcessEvent(wxevent);
result = noErr ; // we still sending an eventNotHandledErr in order to allow for default processing
break ; break ;
} }
case kEventWindowShown : case kEventWindowShown :
@ -961,8 +960,10 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
{ {
::CreateRootControl( (WindowRef)m_macWindow , (ControlRef*)&m_macControl ) ; ::CreateRootControl( (WindowRef)m_macWindow , (ControlRef*)&m_macControl ) ;
} }
// the root control level handleer
MacInstallEventHandler() ; MacInstallEventHandler() ;
// the frame window event handler
InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ; InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
MacInstallTopLevelWindowEventHandler() ; MacInstallTopLevelWindowEventHandler() ;

View File

@ -106,9 +106,13 @@ static const EventTypeSpec eventList[] =
{ {
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
{ kEventClassControl , kEventControlDraw } , { kEventClassControl , kEventControlDraw } ,
{ kEventClassControl , kEventControlVisibilityChanged } ,
{ kEventClassControl , kEventControlEnabledStateChanged } ,
{ kEventClassControl , kEventControlHiliteChanged } ,
// { kEventClassControl , kEventControlInvalidateForSizeChange } , // 10.3 only // { kEventClassControl , kEventControlInvalidateForSizeChange } , // 10.3 only
// { kEventClassControl , kEventControlBoundsChanged } , // { kEventClassControl , kEventControlBoundsChanged } ,
// kEventControlEnabledStateChanged , kEventControlVisibilityChanged , kEventControlHiliteChanged
{}
#else #else
{} {}
#endif #endif
@ -149,6 +153,15 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
result = eventNotHandledErr; result = eventNotHandledErr;
} }
break ; break ;
case kEventControlVisibilityChanged :
thisWindow->MacVisibilityChanged() ;
break ;
case kEventControlEnabledStateChanged :
thisWindow->MacEnabledStateChanged() ;
break ;
case kEventControlHiliteChanged :
thisWindow->MacHiliteChanged() ;
break ;
default : default :
break ; break ;
} }
@ -1540,6 +1553,7 @@ bool wxWindowMac::Enable(bool enable)
void wxWindowMac::MacPropagateVisibilityChanged() void wxWindowMac::MacPropagateVisibilityChanged()
{ {
#if !TARGET_API_MAC_OSX
MacVisibilityChanged() ; MacVisibilityChanged() ;
wxWindowListNode *node = GetChildren().GetFirst(); wxWindowListNode *node = GetChildren().GetFirst();
@ -1550,10 +1564,12 @@ void wxWindowMac::MacPropagateVisibilityChanged()
child->MacPropagateVisibilityChanged( ) ; child->MacPropagateVisibilityChanged( ) ;
node = node->GetNext(); node = node->GetNext();
} }
#endif
} }
void wxWindowMac::MacPropagateEnabledStateChanged( ) void wxWindowMac::MacPropagateEnabledStateChanged( )
{ {
#if !TARGET_API_MAC_OSX
MacEnabledStateChanged() ; MacEnabledStateChanged() ;
wxWindowListNode *node = GetChildren().GetFirst(); wxWindowListNode *node = GetChildren().GetFirst();
@ -1564,10 +1580,12 @@ void wxWindowMac::MacPropagateEnabledStateChanged( )
child->MacPropagateEnabledStateChanged() ; child->MacPropagateEnabledStateChanged() ;
node = node->GetNext(); node = node->GetNext();
} }
#endif
} }
void wxWindowMac::MacPropagateHiliteChanged( ) void wxWindowMac::MacPropagateHiliteChanged( )
{ {
#if !TARGET_API_MAC_OSX
MacHiliteChanged() ; MacHiliteChanged() ;
wxWindowListNode *node = GetChildren().GetFirst(); wxWindowListNode *node = GetChildren().GetFirst();
@ -1578,6 +1596,7 @@ void wxWindowMac::MacPropagateHiliteChanged( )
child->MacPropagateHiliteChanged() ; child->MacPropagateHiliteChanged() ;
node = node->GetNext(); node = node->GetNext();
} }
#endif
} }
// //