]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/window_osx.cpp
Removed extraneous semicolons and commas (partly fixes #10456).
[wxWidgets.git] / src / osx / window_osx.cpp
index ac75853aa46d6af9ea02f672b1cf25e130132682..b9817fbfc108ed1af488756b191a5dcdbbfe0a20 100644 (file)
@@ -141,8 +141,6 @@ wxWindowMac::~wxWindowMac()
 {
     SendDestroyEvent();
 
-    m_isBeingDeleted = true;
-
     MacInvalidateBorders() ;
 
 #ifndef __WXUNIVERSAL__
@@ -153,7 +151,7 @@ wxWindowMac::~wxWindowMac()
         if ( frame )
         {
             if ( frame->GetLastFocus() == this )
-                frame->SetLastFocus((wxWindow*)NULL);
+                frame->SetLastFocus(NULL);
             break;
         }
     }
@@ -459,6 +457,7 @@ void wxWindowMac::SetFocus()
 void wxWindowMac::DoCaptureMouse()
 {
     wxApp::s_captureWindow = (wxWindow*) this ;
+    m_peer->CaptureMouse() ;
 }
 
 wxWindow * wxWindowBase::GetCapture()
@@ -469,6 +468,8 @@ wxWindow * wxWindowBase::GetCapture()
 void wxWindowMac::DoReleaseMouse()
 {
     wxApp::s_captureWindow = NULL ;
+
+    m_peer->ReleaseMouse() ;
 }
 
 #if wxUSE_DRAG_AND_DROP
@@ -723,37 +724,8 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor)
     wxASSERT_MSG( m_cursor.Ok(),
         wxT("cursor must be valid after call to the base version"));
 
-    wxWindowMac *mouseWin = 0 ;
-#if wxOSX_USE_CARBON
-    {
-        wxNonOwnedWindow *tlw = MacGetTopLevelWindow() ;
-        WindowRef window = (WindowRef) ( tlw ? tlw->GetWXWindow() : 0 ) ;
-
-        ControlPartCode part ;
-        ControlRef control ;
-        Point pt ;
- #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
-        HIPoint hiPoint ;
-        HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint);
-        pt.h = hiPoint.x;
-        pt.v = hiPoint.y;
- #else
-        GetGlobalMouse( &pt );
-        int x = pt.h;
-        int y = pt.v;
-        ScreenToClient(&x, &y);
-        pt.h = x;
-        pt.v = y;
-#endif
-        control = FindControlUnderMouse( pt , window , &part ) ;
-        if ( control )
-            mouseWin = wxFindWindowFromWXWidget( (WXWidget) control ) ;
-
-    }
-#endif
-
-    if ( mouseWin == this && !wxIsBusy() )
-        m_cursor.MacInstall() ;
+    if ( GetPeer() != NULL )
+        GetPeer()->SetCursor( m_cursor );
 
     return true ;
 }
@@ -992,6 +964,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;
     }
 
@@ -2236,9 +2215,7 @@ void wxWindowMac::OnPaint( wxPaintEvent & WXUNUSED(event) )
 #endif
 }
 
-void wxWindowMac::MacHandleControlClick(WXWidget WXUNUSED(control),
-                                        wxInt16 WXUNUSED(controlpart),
-                                        bool WXUNUSED(mouseStillDown))
+void wxWindowMac::TriggerScrollEvent( wxEventType WXUNUSED(scrollEvent) )
 {
 }
 
@@ -2252,7 +2229,7 @@ Rect wxMacGetBoundsForControl( wxWindowMac* window , const wxPoint& pos , const
     return bounds ;
 }
 
-bool wxWindowMac::HandleClicked( double timestampsec )
+bool wxWindowMac::OSXHandleClicked( double timestampsec )
 {
     return false;
 }
@@ -2260,7 +2237,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 ;
@@ -2326,6 +2303,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 
 //