From ff3795eeaf49717c7d09b286326cf0cedd476377 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 13 Feb 2005 14:28:11 +0000 Subject: [PATCH] default painting back to OnPaint handler git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31992 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/carbon/window.h | 1 + src/mac/carbon/window.cpp | 31 ++++++++++++++++++------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/wx/mac/carbon/window.h b/include/wx/mac/carbon/window.h index f571c91c0f..0890ca5cb5 100644 --- a/include/wx/mac/carbon/window.h +++ b/include/wx/mac/carbon/window.h @@ -144,6 +144,7 @@ public: // event handlers // -------------- void OnSetFocus(wxFocusEvent& event) ; + void OnPaint(wxPaintEvent& event); void OnNcPaint(wxNcPaintEvent& event); void OnEraseBackground(wxEraseEvent& event); void OnMouseEvent( wxMouseEvent &event ) ; diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 36a8b7544a..19d98ade9b 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -81,7 +81,9 @@ extern wxList wxPendingDelete; BEGIN_EVENT_TABLE(wxWindowMac, wxWindowBase) EVT_NC_PAINT(wxWindowMac::OnNcPaint) EVT_ERASE_BACKGROUND(wxWindowMac::OnEraseBackground) -// TODO EVT_PAINT(wxWindowMac::OnPaint) +#if TARGET_API_MAC_OSX + EVT_PAINT(wxWindowMac::OnPaint) +#endif EVT_SET_FOCUS(wxWindowMac::OnSetFocus) EVT_KILL_FOCUS(wxWindowMac::OnSetFocus) EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent) @@ -2582,6 +2584,7 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event) if ( MacGetTopLevelWindow() && m_peer->NeedsFocusRect() ) { + #if !wxMAC_USE_CORE_GRAPHICS wxMacWindowStateSaver sv( this ) ; int w , h ; @@ -2613,6 +2616,9 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event) DisposeRgn(updateOuter) ; DisposeRgn(updateInner) ; } +#else + GetParent()->Refresh() ; +#endif } event.Skip(); @@ -2870,21 +2876,12 @@ bool wxWindowMac::MacDoRedraw( WXHRGN updatergnr , long time ) if ( !m_updateRegion.Empty() ) { // paint the window itself + wxPaintEvent event; event.SetTimestamp(time); event.SetEventObject(this); - handled = GetEventHandler()->ProcessEvent(event); - - // we have to call the default built-in handler, as otherwise our frames will be drawn and immediately erased afterwards - if ( !handled ) - { - if ( wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL ) - { - CallNextEventHandler((EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() , (EventRef) wxTheApp->MacGetCurrentEvent() ) ; - handled = true ; - } - } - + GetEventHandler()->ProcessEvent(event); + handled = true ; } // now we cannot rely on having its borders drawn by a window itself, as it does not @@ -3233,6 +3230,14 @@ void wxWindowMac::OnMouseEvent( wxMouseEvent &event ) } } +void wxWindowMac::OnPaint( wxPaintEvent & event ) +{ + if ( wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL ) + { + CallNextEventHandler((EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() , (EventRef) wxTheApp->MacGetCurrentEvent() ) ; + } +} + void wxWindowMac::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) ) { } -- 2.45.2