extern long wxMacTranslateKey(unsigned char key, unsigned char code) ;
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor ) ;
-#ifndef MAC_OS_X_VERSION_10_3
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3
enum {
kEventControlVisibilityChanged = 157
};
{
updateRgn = (RgnHandle) visRegion.GetWXHRGN() ;
}
- else
- {
- // unfortunately this update region may be incorrect (tree ctrl sample )
- // so we have to reset it
- // updateRgn = (RgnHandle) visRegion.GetWXHRGN() ;
- }
// GrafPtr myport = cEvent.GetParameter<GrafPtr>(kEventParamGrafPort,typeGrafPtr) ;
-#if 0 // in case we would need a coregraphics compliant background erase first
+#if 0
+ // in case we would need a coregraphics compliant background erase first
+ // now usable to track redraws
CGContextRef cgContext = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef) ;
if ( thisWindow->MacIsUserPane() )
{
+ static float color = 0.5 ;
+ static channel = 0 ;
HIRect bounds;
- err = HIViewGetBounds( controlRef, &bounds );
- CGContextSetRGBFillColor( cgContext, 1 , 1 , 1 , 1 );
-// CGContextSetRGBFillColor( cgContext, .95, .95, .95, 1 );
+ HIViewGetBounds( controlRef, &bounds );
+ CGContextSetRGBFillColor( cgContext, channel == 0 ? color : 0.5 ,
+ channel == 1 ? color : 0.5 , channel == 2 ? color : 0.5 , 1 );
CGContextFillRect( cgContext, bounds );
+ color += 0.1 ;
+ if ( color > 0.9 )
+ {
+ color = 0.5 ;
+ channel++ ;
+ if ( channel == 3 )
+ channel = 0 ;
+ }
}
#endif
if ( thisWindow->MacDoRedraw( updateRgn , cEvent.GetTicks() ) )
result = noErr ;
- else
- result = eventNotHandledErr;
}
break ;
case kEventControlVisibilityChanged :
void wxWindowMac::MacControlUserPaneDrawProc(wxInt16 part)
{
- MacDoRedraw( MacGetVisibleRegion().GetWXHRGN() , 0 ) ;
+ RgnHandle rgn = NewRgn() ;
+ GetClip( rgn ) ;
+ wxMacWindowStateSaver sv( this ) ;
+ SectRgn( rgn , (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , rgn ) ;
+ MacDoRedraw( rgn , 0 ) ;
+ DisposeRgn( rgn ) ;
}
wxInt16 wxWindowMac::MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y)
{
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
- UInt32 features = kControlSupportsEmbedding | kControlSupportsLiveFeedback /*| kControlHasSpecialBackground */ | kControlSupportsCalcBestRect | kControlHandlesTracking | kControlSupportsFocus | kControlWantsActivate | kControlWantsIdle;
+ UInt32 features = kControlSupportsEmbedding | kControlSupportsLiveFeedback | kControlHasSpecialBackground |
+ kControlSupportsCalcBestRect | kControlHandlesTracking | kControlSupportsFocus | kControlWantsActivate | kControlWantsIdle;
- ::CreateUserPaneControl( MAC_WXHWND(GetParent()->MacGetTopLevelWindowRef()) , &bounds, features, (ControlRef*) &m_macControl);
+ ::CreateUserPaneControl( MAC_WXHWND(GetParent()->MacGetTopLevelWindowRef()) , &bounds, kControlSupportsEmbedding , (ControlRef*) &m_macControl);
MacPostControlCreate(pos,size) ;
#if !TARGET_API_MAC_OSX
if ( doMove || doResize )
{
Rect r = wxMacGetBoundsForControl(this , wxPoint( actualX,actualY), wxSize( actualWidth, actualHeight ) ) ;
+ bool vis = IsControlVisible( (ControlRef) m_macControl ) ;
#if TARGET_API_MAC_OSX
- SetControlBounds( (ControlRef) m_macControl , &r ) ;
+ // the HIViewSetFrame call itself should invalidate the areas, but when testing with the UnicodeTextCtrl it does not !
+ if ( vis )
+ SetControlVisibility( (ControlRef)m_macControl , false , true ) ;
+ HIRect hir = { r.left , r.top , r.right - r.left , r.bottom - r.top } ;
+ HIViewSetFrame ( (ControlRef) m_macControl , &hir ) ;
+ if ( vis )
+ SetControlVisibility( (ControlRef)m_macControl , true , true ) ;
#else
+// TODO TEST SetControlBounds( (ControlRef) m_macControl , &r ) ;
+ if ( vis )
+ SetControlVisibility( (ControlRef)m_macControl , false , true ) ;
if ( doMove )
MoveControl( (ControlRef) m_macControl , r.left , r.top ) ;
if ( doSize )
SizeControl( (ControlRef) m_macControl , r.right-r.left , r.bottom-r.top ) ;
+ if ( vis )
+ SetControlVisibility( (ControlRef)m_macControl , true , true ) ;
#endif
MacRepositionScrollBars() ;
if ( doMove )
HIViewSetNeedsDisplayInRegion( (ControlRef) m_macControl , update , true ) ;
}
#else
+/*
+ RgnHandle updateRgn = NewRgn() ;
+ if ( rect == NULL )
+ {
+ CopyRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , updateRgn ) ;
+ }
+ else
+ {
+ SetRectRgn( updateRgn , rect->x , rect->y , rect->x + rect->width , rect->y + rect->height ) ;
+ SectRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , updateRgn , updateRgn ) ;
+ }
+ InvalWindowRgn( (WindowRef) MacGetTopLevelWindowRef() , updateRgn ) ;
+ DisposeRgn(updateRgn) ;
+*/
if ( IsControlVisible( (ControlRef) m_macControl ) )
{
SetControlVisibility( (ControlRef) m_macControl , false , false ) ;