]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/aga.cpp
ProcessXEvent now returns TRUE if processed, FALSE if not
[wxWidgets.git] / src / mac / carbon / aga.cpp
index d356a5ac1d93380f407fe47664a746939a78bc69..4f4f139e8785183f413d8c09a87c3d227bdcc91c 100644 (file)
@@ -1,9 +1,10 @@
-#include <wx/mac/uma.h>
-#include <wx/mac/aga.h>
+#include "wx/dc.h"
+#include "wx/mac/uma.h"
+#include "wx/mac/aga.h"
 
-#if !TARGET_CARBON
+#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);
@@ -13,26 +14,27 @@ pascal SInt32 AGAListControlDefProc (SInt16 procID, ControlHandle theControl, Co
 pascal SInt32 AGAEditTextDefProc (SInt16 procID, ControlHandle theControl, ControlDefProcMessage message, SInt32 param) ;
 pascal SInt32 AGAStaticGroupBoxTextDefProc (SInt16 procID, ControlHandle theControl, ControlDefProcMessage message, SInt32 param) ;
 
-#define B                                                                                                              13
-#define        W                                                                                                               0
+#define B   13
+#define        W   0
 
 SInt16 kAGARootControlProcID ;
 int gAGABackgroundColor = 0 ;
 
-const RGBColor gAGAColorArray[] = {    {0xFFFF, 0xFFFF, 0xFFFF},               //      W
-                                       {0xEEEE, 0xEEEE, 0xEEEE},       //      1
-                                       {0xDDDD, 0xDDDD, 0xDDDD},       //      2
-                                       {0xCCCC, 0xCCCC, 0xCCCC},       //      3
-                                       {0xBBBB, 0xBBBB, 0xBBBB},       //      4
-                                       {0xAAAA, 0xAAAA, 0xAAAA},       //      5
-                                       {0x9999, 0x9999, 0x9999},       //      6
-                                       {0x8888, 0x8888, 0x8888},               //      7
-                                       {0x7777, 0x7777, 0x7777},               //      8
-                                       {0x6666, 0x6666, 0x6666},               //      9
-                                       {0x5555, 0x5555, 0x5555},               //      10
-                                       {0x4444, 0x4444, 0x4444},               //      11
-                                       {0x2222, 0x2222, 0x2222},               //      12
-                                       {0x0000, 0x0000, 0x0000}                //      B
+const RGBColor gAGAColorArray[] = {
+  {0xFFFF, 0xFFFF, 0xFFFF},    //      W
+  {0xEEEE, 0xEEEE, 0xEEEE},    //      1
+  {0xDDDD, 0xDDDD, 0xDDDD},    //      2
+  {0xCCCC, 0xCCCC, 0xCCCC},    //      3
+  {0xBBBB, 0xBBBB, 0xBBBB},    //      4
+  {0xAAAA, 0xAAAA, 0xAAAA},    //      5
+  {0x9999, 0x9999, 0x9999},    //      6
+  {0x8888, 0x8888, 0x8888},    //      7
+  {0x7777, 0x7777, 0x7777},    //      8
+  {0x6666, 0x6666, 0x6666},    //      9
+  {0x5555, 0x5555, 0x5555},    //      10
+  {0x4444, 0x4444, 0x4444},    //      11
+  {0x2222, 0x2222, 0x2222},    //      12
+  {0x0000, 0x0000, 0x0000}     //      B
 };
 
 char LAGADefaultOutline_mCorners[4][5][5] =    {
@@ -1046,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 ;
                                        
@@ -1186,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 ;
                                        
@@ -1423,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 ;
@@ -1619,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 ;
@@ -1811,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 ) ;
@@ -1897,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 ;
@@ -2092,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 ) ;
@@ -2114,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 ] ) ;
@@ -2221,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 ] ) ;
@@ -2330,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 ) ;
@@ -2552,70 +2554,10 @@ void AGAApplyThemeBackground(ThemeBackgroundKind        inKind,
 {
 }
 
-#endif
-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 ;
+#endif // !TARGET_CARBON
+
+// 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 ) ;
-
-       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 ) ;
-               SetClip( clip ) ;
-               DisposeRgn( clip ) ;
-               RGBForeColor(&oldForeColor);
-               RGBBackColor(&oldBackColor);
-               SetPenState(&oldPenState);                              
-
-               TextFont( font );
-               TextSize( size );
-               TextFace( style );
-               TextMode( mode );
-               SetPort( port ) ;
-       }
-}