]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/nonownedwnd.cpp
compilation fix for wxOSX/Cocoa: don't use Carbon functions in common to all OS X...
[wxWidgets.git] / src / osx / carbon / nonownedwnd.cpp
index 67c13fac0bfb8eb0ec26b22344838864c028db56..da850b200dc650fcbe80ecf984da880081695808 100644 (file)
@@ -99,12 +99,18 @@ bool wxNonOwnedWindowCarbonImpl::SetBackgroundColour(const wxColour& col )
     if ( col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDocumentWindowBackground)) )
     {
         SetThemeWindowBackground( (WindowRef) m_macWindow,  kThemeBrushDocumentWindowBackground, false ) ;
-        SetBackgroundStyle(wxBG_STYLE_SYSTEM);
+        m_wxPeer->SetBackgroundStyle(wxBG_STYLE_SYSTEM);
+        // call directly if object is not yet completely constructed
+        if ( m_wxPeer->GetNonOwnedPeer() == NULL )
+            SetBackgroundStyle(wxBG_STYLE_SYSTEM);
     }
     else if ( col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive)) )
     {
         SetThemeWindowBackground( (WindowRef) m_macWindow,  kThemeBrushDialogBackgroundActive, false ) ;
-        SetBackgroundStyle(wxBG_STYLE_SYSTEM);
+        m_wxPeer->SetBackgroundStyle(wxBG_STYLE_SYSTEM);
+        // call directly if object is not yet completely constructed
+        if ( m_wxPeer->GetNonOwnedPeer() == NULL )
+            SetBackgroundStyle(wxBG_STYLE_SYSTEM);
     }
     return true;
 }
@@ -611,9 +617,9 @@ wxMacTopLevelMouseEventHandler(EventHandlerCallRef WXUNUSED(handler),
                     // instead of its children (wxToolBarTools)
                     ControlRef parent ;
                     GetSuperControl(control, &parent );
-                    wxWindow *wxParent = (wxWindow*) wxFindWindowFromWXWidget((WXWidget) parent ) ;
-                    if ( wxParent && wxParent->IsKindOf( CLASSINFO( wxToolBar ) ) )
-                        currentMouseWindow = wxParent ;
+                    wxWindow *wxparent = (wxWindow*) wxFindWindowFromWXWidget((WXWidget) parent ) ;
+                    if ( wxparent && wxparent->IsKindOf( CLASSINFO( wxToolBar ) ) )
+                        currentMouseWindow = wxparent ;
 #endif
                 }
 #endif
@@ -733,7 +739,7 @@ wxMacTopLevelMouseEventHandler(EventHandlerCallRef WXUNUSED(handler),
 
         wxWindow* cursorTarget = currentMouseWindow ;
         wxPoint cursorPoint( wxevent.m_x , wxevent.m_y ) ;
-
+        
         extern wxCursor gGlobalCursor;
 
         if (!gGlobalCursor.IsOk())
@@ -749,6 +755,16 @@ wxMacTopLevelMouseEventHandler(EventHandlerCallRef WXUNUSED(handler),
     }
     else // currentMouseWindow == NULL
     {
+        if (toplevelWindow && !control)
+        {
+           extern wxCursor gGlobalCursor;
+           if (!gGlobalCursor.IsOk())
+           {
+                // update cursor when over toolbar and titlebar etc.
+                wxSTANDARD_CURSOR->MacInstall() ;
+           }
+        }
+    
         // don't mess with controls we don't know about
         // for some reason returning eventNotHandledErr does not lead to the correct behaviour
         // so we try sending them the correct control directly
@@ -1171,7 +1187,7 @@ void wxNonOwnedWindowCarbonImpl::Create(
     const wxPoint& pos,
     const wxSize& size,
     long style, long extraStyle, 
-    const wxString& name )
+    const wxString& WXUNUSED(name) )
 {
 
     OSStatus err = noErr ;
@@ -1630,9 +1646,9 @@ void wxNonOwnedWindowCarbonImpl::ScreenToWindow( int *x, int *y )
     HIViewFindByID( HIViewGetRoot( m_macWindow ), kHIViewWindowContentID , &contentView) ;
     HIPointConvert( &p, kHICoordSpace72DPIGlobal, NULL, kHICoordSpaceView, contentView );
     if ( x )
-        *x = p.x;
+        *x = (int)p.x;
     if ( y )
-        *y = p.y;
+        *y = (int)p.y;
 }
 
 void wxNonOwnedWindowCarbonImpl::WindowToScreen( int *x, int *y )
@@ -1643,9 +1659,9 @@ void wxNonOwnedWindowCarbonImpl::WindowToScreen( int *x, int *y )
     HIViewFindByID( HIViewGetRoot( m_macWindow ), kHIViewWindowContentID , &contentView) ;
     HIPointConvert( &p, kHICoordSpaceView, contentView, kHICoordSpace72DPIGlobal, NULL );
     if ( x )
-        *x = p.x;
+        *x = (int)p.x;
     if ( y )
-        *y = p.y;
+        *y = (int)p.y;
 }
 
 wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,