EVT_NC_PAINT(wxWindowMac::OnNcPaint)
EVT_ERASE_BACKGROUND(wxWindowMac::OnEraseBackground)
EVT_PAINT(wxWindowMac::OnPaint)
- EVT_SET_FOCUS(wxWindowMac::OnSetFocus)
- EVT_KILL_FOCUS(wxWindowMac::OnSetFocus)
EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent)
END_EVENT_TABLE()
{
ControlPartCode previousControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPreviousPart , typeControlPartCode );
ControlPartCode currentControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlCurrentPart , typeControlPartCode );
+
+ if ( thisWindow->MacGetTopLevelWindow() && thisWindow->GetPeer()->NeedsFocusRect() )
+ {
+ thisWindow->MacInvalidateBorders();
+ }
+
if ( currentControlPart == 0 )
{
// kill focus
inKillFocusEvent = true ;
wxFocusEvent event( wxEVT_KILL_FOCUS, thisWindow->GetId());
event.SetEventObject(thisWindow);
- thisWindow->GetEventHandler()->ProcessEvent(event) ;
+ thisWindow->HandleWindowEvent(event) ;
inKillFocusEvent = false ;
}
}
// panel wants to track the window which was the last to have focus in it
wxLogTrace(_T("Focus"), _T("focus set(%p)"), wx_static_cast(void*, thisWindow));
wxChildFocusEvent eventFocus((wxWindow*)thisWindow);
- thisWindow->GetEventHandler()->ProcessEvent(eventFocus);
+ thisWindow->HandleWindowEvent(eventFocus);
#if wxUSE_CARET
if ( thisWindow->GetCaret() )
wxFocusEvent event(wxEVT_SET_FOCUS, thisWindow->GetId());
event.SetEventObject(thisWindow);
- thisWindow->GetEventHandler()->ProcessEvent(event) ;
+ thisWindow->HandleWindowEvent(event) ;
}
}
break;
inKillFocusEvent = true ;
wxFocusEvent event( wxEVT_KILL_FOCUS, thisWindow->GetId());
event.SetEventObject(thisWindow);
- thisWindow->GetEventHandler()->ProcessEvent(event) ;
+ thisWindow->HandleWindowEvent(event) ;
inKillFocusEvent = false ;
}
}
// panel wants to track the window which was the last to have focus in it
wxLogTrace(_T("Focus"), _T("focus set(%p)"), wx_static_cast(void*, thisWindow));
wxChildFocusEvent eventFocus((wxWindow*)thisWindow);
- thisWindow->GetEventHandler()->ProcessEvent(eventFocus);
+ thisWindow->HandleWindowEvent(eventFocus);
#if wxUSE_CARET
if ( thisWindow->GetCaret() )
wxFocusEvent event(wxEVT_SET_FOCUS, thisWindow->GetId());
event.SetEventObject(thisWindow);
- thisWindow->GetEventHandler()->ProcessEvent(event) ;
+ thisWindow->HandleWindowEvent(event) ;
}
#endif
}
return ;
int outerBorder = MacGetLeftBorderSize() ;
- if ( m_peer->NeedsFocusRect() && m_peer->HasFocus() )
+ if ( m_peer->NeedsFocusRect() /* && m_peer->HasFocus() */ )
outerBorder += 4 ;
if ( outerBorder == 0 )
wxPoint point(actualX, actualY);
wxMoveEvent event(point, m_windowId);
event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event) ;
+ HandleWindowEvent(event) ;
}
if ( doResize )
wxSize size(actualWidth, actualHeight);
wxSizeEvent event(size, m_windowId);
event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
+ HandleWindowEvent(event);
}
}
}
{
wxSizeEvent event(GetSize(), m_windowId);
event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
+ HandleWindowEvent(event);
}
}
else if (event.GetEventType() == wxEVT_SCROLL_THUMBRELEASE)
wevent.SetEventType( wxEVT_SCROLLWIN_THUMBRELEASE );
- GetEventHandler()->ProcessEvent(wevent);
+ HandleWindowEvent(wevent);
}
}
return wxFindControlFromMacControl( control ) ;
}
-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();
-}
-
void wxWindowMac::OnInternalIdle()
{
// This calls the UI-update mechanism (querying windows for
{
wxSetCursorEvent event( pt.x , pt.y );
- bool processedEvtSetCursor = GetEventHandler()->ProcessEvent(event);
+ bool processedEvtSetCursor = HandleWindowEvent(event);
if ( processedEvtSetCursor && event.HasCursor() )
{
cursor = event.GetCursor() ;
wxEraseEvent eevent( GetId(), dc );
eevent.SetEventObject( this );
- GetEventHandler()->ProcessEvent( eevent );
+ HandleWindowEvent( eevent );
delete dc ;
}
wxPaintEvent event;
event.SetTimestamp(time);
event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
+ HandleWindowEvent(event);
handled = true ;
}
// paint custom borders
wxNcPaintEvent eventNc( child->GetId() );
eventNc.SetEventObject( child );
- if ( !child->GetEventHandler()->ProcessEvent( eventNc ) )
+ if ( !child->HandleWindowEvent( eventNc ) )
{
child->MacPaintBorders(0, 0) ;
}
wxContextMenuEvent evtCtx(wxEVT_CONTEXT_MENU,
this->GetId(),
this->ClientToScreen(event.GetPosition()));
- if ( ! GetEventHandler()->ProcessEvent(evtCtx) )
+ if ( ! HandleWindowEvent(evtCtx) )
event.Skip() ;
}
else