X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3f4902f50b632326615ee949f590b17dfd3751f5..06f3c649c91e3ad1d7e616495ecc19d83f073a33:/src/mac/uma.cpp?ds=sidebyside diff --git a/src/mac/uma.cpp b/src/mac/uma.cpp index 2c7934a89e..4cfea08505 100644 --- a/src/mac/uma.cpp +++ b/src/mac/uma.cpp @@ -13,6 +13,8 @@ #if !TARGET_CARBON #define GetControlOwner( control ) (**control).contrlOwner +// since we always call this in the right context we don't have to set and reset the port +#define InvalWindowRgn( window , rgn ) InvalRgn( rgn ) #endif static bool sUMAHasAppearance = false ; @@ -459,11 +461,14 @@ void UMAActivateControl( ControlHandle inControl ) { WindowRef theWindow = GetControlOwner(inControl) ; RgnHandle updateRgn = NewRgn() ; -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if TARGET_CARBON GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ; #else GetWindowUpdateRgn( theWindow , updateRgn ) ; #endif + Point zero = { 0 , 0 } ; + LocalToGlobal( &zero ) ; + OffsetRgn( updateRgn , -zero.h , -zero.v ) ; #if UMA_USE_APPEARANCE if ( UMAHasAppearance() ) { @@ -479,22 +484,29 @@ void UMAActivateControl( ControlHandle inControl ) { } #endif -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332) InvalWindowRgn( theWindow, updateRgn) ; #else InvalRgn( updateRgn ) ; #endif + DisposeRgn( updateRgn ) ; + +DisposeRgn( updateRgn ) ; + } void UMADrawControl( ControlHandle inControl ) { WindowRef theWindow = GetControlOwner(inControl) ; RgnHandle updateRgn = NewRgn() ; -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if TARGET_CARBON GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ; #else GetWindowUpdateRgn( theWindow , updateRgn ) ; #endif + Point zero = { 0 , 0 } ; + LocalToGlobal( &zero ) ; + OffsetRgn( updateRgn , -zero.h , -zero.v ) ; #if UMA_USE_APPEARANCE if ( UMAHasAppearance() ) { @@ -510,22 +522,27 @@ void UMADrawControl( ControlHandle inControl ) { } #endif -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332) InvalWindowRgn( theWindow, updateRgn) ; #else InvalRgn( updateRgn ) ; #endif + DisposeRgn( updateRgn ) ; + } void UMAMoveControl( ControlHandle inControl , short x , short y ) { WindowRef theWindow = GetControlOwner(inControl) ; RgnHandle updateRgn = NewRgn() ; -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if TARGET_CARBON GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ; #else GetWindowUpdateRgn( theWindow , updateRgn ) ; #endif + Point zero = { 0 , 0 } ; + LocalToGlobal( &zero ) ; + OffsetRgn( updateRgn , -zero.h , -zero.v ) ; #if UMA_USE_APPEARANCE if ( UMAHasAppearance() ) { @@ -541,22 +558,27 @@ void UMAMoveControl( ControlHandle inControl , short x , short y ) { } #endif -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332) InvalWindowRgn( theWindow, updateRgn) ; #else InvalRgn( updateRgn ) ; #endif + DisposeRgn( updateRgn ) ; + } void UMASizeControl( ControlHandle inControl , short x , short y ) { WindowRef theWindow = GetControlOwner(inControl) ; RgnHandle updateRgn = NewRgn() ; -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if TARGET_CARBON GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ; #else GetWindowUpdateRgn( theWindow , updateRgn ) ; #endif + Point zero = { 0 , 0 } ; + LocalToGlobal( &zero ) ; + OffsetRgn( updateRgn , -zero.h , -zero.v ) ; #if UMA_USE_APPEARANCE if ( UMAHasAppearance() ) { @@ -572,22 +594,28 @@ void UMASizeControl( ControlHandle inControl , short x , short y ) { } #endif -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332) InvalWindowRgn( theWindow, updateRgn) ; #else InvalRgn( updateRgn ) ; #endif + DisposeRgn( updateRgn ) ; + + } void UMADeactivateControl( ControlHandle inControl ) { WindowRef theWindow = GetControlOwner(inControl) ; RgnHandle updateRgn = NewRgn() ; -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if TARGET_CARBON GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ; #else GetWindowUpdateRgn( theWindow , updateRgn ) ; #endif + Point zero = { 0 , 0 } ; + LocalToGlobal( &zero ) ; + OffsetRgn( updateRgn , -zero.h , -zero.v ) ; #if UMA_USE_APPEARANCE if ( UMAHasAppearance() ) { @@ -603,11 +631,13 @@ void UMADeactivateControl( ControlHandle inControl ) { } #endif -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332) InvalWindowRgn( theWindow, updateRgn) ; #else InvalRgn( updateRgn ) ; #endif + DisposeRgn( updateRgn ) ; + } void UMASetThemeWindowBackground (WindowRef inWindow, @@ -700,17 +730,19 @@ void UMADisposeControl (ControlHandle theControl) } } - void UMAHiliteControl (ControlHandle inControl, ControlPartCode hiliteState) { WindowRef theWindow = GetControlOwner(inControl) ; RgnHandle updateRgn = NewRgn() ; -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if TARGET_CARBON GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ; #else GetWindowUpdateRgn( theWindow , updateRgn ) ; #endif + Point zero = { 0 , 0 } ; + LocalToGlobal( &zero ) ; + OffsetRgn( updateRgn , -zero.h , -zero.v ) ; if ( UMAHasAppearance() ) { ::HiliteControl( inControl , hiliteState ) ; @@ -719,22 +751,27 @@ void UMAHiliteControl (ControlHandle inControl, { ::HiliteControl( inControl , hiliteState ) ; } -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332) InvalWindowRgn( theWindow, updateRgn) ; #else InvalRgn( updateRgn ) ; #endif + DisposeRgn( updateRgn ) ; + } void UMAShowControl (ControlHandle inControl) { WindowRef theWindow = GetControlOwner(inControl) ; RgnHandle updateRgn = NewRgn() ; -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if TARGET_CARBON GetWindowRegion( theWindow , kWindowUpdateRgn, updateRgn ) ; #else GetWindowUpdateRgn( theWindow , updateRgn ) ; #endif + Point zero = { 0 , 0 } ; + LocalToGlobal( &zero ) ; + OffsetRgn( updateRgn , -zero.h , -zero.v ) ; if ( UMAHasAppearance() ) { ::ShowControl( inControl ) ; @@ -743,11 +780,13 @@ void UMAShowControl (ControlHandle inControl) { ::ShowControl( inControl ) ; } -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332) InvalWindowRgn( theWindow, updateRgn) ; #else InvalRgn( updateRgn ) ; #endif + DisposeRgn( updateRgn ) ; + } @@ -1001,11 +1040,14 @@ void UMAIdleControls (WindowPtr inWindow) void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) { RgnHandle updateRgn = NewRgn() ; -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if TARGET_CARBON GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn ) ; #else GetWindowUpdateRgn( inWindow , updateRgn ) ; #endif + Point zero = { 0 , 0 } ; + LocalToGlobal( &zero ) ; + OffsetRgn( updateRgn , -zero.h , -zero.v ) ; #if UMA_USE_APPEARANCE if ( UMAHasAppearance() ) { @@ -1021,11 +1063,13 @@ void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) { } #endif -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332) InvalWindowRgn( inWindow, updateRgn) ; #else InvalRgn( updateRgn ) ; #endif + DisposeRgn( updateRgn ) ; + } OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl )