+ControlColorUPP wxMacSetupControlBackgroundUPP = NULL ;
+ControlDefUPP wxMacControlActionUPP = NULL ;
+
+pascal SInt32 wxMacControlDefinition(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param)
+{
+
+ wxControl* wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
+ if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
+ {
+ if( message == drawCntl )
+ {
+ wxMacWindowClipper clip( wx ) ;
+ return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
+ }
+ else
+ return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
+ }
+ return NULL ;
+}
+
+pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
+{
+ OSStatus status = noErr ;
+ switch( iMessage )
+ {
+ case kControlMsgSetUpBackground :
+ {
+ wxControl* wx = (wxControl*) GetControlReference( iControl ) ;
+ if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
+ {
+ wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
+#if TARGET_CARBON
+ // under classic this would lead to partial redraws
+ RgnHandle clip = NewRgn() ;
+ int x = 0 , y = 0;
+
+ wx->MacWindowToRootWindow( &x,&y ) ;
+ CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
+ OffsetRgn( clip , x , y ) ;
+ SetClip( clip ) ;
+ DisposeRgn( clip ) ;
+#endif
+ }
+ else
+ {
+ status = paramErr ;
+ }
+ }
+ break ;
+ default :
+ status = paramErr ;
+ break ;
+ }
+ return status ;
+}
+