default painting back to OnPaint handler
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 13 Feb 2005 14:28:11 +0000 (14:28 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 13 Feb 2005 14:28:11 +0000 (14:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31992 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mac/carbon/window.h
src/mac/carbon/window.cpp

index f571c91c0fca5099380fd64a02a4e4fc121f3071..0890ca5cb5f69f3016bb1f37b7e1ac0abd53b901 100644 (file)
@@ -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 ) ;
index 36a8b7544adea8ae1cc4557b5ad47dbe23981af2..19d98ade9b728a4863f983378f729f3845904e2c 100644 (file)
@@ -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 ) )
 {
 }