X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fdaf613add176525ed8b6cafaf278dfd80f85074..ef70f0ecdbc4268923e132b257c95e8a2525f4ca:/src/mac/uma.cpp

diff --git a/src/mac/uma.cpp b/src/mac/uma.cpp
index c96a8f93de..52e0497c55 100644
--- a/src/mac/uma.cpp
+++ b/src/mac/uma.cpp
@@ -3,9 +3,7 @@
 #include "wx/mac/uma.h"
 #include "wx/mac/aga.h"
 
-#ifdef __UNIX__
-  #include <Carbon/Carbon.h>
-#else
+#ifndef __UNIX__
   #include <Navigation.h>
 #endif
 
@@ -291,7 +289,11 @@ void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId )
 
 int gPrOpenCounter = 0 ;
 
-OSStatus UMAPrOpen() 
+#if TARGET_CARBON && PM_USE_SESSION_APIS
+OSStatus UMAPrOpen(PMPrintSession *macPrintSession)
+#else
+OSStatus UMAPrOpen()
+#endif
 {
 #if !TARGET_CARBON
 	OSErr err = noErr ;
@@ -308,14 +310,22 @@ OSStatus UMAPrOpen()
 	++gPrOpenCounter ;
 	if ( gPrOpenCounter == 1 )
 	{
-		err = PMBegin() ;
+  #if PM_USE_SESSION_APIS
+	    err = PMCreateSession(macPrintSession) ;
+  #else
+	    err = PMBegin() ;
+  #endif
 		wxASSERT( err == noErr ) ;
 	}
 	return err ;
 #endif
 }
 
-OSStatus UMAPrClose() 
+#if TARGET_CARBON && PM_USE_SESSION_APIS
+OSStatus UMAPrClose(PMPrintSession *macPrintSession)
+#else
+OSStatus UMAPrClose()
+#endif
 {
 #if !TARGET_CARBON
 	OSErr err = noErr ;
@@ -333,7 +343,12 @@ OSStatus UMAPrClose()
 	wxASSERT( gPrOpenCounter >= 1 ) ;
 	if ( gPrOpenCounter == 1 )
 	{
-		err = PMEnd() ;
+  #if PM_USE_SESSION_APIS
+	    err = PMRelease(*macPrintSession) ;
+	    *macPrintSession = kPMNoReference;
+  #else
+	    err = PMEnd() ;
+  #endif
 	}
 	--gPrOpenCounter ;
 	return err ;
@@ -471,7 +486,8 @@ void UMAActivateControl( ControlHandle inControl )
         ::ActivateControl( inControl ) ;
         if ( visible ) {
           SetControlVisibility( inControl , true , false ) ;
-          InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+          Rect ctrlBounds ;
+          InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
         }
        }
     }
@@ -530,12 +546,14 @@ void UMAMoveControl( ControlHandle inControl , short x , short y )
         bool visible = UMAIsControlVisible( inControl ) ;
         if ( visible ) {
           SetControlVisibility( inControl , false , false ) ;
-          InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+          Rect ctrlBounds ;
+          InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
         }
         ::MoveControl( inControl , x , y ) ;
         if ( visible ) {
           SetControlVisibility( inControl , true , false ) ;
-          InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+          Rect ctrlBounds ;
+          InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
         }
     }
 }
@@ -547,12 +565,14 @@ void UMASizeControl( ControlHandle inControl , short x , short y )
         bool visible = UMAIsControlVisible( inControl ) ;
         if ( visible ) {
           SetControlVisibility( inControl , false , false ) ;
-          InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+          Rect ctrlBounds ;
+          InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
         }
         ::SizeControl( inControl , x , y ) ;
         if ( visible ) {
           SetControlVisibility( inControl , true , false ) ;
-          InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+          Rect ctrlBounds ;
+          InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
         }
     }
 }
@@ -569,7 +589,8 @@ void UMADeactivateControl( ControlHandle inControl )
         ::DeactivateControl( inControl ) ;
         if ( visible ) {
           SetControlVisibility( inControl , true , false ) ;
-          InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
+          Rect ctrlBounds ;
+          InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
         }
        }
     }
@@ -684,11 +705,8 @@ void UMAShowControl						(ControlHandle 			inControl)
     if ( UMAHasAppearance() )
     {
         SetControlVisibility( inControl , true , false ) ;
-        InvalWindowRect(GetControlOwner(inControl),&(**inControl).contrlRect ) ;
-    }
-    else
-    {
-        (**inControl).contrlVis = 255 ;
+        Rect ctrlBounds ;
+        InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
     }
 }