]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/window_osx.cpp
Eliminated two unneeded arguments from wxPropertyGrid::DoDrawItems()
[wxWidgets.git] / src / osx / window_osx.cpp
index a2b6b42654f5a90dd6d2ffdc470180f88af6a28d..5e8a0b9f46981c4a78d03029294d22b4f27d8584 100644 (file)
@@ -85,7 +85,6 @@
 BEGIN_EVENT_TABLE(wxWindowMac, wxWindowBase)
     EVT_NC_PAINT(wxWindowMac::OnNcPaint)
     EVT_ERASE_BACKGROUND(wxWindowMac::OnEraseBackground)
-    EVT_PAINT(wxWindowMac::OnPaint)
     EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent)
 END_EVENT_TABLE()
 
@@ -141,8 +140,6 @@ wxWindowMac::~wxWindowMac()
 {
     SendDestroyEvent();
 
-    m_isBeingDeleted = true;
-
     MacInvalidateBorders() ;
 
 #ifndef __WXUNIVERSAL__
@@ -153,7 +150,7 @@ wxWindowMac::~wxWindowMac()
         if ( frame )
         {
             if ( frame->GetLastFocus() == this )
-                frame->SetLastFocus((wxWindow*)NULL);
+                frame->SetLastFocus(NULL);
             break;
         }
     }
@@ -459,10 +456,6 @@ void wxWindowMac::SetFocus()
 void wxWindowMac::DoCaptureMouse()
 {
     wxApp::s_captureWindow = (wxWindow*) this ;
-#ifdef wxOSX_USE_COCOA
-    // TODO do we really need this ?
-    m_peer->SetFocus() ;
-#endif
     m_peer->CaptureMouse() ;
 }
 
@@ -970,6 +963,13 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
         // TODO: REMOVE
         MacRepositionScrollBars() ; // we might have a real position shift
 
+        if (sizeFlags & wxSIZE_FORCE_EVENT)
+        {
+            wxSizeEvent event( wxSize(width,height), GetId() );
+            event.SetEventObject( this );
+            HandleWindowEvent( event );
+        }
+
         return;
     }
 
@@ -1868,7 +1868,19 @@ bool wxWindowMac::MacDoRedraw( void* updatergnr , long time )
             wxPaintEvent event;
             event.SetTimestamp(time);
             event.SetEventObject(this);
-            HandleWindowEvent(event);
+            if ( !HandleWindowEvent(event) )
+            {
+                // for native controls: call their native paint method
+                if ( !MacIsUserPane() || ( IsTopLevel() && GetBackgroundStyle() == wxBG_STYLE_SYSTEM ) )
+                {
+                    if ( wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL
+                        && GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT )
+                        CallNextEventHandler(
+                            (EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() ,
+                            (EventRef) wxTheApp->MacGetCurrentEvent() ) ;
+                }
+            }
+            
             handled = true ;
         }
 
@@ -2199,24 +2211,7 @@ void wxWindowMac::OnMouseEvent( wxMouseEvent &event )
     }
 }
 
-void wxWindowMac::OnPaint( wxPaintEvent & WXUNUSED(event) )
-{
-#if wxOSX_USE_COCOA_OR_CARBON
-    // for native controls: call their native paint method
-    if ( !MacIsUserPane() || ( IsTopLevel() && GetBackgroundStyle() == wxBG_STYLE_SYSTEM ) )
-    {
-        if ( wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL
-             && GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT )
-            CallNextEventHandler(
-                (EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() ,
-                (EventRef) wxTheApp->MacGetCurrentEvent() ) ;
-    }
-#endif
-}
-
-void wxWindowMac::MacHandleControlClick(WXWidget WXUNUSED(control),
-                                        wxInt16 WXUNUSED(controlpart),
-                                        bool WXUNUSED(mouseStillDown))
+void wxWindowMac::TriggerScrollEvent( wxEventType WXUNUSED(scrollEvent) )
 {
 }
 
@@ -2230,7 +2225,7 @@ Rect wxMacGetBoundsForControl( wxWindowMac* window , const wxPoint& pos , const
     return bounds ;
 }
 
-bool wxWindowMac::HandleClicked( double timestampsec )
+bool wxWindowMac::OSXHandleClicked( double timestampsec )
 {
     return false;
 }
@@ -2238,7 +2233,7 @@ bool wxWindowMac::HandleClicked( double timestampsec )
 wxInt32 wxWindowMac::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF event )
 {
 #if wxOSX_USE_COCOA_OR_CARBON
-    if ( HandleClicked( GetEventTime((EventRef)event) ) )
+    if ( OSXHandleClicked( GetEventTime((EventRef)event) ) )
         return noErr;
         
     return eventNotHandledErr ;
@@ -2304,6 +2299,47 @@ bool wxWindowMac::IsShownOnScreen() const
     return wxWindowBase::IsShownOnScreen();
 }
 
+bool wxWindowMac::OSXHandleKeyEvent( wxKeyEvent& event )
+{
+    bool handled = HandleWindowEvent( event ) ;
+    if ( handled && event.GetSkipped() )
+        handled = false ;
+
+#if wxUSE_ACCEL
+    if ( !handled && event.GetEventType() == wxEVT_KEY_DOWN)
+    {
+        wxWindow *ancestor = this;
+        while (ancestor)
+        {
+            int command = ancestor->GetAcceleratorTable()->GetCommand( event );
+            if (command != -1)
+            {
+                wxEvtHandler * const handler = ancestor->GetEventHandler();
+
+                wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
+                handled = handler->ProcessEvent( command_event );
+
+                if ( !handled )
+                {
+                    // accelerators can also be used with buttons, try them too
+                    command_event.SetEventType(wxEVT_COMMAND_BUTTON_CLICKED);
+                    handled = handler->ProcessEvent( command_event );
+                }
+
+                break;
+            }
+
+            if (ancestor->IsTopLevel())
+                break;
+
+            ancestor = ancestor->GetParent();
+        }
+    }
+#endif // wxUSE_ACCEL
+
+    return handled ;
+}
+
 //
 // wxWidgetImpl 
 //