]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/toplevel.cpp
debug handling. More broken Apple 'goodness'
[wxWidgets.git] / src / mac / carbon / toplevel.cpp
index 0368071037ecda6ed739788a8ece787d9e8c4a23..111ecb19953a7dabe64cce792bb4defbef07c926 100644 (file)
@@ -442,7 +442,19 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
             if ( control == 0 )
                 currentMouseWindow = (wxWindow*) data ;
             else
+            {
                 currentMouseWindow = wxFindControlFromMacControl( control ) ;
+                if ( currentMouseWindow == NULL && cEvent.GetKind() == kEventMouseMoved )
+                {
+                       // for wxToolBar to function we have to send certaint events to it
+                       // instead of its children (wxToolBarTools)     
+                    ControlRef parent ;
+                    GetSuperControl(control, &parent );
+                    wxWindow *wxParent = wxFindControlFromMacControl( parent ) ;
+                    if ( wxParent && wxParent->IsKindOf( CLASSINFO( wxToolBar ) ) )
+                        currentMouseWindow = wxParent ;
+                }
+            }
         }        
     }
     
@@ -535,13 +547,16 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
                 (FindControlUnderMouse(windowMouseLocation , window , &dummyPart) != 
                 wxMacFindControlUnderMouse( windowMouseLocation , window , &dummyPart ) ) )
             {
-                EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ;
-                Point clickLocation = windowMouseLocation ;
-#if TARGET_API_MAC_OSX
-                currentMouseWindow->MacRootWindowToWindow( &clickLocation.h , &clickLocation.v ) ;
-#endif
-                HandleControlClick( (ControlRef) currentMouseWindow->GetHandle() , clickLocation ,
-                    modifiers , (ControlActionUPP ) -1 ) ;
+                if ( currentMouseWindow->MacIsReallyEnabled() ) 
+                {
+                    EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ;
+                    Point clickLocation = windowMouseLocation ;
+    #if TARGET_API_MAC_OSX
+                    currentMouseWindow->MacRootWindowToWindow( &clickLocation.h , &clickLocation.v ) ;
+    #endif
+                    HandleControlClick( (ControlRef) currentMouseWindow->GetHandle() , clickLocation ,
+                        modifiers , (ControlActionUPP ) -1 ) ;
+                }
                 result = noErr ;
             }
         }
@@ -807,6 +822,7 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent,
     SetName(name);
 
     m_windowId = id == -1 ? NewControlId() : id;
+    wxWindow::SetTitle( title ) ;
 
     MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;