X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7205570233ce8420b71fa5df368054c8953ff0e4..88bed4b484a2f78c284c049428cd82adcc69f25d:/src/mac/carbon/aga.cpp

diff --git a/src/mac/carbon/aga.cpp b/src/mac/carbon/aga.cpp
index 76e2d9505b..4f4f139e87 100644
--- a/src/mac/carbon/aga.cpp
+++ b/src/mac/carbon/aga.cpp
@@ -4,7 +4,7 @@
 
 #if 0 // TO BE REMOVED SOON
 
-#include <extcdef.h>
+//#include <extcdef.h>
 #include <PictUtils.h>
 
 pascal SInt32 AGAProgressBarDefProc (SInt16 procID, ControlHandle theControl, ControlDefProcMessage message, SInt32 param);
@@ -1048,7 +1048,7 @@ pascal SInt32 AGABevelButtonDefProc (SInt16 procID, ControlHandle theControl, Co
 					return 0 ;
 					
 				{
-					AGAPortHelper help((**theControl).contrlOwner) ;
+					wxMacPortStateHelper help((**theControl).contrlOwner) ;
 					AGASetFontStyle( &info->fontStyle ) ;
 					Boolean mRadioBehavior = false ;
 					
@@ -1188,7 +1188,7 @@ pascal SInt32 AGAButtonDefProc (SInt16 procID, ControlHandle theControl, Control
 					return 0 ;
 					
 				{
-					AGAPortHelper help((**theControl).contrlOwner) ;
+					wxMacPortStateHelper help((**theControl).contrlOwner) ;
 					AGASetFontStyle( &info->fontStyle ) ;
 					Boolean mRadioBehavior = false ;
 					
@@ -1425,7 +1425,7 @@ pascal SInt32 AGACheckBoxDefProc (SInt16 procID, ControlHandle theControl, Contr
 						return 0 ;
 						
 					{
-						AGAPortHelper help((**theControl).contrlOwner) ;
+						wxMacPortStateHelper help((**theControl).contrlOwner) ;
 						Rect frame =  (**theControl).contrlRect ;
 						Boolean hasColor = true;
 						Boolean disabled = (*theControl)->contrlHilite == 255 ;
@@ -1621,7 +1621,7 @@ pascal SInt32 AGARadioButtonDefProc (SInt16 procID, ControlHandle theControl, Co
 						return 0 ;
 						
 					{
-						AGAPortHelper help() ;
+						wxMacPortStateHelper help() ;
 						Rect frame =  (**theControl).contrlRect ;
 						Boolean hasColor = true;
 						Boolean disabled = (*theControl)->contrlHilite == 255 ;
@@ -1813,7 +1813,7 @@ pascal SInt32 AGAStaticGroupBoxTextDefProc (SInt16 procID, ControlHandle theCont
 				{
 					bool disabled = false ;
 					bool hasColor = true ;
-					AGAPortHelper help((**theControl).contrlOwner) ;
+					wxMacPortStateHelper help((**theControl).contrlOwner) ;
 					AGASetFontStyle( &info->fontStyle ) ;
 					FontInfo fi ;
 					::GetFontInfo( &fi ) ;
@@ -1899,7 +1899,7 @@ pascal SInt32 AGAStaticTextDefProc (SInt16 procID, ControlHandle theControl, Con
 					return 0 ;
 					
 				{
-					AGAPortHelper help((**theControl).contrlOwner) ;
+					wxMacPortStateHelper help((**theControl).contrlOwner) ;
 					AGASetFontStyle( &info->fontStyle ) ;
 					int x =	(**theControl).contrlRect.left ;
 					int y =	(**theControl).contrlRect.top ;
@@ -2094,7 +2094,7 @@ pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, Contr
 	{
 		case initCntl :
 			{
-				AGAPortHelper help((**theControl).contrlOwner) ;
+				wxMacPortStateHelper help((**theControl).contrlOwner) ;
 				SetPort( (**theControl).contrlOwner ) ;
 				::TextFont( kFontIDGeneva ) ; 
 				::TextSize( 10 ) ;
@@ -2116,7 +2116,7 @@ pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, Contr
 			break ;
 		case drawCntl :
 			{
-				AGAPortHelper help((**theControl).contrlOwner) ;
+				wxMacPortStateHelper help((**theControl).contrlOwner) ;
 				AGASetFontStyle( &info->fontStyle ) ;
 				SetPort( (**theControl).contrlOwner ) ;
 				RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
@@ -2223,7 +2223,7 @@ pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, Contr
 			break ;
 		case kControlMsgKeyDown :
 			{
-				AGAPortHelper help( (**theControl).contrlOwner ) ;
+				wxMacPortStateHelper help( (**theControl).contrlOwner ) ;
 				AGASetFontStyle( &info->fontStyle ) ;
 				RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
 				RGBForeColor( &gAGARamp[ kAGABlack ] ) ;
@@ -2332,7 +2332,7 @@ pascal SInt32 AGAListControlDefProc (SInt16 procID, ControlHandle theControl, Co
 			break ;
 		case drawCntl :
 			{
-				AGAPortHelper help((**theControl).contrlOwner) ;
+				wxMacPortStateHelper help((**theControl).contrlOwner) ;
 				AGASetFontStyle( &info->fontStyle ) ;
 				RGBBackColor( &gAGARamp[ kAGAWhite ] ) ;
 				EraseRect( &(**theControl).contrlRect ) ;
@@ -2556,71 +2556,8 @@ void AGAApplyThemeBackground(ThemeBackgroundKind 	inKind,
 
 #endif // !TARGET_CARBON
 
-AGAPortHelper::AGAPortHelper( GrafPtr newport) 
-{
-	GetPort( &port ) ;
-	SetPort( newport ) ;
-//	wxASSERT( newport->portRect.left == 0 && newport->portRect.top == 0 ) ; 
-	GetPenState( &oldPenState ) ;
-	GetBackColor( &oldBackColor ) ;
-	GetForeColor( &oldForeColor ) ;
-
-	clip = NewRgn() ;
-	GetClip( clip );
-	font = GetPortTextFont( newport);
-	size = GetPortTextSize( newport);
-	style = GetPortTextFace( newport);
-	mode = GetPortTextMode( newport);	
-	nport = newport ;
+// this helper class stores and restores the current grafport
+// status in a theme savvy manner, pen mode, patterns and fonts
+// attributes
 
-}
-AGAPortHelper::AGAPortHelper()
-{
-	clip = NULL ;
-}
-void AGAPortHelper::Setup( GrafPtr newport )
-{
-	GetPort( &port ) ;
-	SetPort( newport ) ;
-//	wxASSERT( newport->portRect.left == 0 && newport->portRect.top == 0 ) ; 
-	GetPenState( &oldPenState ) ;
-	GetBackColor( &oldBackColor ) ;
-	GetForeColor( &oldForeColor ) ;
-	wxASSERT( clip == NULL ) ;
-	clip = NewRgn() ;
-	GetClip( clip );
-	font = GetPortTextFont( newport);
-	size = GetPortTextSize( newport);
-	style = GetPortTextFace( newport);
-	mode = GetPortTextMode( newport);	
-	nport = newport ;
-}
-void AGAPortHelper::Clear()
-{
-	if ( clip )
-	{
-		DisposeRgn( clip ) ;
-		clip = NULL ;
-	}
-}
-AGAPortHelper::~AGAPortHelper()
-{
-	if ( clip )
-	{
-		SetPort( nport ) ;
-		PenNormal() ;
-		SetClip( clip ) ;
-		DisposeRgn( clip ) ;
-		RGBForeColor(&oldForeColor);
-		RGBBackColor(&oldBackColor);
-		SetPenState(&oldPenState);				
-
-		TextFont( font );
-		TextSize( size );
-		TextFace( style );
-		TextMode( mode );
-		SetOrigin( 0 , 0 ) ;
-		SetPort( port ) ;
-	}
-}