-void wxWindowMac::OnSetFocus( wxFocusEvent& event )
-{
- // panel wants to track the window which was the last to have focus in it,
- // so we want to set ourselves as the window which last had focus
- //
- // notice that it's also important to do it upwards the tree because
- // otherwise when the top level panel gets focus, it won't set it back to
- // us, but to some other sibling
-
- // CS: don't know if this is still needed:
- //wxChildFocusEvent eventFocus(this);
- //(void)GetEventHandler()->ProcessEvent(eventFocus);
-
- if ( MacGetTopLevelWindow() && m_peer->NeedsFocusRect() )
- {
- GetParent()->Refresh() ;
- wxMacWindowStateSaver sv( this ) ;
- Rect rect ;
-
- m_peer->GetRect( &rect ) ;
- // on the surrounding frame
- InsetRect( &rect, -1 , -1 ) ;
-
- wxTopLevelWindowMac* top = MacGetTopLevelWindow();
- if ( top )
- {
- wxPoint pt(0, 0) ;
- wxMacControl::Convert( &pt , GetParent()->m_peer , top->m_peer ) ;
- rect.left += pt.x ;
- rect.right += pt.x ;
- rect.top += pt.y ;
- rect.bottom += pt.y ;
- }
-
- bool bIsFocusEvent = (event.GetEventType() == wxEVT_SET_FOCUS);
- DrawThemeFocusRect( &rect , bIsFocusEvent ) ;
- if ( !bIsFocusEvent )
- {
- // as this erases part of the frame we have to redraw borders
- // and because our z-ordering is not always correct (staticboxes)
- // we have to invalidate things, we cannot simple redraw
- MacInvalidateBorders() ;
- }
- }
-
- event.Skip();
-}
-