- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#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() )
- {
- ::DeactivateControl( inControl ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- {
- AGADeactivateControl( inControl ) ;
- }
-#else
- {
- }
-#endif
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
-}
-
-void UMASetThemeWindowBackground (WindowRef inWindow,
- ThemeBrush inBrush,
- Boolean inUpdate)
-{
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- ::SetThemeWindowBackground( inWindow ,inBrush , inUpdate ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- {
- AGASetThemeWindowBackground( inWindow , inBrush , inUpdate ) ;
- }
-#else
- {
- }
-#endif
-}
-
-void UMAApplyThemeBackground (ThemeBackgroundKind inKind,
- const Rect * bounds,
- ThemeDrawState inState,
- SInt16 inDepth,
- Boolean inColorDev)
-{
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- /*
- if ( sUMAAppearanceVersion >= 0x0110 )
- ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
- */
- }
- else
-#endif
-#if !TARGET_CARBON
- {
- AGAApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ;
- }
-#else
- {
- }
-#endif
-}
-
-ControlHandle UMANewControl(WindowPtr owningWindow,
- const Rect * boundsRect,
- ConstStr255Param controlTitle,
- Boolean initiallyVisible,
- SInt16 initialValue,
- SInt16 minimumValue,
- SInt16 maximumValue,
- SInt16 procID,
- SInt32 controlReference)
-{
- ControlHandle theControl = NULL ;
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- theControl = NewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
- initialValue , minimumValue , maximumValue , procID , controlReference ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- {
- theControl = AGANewControl( owningWindow , boundsRect , controlTitle , initiallyVisible ,
- initialValue , minimumValue , maximumValue , procID , controlReference ) ;
- }
-#else
- {
- }
-#endif
- return theControl ;
-}
-
-void UMADisposeControl (ControlHandle theControl)
-{
- if ( UMAHasAppearance() )
- {
- ::DisposeControl( theControl ) ;
- }
- else
- {
- ::DisposeControl( theControl ) ;
- }
-}
-
-void UMAHiliteControl (ControlHandle inControl,
- ControlPartCode hiliteState)
-{
- WindowRef theWindow = GetControlOwner(inControl) ;
- RgnHandle updateRgn = NewRgn() ;
-#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 ) ;
- }
- else
- {
- ::HiliteControl( inControl , hiliteState ) ;
- }
-#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 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 ) ;
- }
- else
- {
- ::ShowControl( inControl ) ;
- }
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( theWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-
-}
-
-
-void UMAHideControl (ControlHandle inControl)
-{
- if ( UMAHasAppearance() )
- {
- ::HideControl( inControl ) ;
- }
- else
- {
- ::HideControl( inControl ) ;
- }
-}
-
-
-void UMASetControlVisibility (ControlHandle inControl,
- Boolean inIsVisible,
- Boolean inDoDraw)
-{
- if ( UMAHasAppearance() )
- {
-#if UMA_USE_APPEARANCE
- ::SetControlVisibility( inControl , inIsVisible, inDoDraw ) ;
-#endif
- }
-}
-
-
-
-bool UMAIsControlActive (ControlHandle inControl)
-{
-#if TARGET_CARBON
- return IsControlActive( inControl ) ;
-#else
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- return IsControlActive( inControl ) ;
- }
- else
-#endif
- return (**inControl).contrlHilite == 0 ;
-#endif
-}
-
-
-bool UMAIsControlVisible (ControlHandle inControl)
-{
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- return IsControlVisible( inControl ) ;
- }
-#endif
- return true ;
-}
-
-OSErr UMAGetBestControlRect (ControlHandle inControl,
- Rect * outRect,
- SInt16 * outBaseLineOffset)
-{
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- return GetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- {
- return AGAGetBestControlRect( inControl , outRect , outBaseLineOffset ) ;
- }
-#else
- {
- return noErr ;
- }
-#endif
-}
-
-
-OSErr UMASetControlFontStyle (ControlHandle inControl,
- const ControlFontStyleRec * inStyle)
-{
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- return ::SetControlFontStyle( inControl , inStyle ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- return AGASetControlFontStyle( inControl , inStyle ) ;
-#else
- {
- return noErr ;
- }
-#endif
-}
-
-
-
-// control hierarchy
-
-OSErr UMACreateRootControl (WindowPtr inWindow,
- ControlHandle * outControl)
-{
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- return CreateRootControl( inWindow , outControl ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- return AGACreateRootControl( inWindow , outControl ) ;
-#else
- {
- return noErr ;
- }
-#endif
-}
-
-
-
-OSErr UMAEmbedControl (ControlHandle inControl,
- ControlHandle inContainer)
-{
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- return EmbedControl( inControl , inContainer ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- return AGAEmbedControl( inControl , inContainer ) ; ;
-#else
- {
- return noErr ;
- }
-#endif
-}
-
-
-
-// keyboard focus
-OSErr UMASetKeyboardFocus (WindowPtr inWindow,
- ControlHandle inControl,
- ControlFocusPart inPart)
-{
- OSErr err = noErr;
- GrafPtr port ;
- GetPort( &port ) ;
-#if TARGET_CARBON
- SetPort( GetWindowPort( inWindow ) ) ;
-#else
- SetPort( inWindow ) ;
-#endif
- SetOrigin( 0 , 0 ) ;
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- err = AGASetKeyboardFocus( inWindow , inControl , inPart ) ;
-#else
- {
- }
-#endif
- SetPort( port ) ;
- return err ;
-}
-
-
-
-
-// events
-
-ControlPartCode UMAHandleControlClick (ControlHandle inControl,
- Point inWhere,
- SInt16 inModifiers,
- ControlActionUPP inAction)
-{
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- return HandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- {
- return AGAHandleControlClick( inControl , inWhere , inModifiers , inAction ) ;
- }
-#else
- {
- return noErr ;
- }
-#endif
-}
-
-
-SInt16 UMAHandleControlKey (ControlHandle inControl,
- SInt16 inKeyCode,
- SInt16 inCharCode,
- SInt16 inModifiers)
-{
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- return HandleControlKey( inControl , inKeyCode , inCharCode , inModifiers ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- {
- return AGAHandleControlKey(inControl , inKeyCode , inCharCode , inModifiers ) ;
- }
-#else
- {
- return noErr ;
- }
-#endif
-}
-
-
-
-void UMAIdleControls (WindowPtr inWindow)
-{
-#if UMA_USE_APPEARANCE
- if ( UMAHasAppearance() )
- {
- IdleControls( inWindow ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- {
- AGAIdleControls( inWindow ) ;
- }
-#else
- {
- }
-#endif
-}
-
-void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn )
-{
- RgnHandle updateRgn = NewRgn() ;
-#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() )
- {
- UpdateControls( inWindow , inRgn ) ;
- }
- else
-#endif
-#if !TARGET_CARBON
- {
- AGAUpdateControls( inWindow , inRgn ) ;
- }
-#else
- {
- }
-#endif
-#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332)
- InvalWindowRgn( inWindow, updateRgn) ;
-#else
- InvalRgn( updateRgn ) ;
-#endif
- DisposeRgn( updateRgn ) ;
-