3 #include "wx/mac/uma.h" 
   4 #include "wx/mac/aga.h" 
   7   #include <Navigation.h> 
  13 #define GetControlOwner( control ) (**control).contrlOwner 
  14 // since we always call this in the right context we don't have to set and reset the port 
  15 #define InvalWindowRgn( window , rgn ) InvalRgn( rgn ) 
  18 static bool     sUMAHasAppearance 
= false ; 
  19 static long sUMAAppearanceVersion 
= 0 ; 
  20 extern int gAGABackgroundColor 
; 
  21 bool UMAHasAppearance() { return sUMAHasAppearance 
; } 
  22 long UMAGetAppearanceVersion() { return sUMAAppearanceVersion 
; } 
  24 static bool     sUMAHasWindowManager 
= false ; 
  25 static long sUMAWindowManagerAttr 
= 0 ; 
  27 bool UMAHasWindowManager() { return sUMAHasWindowManager 
; } 
  28 long UMAGetWindowManagerAttr() { return sUMAWindowManagerAttr 
; } 
  29 void UMACleanupToolbox() 
  31 #if UMA_USE_APPEARANCE 
  32         if ( sUMAHasAppearance 
) 
  34                 UnregisterAppearanceClient() ; 
  37         if ( NavServicesAvailable() ) 
  42 void UMAInitToolbox( UInt16 inMoreMastersCalls 
) 
  46         for (long i 
= 1; i 
<= inMoreMastersCalls
; i
++) 
  49         ::InitGraf(&qd
.thePort
); 
  54         ::FlushEvents(everyEvent
, 0); 
  57         PurgeSpace(&total
, &contig
); 
  62 #if UMA_USE_APPEARANCE 
  64         if ( Gestalt( gestaltAppearanceAttr
, &theAppearance 
) == noErr 
) 
  66                 sUMAHasAppearance 
= true ; 
  67                 RegisterAppearanceClient(); 
  68                 if ( Gestalt( gestaltAppearanceVersion
, &theAppearance 
) == noErr 
) 
  70                         sUMAAppearanceVersion 
= theAppearance 
; 
  74                         sUMAAppearanceVersion 
= 0x0100 ; 
  77 #endif // UMA_USE_APPEARANCE 
  80         if ( Gestalt( gestaltWindowMgrAttr
, &sUMAWindowManagerAttr 
) == noErr 
) 
  82                 sUMAHasWindowManager 
= sUMAWindowManagerAttr 
& gestaltWindowMgrPresent 
; 
  84 #endif // UMA_USE_WINDOWMGR 
  89 // Call currently implicitely done :            InitFloatingWindows() ; 
  91         if ( sUMAHasWindowManager 
) 
  92                 InitFloatingWindows() ; 
  98         if ( NavServicesAvailable() ) 
 105 long UMAGetProcessMode()  
 108         ProcessInfoRec processinfo
; 
 109         ProcessSerialNumber procno 
; 
 111         procno
.highLongOfPSN 
= NULL 
; 
 112         procno
.lowLongOfPSN 
= kCurrentProcess 
; 
 113         processinfo
.processInfoLength 
= sizeof(ProcessInfoRec
); 
 114         processinfo
.processName 
= NULL
; 
 115         processinfo
.processAppSpec 
= NULL
; 
 117         err 
= ::GetProcessInformation( &procno 
, &processinfo 
) ; 
 118         wxASSERT( err 
== noErr 
) ; 
 119         return processinfo
.processMode 
; 
 122 bool UMAGetProcessModeDoesActivateOnFGSwitch()  
 124         return UMAGetProcessMode() & modeDoesActivateOnFGSwitch 
; 
 129 void UMASetMenuTitle( MenuRef menu 
, StringPtr title 
) 
 132         long                    size 
= GetHandleSize( (Handle
) menu 
) ; 
 133         const long              headersize 
= 14 ; 
 134         int                             oldlen 
= (**menu
).menuData
[0] + 1; 
 135         int                             newlen 
= title
[0] + 1 ; 
 137         if ( oldlen 
< newlen 
) 
 139                 // enlarge before adjusting 
 140                 SetHandleSize( (Handle
) menu 
, size 
+ (newlen 
- oldlen 
) ); 
 143         if ( oldlen 
!= newlen 
) 
 144                 memmove( (char*) (**menu
).menuData 
+ newlen 
, (char*) (**menu
).menuData 
+ oldlen 
, size 
- headersize 
- oldlen 
) ; 
 146         memcpy( (char*) (**menu
).menuData 
, title 
,  newlen 
) ; 
 147         if ( oldlen 
> newlen 
) 
 150                 SetHandleSize( (Handle
) menu 
, size 
+ (newlen 
- oldlen 
) ) ; 
 153         SetMenuTitle( menu 
, title 
) ; 
 157 UInt32 
UMAMenuEvent( EventRecord 
*inEvent 
) 
 159 #if UMA_USE_APPEARANCE 
 160         if ( UMAHasAppearance() ) 
 162                 return MenuEvent( inEvent 
) ; 
 167                         if ( inEvent
->what 
== keyDown 
&& inEvent
->modifiers 
& cmdKey
) 
 169                                 return MenuKey( inEvent
->message 
& charCodeMask 
) ; 
 175 void                    UMAEnableMenuItem( MenuRef inMenu 
, MenuItemIndex inItem 
)  
 177 #if UMA_USE_8_6 || TARGET_CARBON 
 178         EnableMenuItem( inMenu 
, inItem 
) ; 
 180         EnableItem( inMenu 
, inItem 
) ; 
 184 void                    UMADisableMenuItem( MenuRef inMenu 
, MenuItemIndex inItem 
)  
 186 #if UMA_USE_8_6 || TARGET_CARBON 
 187         DisableMenuItem( inMenu 
, inItem 
) ; 
 189         DisableItem( inMenu 
, inItem 
) ; 
 193 void UMAAppendSubMenuItem( MenuRef menu 
, StringPtr l 
, SInt16 id 
)  
 196         memcpy( label 
, l 
, l
[0]+1 ) ; 
 197         // hardcoded adding of the submenu combination for mac 
 199         int theEnd 
= label
[0] + 1;  
 201                 theEnd 
= 251; // mac allows only 255 characters 
 202         label
[theEnd
++] = '/'; 
 203         label
[theEnd
++] = hMenuCmd
;  
 204         label
[theEnd
++] = '!'; 
 205         label
[theEnd
++] = id 
;  
 206         label
[theEnd
] = 0x00; 
 208         MacAppendMenu(menu
, label
); 
 211 void UMAInsertSubMenuItem( MenuRef menu 
, StringPtr l 
, MenuItemIndex item 
, SInt16 id  
)  
 214         memcpy( label 
, l 
, l
[0]+1 ) ; 
 215         // hardcoded adding of the submenu combination for mac 
 217         int theEnd 
= label
[0] + 1;  
 219                 theEnd 
= 251; // mac allows only 255 characters 
 220         label
[theEnd
++] = '/'; 
 221         label
[theEnd
++] = hMenuCmd
;  
 222         label
[theEnd
++] = '!'; 
 223         label
[theEnd
++] = id
;  
 224         label
[theEnd
] = 0x00; 
 226         MacInsertMenuItem(menu
, label 
, item
); 
 229 void UMAAppendMenuItem( MenuRef menu 
, StringPtr l 
, SInt16 key
, UInt8 modifiers 
)  
 232         memcpy( label 
, l 
, l
[0]+1 ) ; 
 237                         label
[++pos
] = toupper( key 
); 
 240         MacAppendMenu( menu 
, label 
) ; 
 243 void UMAInsertMenuItem( MenuRef menu 
, StringPtr l 
, MenuItemIndex item 
, SInt16 key
, UInt8 modifiers 
)  
 246         memcpy( label 
, l 
, l
[0]+1 ) ; 
 251                         label
[++pos
] = toupper( key 
); 
 254         MacInsertMenuItem( menu 
, label 
, item
) ; 
 257 void UMADrawMenuBar()  
 263 void UMASetMenuItemText( MenuRef menu 
, MenuItemIndex item 
, StringPtr label 
)  
 265         ::SetMenuItemText( menu 
, item 
, label 
) ; 
 268 MenuRef 
UMANewMenu( SInt16 menuid 
, StringPtr label 
)  
 270         return ::NewMenu(menuid
, label
); 
 273 void UMADisposeMenu( MenuRef menu 
) 
 275         DisposeMenu( menu 
) ; 
 277 void UMADeleteMenu( SInt16 menuId 
)  
 279         ::DeleteMenu( menuId 
) ; 
 282 void UMAInsertMenu( MenuRef insertMenu 
, SInt16 afterId 
)  
 284         ::InsertMenu( insertMenu 
, afterId 
) ; 
 290 int gPrOpenCounter 
= 0 ; 
 292 #if TARGET_CARBON && PM_USE_SESSION_APIS 
 293 OSStatus 
UMAPrOpen(PMPrintSession 
*macPrintSession
) 
 301         if ( gPrOpenCounter 
== 1 ) 
 305                 wxASSERT( err 
== noErr 
) ; 
 309         OSStatus err 
= noErr 
; 
 311         if ( gPrOpenCounter 
== 1 ) 
 313   #if PM_USE_SESSION_APIS 
 314             err 
= PMCreateSession(macPrintSession
) ; 
 318                 wxASSERT( err 
== noErr 
) ; 
 324 #if TARGET_CARBON && PM_USE_SESSION_APIS 
 325 OSStatus 
UMAPrClose(PMPrintSession 
*macPrintSession
) 
 327 OSStatus 
UMAPrClose() 
 332         wxASSERT( gPrOpenCounter 
>= 1 ) ; 
 333         if ( gPrOpenCounter 
== 1 ) 
 337                 wxASSERT( err 
== noErr 
) ; 
 342         OSStatus err 
= noErr 
; 
 343         wxASSERT( gPrOpenCounter 
>= 1 ) ; 
 344         if ( gPrOpenCounter 
== 1 ) 
 346   #if PM_USE_SESSION_APIS 
 347             err 
= PMRelease(*macPrintSession
) ; 
 348             *macPrintSession 
= kPMNoReference
; 
 360 pascal QDGlobalsPtr 
GetQDGlobalsPtr (void) 
 362         return QDGlobalsPtr (* (Ptr
*) LMGetCurrentA5 ( ) - 0xCA); 
 367 void UMAShowWatchCursor()  
 371         CursHandle watchFob 
= GetCursor (watchCursor
); 
 378                 Cursor preservedArrow
; 
 379                 GetQDGlobalsArrow (&preservedArrow
); 
 380                 SetQDGlobalsArrow (*watchFob
); 
 382                 SetQDGlobalsArrow (&preservedArrow
); 
 384                 SetCursor (*watchFob
);   
 389 void                    UMAShowArrowCursor()  
 393         SetCursor (GetQDGlobalsArrow (&arrow
)); 
 395         SetCursor (&(qd
.arrow
)); 
 401 GrafPtr         
UMAGetWindowPort( WindowRef inWindowRef 
)  
 403         wxASSERT( inWindowRef 
!= NULL 
) ; 
 405         return GetWindowPort( inWindowRef 
) ;  
 407         return (GrafPtr
) inWindowRef 
; 
 411 void                    UMADisposeWindow( WindowRef inWindowRef 
)  
 413         wxASSERT( inWindowRef 
!= NULL 
) ; 
 414         DisposeWindow( inWindowRef 
) ; 
 417 void                    UMASetWTitleC( WindowRef inWindowRef 
, const char *title 
)  
 420         strncpy( (char*)ptitle 
, title 
, 96 ) ; 
 423         c2pstrcpy( ptitle
, (char *)ptitle 
) ; 
 425         c2pstr( (char*)ptitle 
) ; 
 427         SetWTitle( inWindowRef 
, ptitle 
) ; 
 430 void                    UMAGetWTitleC( WindowRef inWindowRef 
, char *title 
)  
 432         GetWTitle( inWindowRef 
, (unsigned char*)title 
) ; 
 434         p2cstrcpy( title
, (unsigned char *)title 
) ; 
 436         p2cstr( (unsigned char*)title 
) ; 
 440 void                    UMAShowWindow( WindowRef inWindowRef 
)  
 442         ShowWindow( inWindowRef 
) ; 
 446 void                    UMAHideWindow( WindowRef inWindowRef 
)  
 448         HideWindow( inWindowRef
) ; 
 451 void                    UMASelectWindow( WindowRef inWindowRef 
)  
 453         SelectWindow( inWindowRef 
) ; 
 456 void                    UMABringToFront( WindowRef inWindowRef 
)  
 458         BringToFront( inWindowRef 
) ; 
 461 void                    UMASendBehind( WindowRef inWindowRef 
, WindowRef behindWindow 
)  
 463         SendBehind( inWindowRef 
, behindWindow 
) ; 
 466 void                    UMACloseWindow(WindowRef inWindowRef
)  
 470         CloseWindow( inWindowRef 
) ; 
 474 // appearance additions 
 476 void UMAActivateControl( ControlHandle inControl 
)  
 478 #if UMA_USE_APPEARANCE 
 479     if ( UMAHasAppearance() ) 
 481       if ( !UMAIsControlActive( inControl 
) ) 
 483         bool visible 
= IsControlVisible( inControl 
) ; 
 485           SetControlVisibility( inControl 
, false , false ) ; 
 486         ::ActivateControl( inControl 
) ; 
 488           SetControlVisibility( inControl 
, true , false ) ; 
 490           InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ; 
 498         AGAActivateControl( inControl 
) ; 
 506 void UMADrawControl( ControlHandle inControl 
)  
 508     WindowRef theWindow 
= GetControlOwner(inControl
) ; 
 509     RgnHandle updateRgn 
= NewRgn() ; 
 511     GetWindowRegion( theWindow 
, kWindowUpdateRgn
, updateRgn 
) ; 
 513     GetWindowUpdateRgn( theWindow 
, updateRgn 
) ; 
 515         Point zero 
= { 0 , 0 } ; 
 516         LocalToGlobal( &zero 
) ; 
 517         OffsetRgn( updateRgn 
, -zero
.h 
, -zero
.v 
) ; 
 518 #if UMA_USE_APPEARANCE 
 519     if ( UMAHasAppearance() ) 
 521         ::DrawControlInCurrentPort( inControl 
) ; 
 527         AGADrawControl( inControl 
) ; 
 533 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332) 
 534     InvalWindowRgn( theWindow
, updateRgn
) ; 
 536     InvalRgn( updateRgn 
) ; 
 538         DisposeRgn( updateRgn 
) ; 
 542 void UMAMoveControl( ControlHandle inControl 
, short x 
, short y 
)  
 544     if ( UMAHasAppearance() ) 
 546         bool visible 
= UMAIsControlVisible( inControl 
) ; 
 548           SetControlVisibility( inControl 
, false , false ) ; 
 550           InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ; 
 552         ::MoveControl( inControl 
, x 
, y 
) ; 
 554           SetControlVisibility( inControl 
, true , false ) ; 
 556           InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ; 
 561 void UMASizeControl( ControlHandle inControl 
, short x 
, short y 
)  
 563     if ( UMAHasAppearance() ) 
 565         bool visible 
= UMAIsControlVisible( inControl 
) ; 
 567           SetControlVisibility( inControl 
, false , false ) ; 
 569           InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ; 
 571         ::SizeControl( inControl 
, x 
, y 
) ; 
 573           SetControlVisibility( inControl 
, true , false ) ; 
 575           InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ; 
 580 void UMADeactivateControl( ControlHandle inControl 
)  
 582     if ( UMAHasAppearance() ) 
 584       if ( UMAIsControlActive( inControl 
) ) 
 586         bool visible 
= IsControlVisible( inControl 
) ; 
 588           SetControlVisibility( inControl 
, false , false ) ; 
 589         ::DeactivateControl( inControl 
) ; 
 591           SetControlVisibility( inControl 
, true , false ) ; 
 593           InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ; 
 599 void UMASetThemeWindowBackground               (WindowRef                               inWindow
, 
 603 #if UMA_USE_APPEARANCE 
 604     if ( UMAHasAppearance() ) 
 606         ::SetThemeWindowBackground( inWindow 
,inBrush 
, inUpdate 
) ; 
 612         AGASetThemeWindowBackground( inWindow 
, inBrush 
, inUpdate 
) ; 
 620 void                    UMAApplyThemeBackground                 (ThemeBackgroundKind    inKind
, 
 622                                                                  ThemeDrawState                 inState
, 
 626 #if UMA_USE_APPEARANCE 
 627         if ( UMAHasAppearance() ) 
 630                 if ( sUMAAppearanceVersion >= 0x0110 ) 
 631                         ::ApplyThemeBackground( inKind ,bounds , inState , inDepth , inColorDev ) ; 
 638         AGAApplyThemeBackground( inKind 
,bounds 
, inState 
, inDepth 
, inColorDev 
) ; 
 646 ControlHandle 
UMANewControl(WindowPtr                   owningWindow
, 
 647                             const Rect 
*                boundsRect
, 
 648                             ConstStr255Param            controlTitle
, 
 649                             Boolean                     initiallyVisible
, 
 654                             SInt32                      controlReference
) 
 656         ControlHandle theControl 
= NULL 
; 
 657 #if UMA_USE_APPEARANCE 
 658         if ( UMAHasAppearance() ) 
 660    theControl 
=  NewControl( owningWindow 
, boundsRect 
, controlTitle 
, initiallyVisible 
, 
 661                 initialValue 
, minimumValue 
, maximumValue 
, procID 
, controlReference 
) ; 
 667                 theControl 
= AGANewControl( owningWindow 
, boundsRect 
, controlTitle 
, initiallyVisible 
, 
 668                 initialValue 
, minimumValue 
, maximumValue 
, procID 
, controlReference 
) ; 
 677 void UMADisposeControl (ControlHandle                   theControl
) 
 679     if ( UMAHasAppearance() ) 
 681         ::DisposeControl( theControl 
) ; 
 685         ::DisposeControl( theControl 
) ; 
 689 void UMAHiliteControl   (ControlHandle                  inControl
, 
 690                          ControlPartCode                hiliteState
) 
 692     if ( UMAHasAppearance() ) 
 694         ::HiliteControl( inControl 
, hiliteState 
) ; 
 698         ::HiliteControl( inControl 
, hiliteState 
) ; 
 702 // shows the control and adds the region to the update region 
 703 void UMAShowControl                                             (ControlHandle                  inControl
) 
 705     if ( UMAHasAppearance() ) 
 707         SetControlVisibility( inControl 
, true , false ) ; 
 709         InvalWindowRect(GetControlOwner(inControl
),GetControlBounds(inControl
,&ctrlBounds
) ) ; 
 713 // Hides the control and adds the region to the update region 
 714 void UMAHideControl                                             (ControlHandle                  inControl
) 
 716     if ( UMAHasAppearance() ) 
 718         ::HideControl( inControl 
) ; 
 722         ::HideControl( inControl 
) ; 
 727 void UMASetControlVisibility                    (ControlHandle                  inControl
, 
 731     if ( UMAHasAppearance() ) 
 733 #if UMA_USE_APPEARANCE 
 734         ::SetControlVisibility( inControl 
, inIsVisible
, inDoDraw 
) ; 
 741 bool UMAIsControlActive                                 (ControlHandle                  inControl
) 
 744         return IsControlActive( inControl 
) ; 
 746 #if UMA_USE_APPEARANCE 
 747         if ( UMAHasAppearance() ) 
 749         return IsControlActive( inControl 
) ; 
 753         return (**inControl
).contrlHilite 
== 0 ; 
 758 bool UMAIsControlVisible                                (ControlHandle                  inControl
) 
 760 #if UMA_USE_APPEARANCE 
 761         if ( UMAHasAppearance() ) 
 763         return IsControlVisible( inControl 
) ; 
 769     return (**inControl
).contrlVis 
== 255 ; 
 775 OSErr 
UMAGetBestControlRect                             (ControlHandle                  inControl
, 
 777                                                                  SInt16 
*                               outBaseLineOffset
) 
 779 #if UMA_USE_APPEARANCE 
 780         if ( UMAHasAppearance() ) 
 782         return GetBestControlRect( inControl 
, outRect 
, outBaseLineOffset 
) ; 
 788         return AGAGetBestControlRect( inControl 
, outRect 
, outBaseLineOffset 
) ; 
 798 OSErr 
UMASetControlFontStyle                            (ControlHandle                  inControl
, 
 799                                                                  const ControlFontStyleRec 
* inStyle
)    
 801 #if UMA_USE_APPEARANCE 
 802         if ( UMAHasAppearance() ) 
 804                 return ::SetControlFontStyle( inControl 
, inStyle 
) ; 
 809                 return AGASetControlFontStyle( inControl 
, inStyle 
) ; 
 821 OSErr 
UMACreateRootControl                              (WindowPtr                              inWindow
, 
 822                                                                  ControlHandle 
*                outControl
) 
 824 #if UMA_USE_APPEARANCE 
 825         if ( UMAHasAppearance() ) 
 827         return CreateRootControl( inWindow 
, outControl  
) ; 
 832         return AGACreateRootControl( inWindow 
, outControl 
) ; 
 842 OSErr 
UMAEmbedControl                                   (ControlHandle                  inControl
, 
 843                                                                  ControlHandle                  inContainer
) 
 845 #if UMA_USE_APPEARANCE 
 846         if ( UMAHasAppearance() ) 
 848         return EmbedControl( inControl 
, inContainer 
) ; 
 853         return AGAEmbedControl( inControl 
, inContainer 
) ; ; 
 864 OSErr 
UMASetKeyboardFocus                               (WindowPtr                              inWindow
, 
 865                                                                  ControlHandle                  inControl
, 
 866                                                                  ControlFocusPart               inPart
) 
 872         SetPort( GetWindowPort( inWindow 
) ) ; 
 874         SetPort( inWindow 
) ; 
 877 #if UMA_USE_APPEARANCE 
 878         if ( UMAHasAppearance() ) 
 880         err 
= SetKeyboardFocus( inWindow 
, inControl 
, inPart 
) ; 
 885         err 
= AGASetKeyboardFocus( inWindow 
, inControl 
, inPart 
) ; 
 899 ControlPartCode 
UMAHandleControlClick                           (ControlHandle                  inControl
, 
 902                                                                  ControlActionUPP               inAction
)                 
 904 #if UMA_USE_APPEARANCE 
 905         if ( UMAHasAppearance() ) 
 907         return HandleControlClick( inControl 
, inWhere 
, inModifiers 
, inAction 
) ; 
 913         return AGAHandleControlClick( inControl 
, inWhere 
, inModifiers 
, inAction 
) ; 
 923 SInt16 
UMAHandleControlKey                              (ControlHandle                  inControl
, 
 928 #if UMA_USE_APPEARANCE 
 929         if ( UMAHasAppearance() ) 
 931         return HandleControlKey( inControl 
, inKeyCode 
, inCharCode 
, inModifiers 
) ; 
 937         return AGAHandleControlKey(inControl 
, inKeyCode 
, inCharCode 
, inModifiers 
) ; 
 948 void UMAIdleControls                                    (WindowPtr                              inWindow
) 
 950 #if UMA_USE_APPEARANCE 
 951         if ( UMAHasAppearance() ) 
 953                 IdleControls( inWindow 
) ; 
 959                 AGAIdleControls( inWindow 
) ; 
 967 void UMAUpdateControls( WindowPtr inWindow 
, RgnHandle inRgn 
)  
 969     RgnHandle updateRgn 
= NewRgn() ; 
 971     GetWindowRegion( inWindow 
, kWindowUpdateRgn
, updateRgn 
) ; 
 973     GetWindowUpdateRgn( inWindow 
, updateRgn 
) ; 
 975         Point zero 
= { 0 , 0 } ; 
 976         LocalToGlobal( &zero 
) ; 
 977         OffsetRgn( updateRgn 
, -zero
.h 
, -zero
.v 
) ; 
 978 #if UMA_USE_APPEARANCE 
 979     if ( UMAHasAppearance() ) 
 981         UpdateControls( inWindow 
, inRgn 
) ; 
 987         AGAUpdateControls( inWindow 
, inRgn 
) ; 
 993 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0332) 
 994     InvalWindowRgn( inWindow
, updateRgn
) ; 
 996     InvalRgn( updateRgn 
) ; 
 998         DisposeRgn( updateRgn 
) ; 
1002 OSErr 
UMAGetRootControl( WindowPtr inWindow 
, ControlHandle 
*outControl 
)  
1004 #if UMA_USE_APPEARANCE 
1005         if ( UMAHasAppearance() ) 
1007                 return GetRootControl( inWindow 
, outControl 
) ; 
1013                 return AGAGetRootControl( inWindow 
, outControl 
) ; 
1023 // handling control data 
1025 OSErr 
UMASetControlData                                 (ControlHandle                  inControl
, 
1026                                                                  ControlPartCode                inPart
, 
1031 #if UMA_USE_APPEARANCE 
1032         if ( UMAHasAppearance() ) 
1034          return SetControlData( inControl 
, inPart 
, inTagName 
, inSize 
, inData 
) ; 
1039                 return AGASetControlData( inControl 
, inPart 
, inTagName 
, inSize 
, inData 
) ; 
1049 OSErr 
UMAGetControlData                                 (ControlHandle                  inControl
, 
1050                                                                  ControlPartCode                inPart
, 
1054                                                                  Size 
*                                 outActualSize
) 
1056 #if UMA_USE_APPEARANCE 
1057         if ( UMAHasAppearance() ) 
1059                 return ::GetControlData( inControl 
, inPart 
, inTagName 
, inBufferSize 
, outBuffer 
, outActualSize 
) ; 
1065                 return AGAGetControlData( inControl 
, inPart 
, inTagName 
, inBufferSize 
, outBuffer 
, outActualSize 
) ; 
1075 OSErr 
UMAGetControlDataSize                             (ControlHandle                  inControl
, 
1076                                                                  ControlPartCode                inPart
, 
1080 #if UMA_USE_APPEARANCE 
1081         if ( UMAHasAppearance() ) 
1083                 return GetControlDataSize( inControl 
, inPart 
, inTagName 
, outMaxSize 
) ; 
1089                 return AGAGetControlDataSize( inControl 
, inPart 
, inTagName 
, outMaxSize 
) ; 
1102 // system 8.0 changes 
1104 short UMAFindWindow( Point inPoint 
, WindowRef 
*outWindow 
) 
1106         // todo add the additional area codes 
1107         return FindWindow( inPoint 
, outWindow 
) ; 
1110 OSStatus 
UMAGetWindowFeatures( WindowRef inWindowRef 
, UInt32 
*outFeatures 
) 
1112 #if UMA_USE_WINDOWMGR 
1113         return GetWindowFeatures( inWindowRef 
, outFeatures 
) ; 
1119 OSStatus 
UMAGetWindowRegion( WindowRef inWindowRef 
, WindowRegionCode inRegionCode 
, RgnHandle ioWinRgn 
) 
1121 #if UMA_USE_WINDOWMGR 
1122         return GetWindowRegion( inWindowRef 
, inRegionCode 
, ioWinRgn 
) ; 
1128 void UMADrawGrowIcon( WindowRef inWindowRef 
) 
1130         DrawGrowIcon( inWindowRef 
) ; 
1133 OSStatus 
UMACollapseWindow( WindowRef inWindowRef 
, Boolean inCollapseIt 
) 
1135         return CollapseWindow( inWindowRef 
, inCollapseIt 
) ; 
1138 OSStatus 
UMACollapseAllWindows( Boolean inCollapseEm 
) 
1140         return CollapseAllWindows( inCollapseEm 
) ; 
1143 Boolean 
UMAIsWindowCollapsed( WindowRef inWindowRef 
) 
1145         return IsWindowCollapsed( inWindowRef 
) ; 
1148 Boolean 
UMAIsWindowCollapsable( WindowRef inWindowRef 
) 
1150         return IsWindowCollapsable( inWindowRef 
) ; 
1153 // system 8.5 changes<MacWindows.h> 
1154 OSStatus        
UMACreateNewWindow( WindowClass windowClass 
, WindowAttributes attributes 
, const Rect 
*bounds
,  WindowRef 
*outWindow 
)  
1156 #if UMA_USE_WINDOWMGR 
1157         if ( UMAHasWindowManager() ) 
1159                 return CreateNewWindow( windowClass 
, attributes
, bounds
, outWindow 
) ; 
1165                 if ( UMAHasAppearance() ) 
1167                         switch( windowClass 
) 
1169                                 case kMovableModalWindowClass 
: 
1170                                         procID 
= kWindowMovableModalDialogProc
; 
1172                                 case kModalWindowClass 
: 
1173                                         procID 
= kWindowShadowDialogProc
; 
1175                                 case kFloatingWindowClass 
: 
1176                                         if ( attributes 
& kWindowSideTitlebarAttribute 
) 
1178                                                 if( ( attributes 
& kWindowResizableAttribute 
) &&   
1179                                                         ( attributes 
& kWindowFullZoomAttribute 
) ) 
1181                                                         procID 
= kWindowFloatSideFullZoomGrowProc 
; 
1183                                                 else if( attributes 
& kWindowFullZoomAttribute 
) 
1185                                                         procID 
= kWindowFloatSideFullZoomProc
; 
1187                                                 else if ( attributes 
& kWindowResizableAttribute 
) 
1189                                                         procID 
= kWindowFloatSideGrowProc
; 
1193                                                         procID 
= kWindowFloatSideProc
; 
1198                                                 if( ( attributes 
& kWindowResizableAttribute 
) &&   
1199                                                         ( attributes 
& kWindowFullZoomAttribute 
) ) 
1201                                                         procID 
= kWindowFloatFullZoomGrowProc 
; 
1203                                                 else if( attributes 
& kWindowFullZoomAttribute 
) 
1205                                                         procID 
= kWindowFloatFullZoomProc
; 
1207                                                 else if ( attributes 
& kWindowResizableAttribute 
) 
1209                                                         procID 
= kWindowFloatGrowProc
; 
1213                                                         procID 
= kWindowFloatProc
; 
1217                                 case kDocumentWindowClass 
: 
1219                                         if( ( attributes 
& kWindowResizableAttribute 
) &&   
1220                                                 ( attributes 
& kWindowFullZoomAttribute 
) ) 
1222                                                 procID 
= kWindowFullZoomGrowDocumentProc
; 
1224                                         else if( attributes 
& kWindowFullZoomAttribute 
) 
1226                                                 procID 
= kWindowFullZoomDocumentProc
; 
1228                                         else if ( attributes 
& kWindowResizableAttribute 
) 
1230                                                 procID 
= kWindowGrowDocumentProc
; 
1234                                                 procID 
= kWindowDocumentProc
; 
1241                         switch( windowClass 
) 
1243                                 case kMovableModalWindowClass 
: 
1244                                         procID 
= movableDBoxProc
; 
1246                                 case kModalWindowClass 
: 
1247                                         procID 
= altDBoxProc
; 
1249                                 case kFloatingWindowClass 
: 
1250                                         if ( attributes 
& kWindowSideTitlebarAttribute 
) 
1252                                                 if( ( attributes 
& kWindowResizableAttribute 
) &&   
1253                                                         ( attributes 
& kWindowFullZoomAttribute 
) ) 
1255                                                         procID 
= floatSideZoomGrowProc 
; 
1257                                                 else if( attributes 
& kWindowFullZoomAttribute 
) 
1259                                                         procID 
= floatSideZoomProc
; 
1261                                                 else if ( attributes 
& kWindowResizableAttribute 
) 
1263                                                         procID 
= floatSideGrowProc
; 
1267                                                         procID 
= floatSideProc
; 
1272                                                 if( ( attributes 
& kWindowResizableAttribute 
) &&   
1273                                                         ( attributes 
& kWindowFullZoomAttribute 
) ) 
1275                                                         procID 
= floatZoomGrowProc 
; 
1277                                                 else if( attributes 
& kWindowFullZoomAttribute 
) 
1279                                                         procID 
= floatZoomProc
; 
1281                                                 else if ( attributes 
& kWindowResizableAttribute 
) 
1283                                                         procID 
= floatGrowProc
; 
1291                                 case kDocumentWindowClass 
: 
1293                                         if( ( attributes 
& kWindowResizableAttribute 
) &&   
1294                                                 ( attributes 
& kWindowFullZoomAttribute 
) ) 
1296                                                 procID 
= zoomDocProc
; 
1298                                         else if( attributes 
& kWindowFullZoomAttribute 
) 
1300                                                 procID 
= zoomNoGrow
; 
1302                                         else if ( attributes 
& kWindowResizableAttribute 
) 
1304                                                 procID 
= documentProc
; 
1308                                                 procID 
= noGrowDocProc
; 
1314                 *outWindow 
= NewCWindow(nil
, bounds
, "\p", false, procID
,  (WindowRef
) -1 /*behind*/, 
1315                                 attributes 
& kWindowCloseBoxAttribute 
, (long)NULL
); 
1320 OSStatus        
UMAGetWindowClass( WindowRef inWindowRef 
, WindowClass 
*outWindowClass 
)  
1322 #if UMA_USE_WINDOWMGR 
1323         if ( UMAHasWindowManager() ) 
1325                 return GetWindowClass( inWindowRef 
, outWindowClass 
) ; 
1329                 return kDocumentWindowClass 
; 
1332 OSStatus        
UMAGetWindowAttributes( WindowRef inWindowRef 
, WindowAttributes 
*outAttributes 
)  
1334 #if UMA_USE_WINDOWMGR 
1335         if ( UMAHasWindowManager() ) 
1337                 return GetWindowAttributes( inWindowRef 
, outAttributes 
) ; 
1340         return kWindowNoAttributes 
; 
1343 void UMAShowFloatingWindows()  
1345 #if UMA_USE_WINDOWMGR 
1346         if ( UMAHasWindowManager() ) 
1348                 ShowFloatingWindows() ; 
1353 void UMAHideFloatingWindows()  
1355 #if UMA_USE_WINDOWMGR 
1356         if ( UMAHasWindowManager() ) 
1358                 HideFloatingWindows() ; 
1363 Boolean         
UMAAreFloatingWindowsVisible()  
1365 #if UMA_USE_WINDOWMGR 
1366         if ( UMAHasWindowManager() ) 
1368                 return AreFloatingWindowsVisible() ; 
1374 WindowRef 
UMAFrontNonFloatingWindow() 
1376 #if UMA_USE_WINDOWMGR 
1377         if ( UMAHasWindowManager() ) 
1379                 return FrontNonFloatingWindow() ; 
1384                 return FrontWindow() ; 
1388 WindowRef 
UMAFrontWindow() 
1390 #if UMA_USE_WINDOWMGR 
1391         if ( UMAHasWindowManager() ) 
1393                 return FrontWindow() ; 
1398                 return FrontWindow() ; 
1402 WindowRef 
UMAGetActiveNonFloatingWindow() 
1407 bool UMAIsWindowFloating( WindowRef inWindow 
)  
1411         UMAGetWindowClass( inWindow 
, &cl 
) ; 
1412         return cl 
== kFloatingWindowClass 
; 
1415 bool UMAIsWindowModal( WindowRef inWindow 
)  
1419         UMAGetWindowClass( inWindow 
, &cl 
) ; 
1420         return cl 
< kFloatingWindowClass 
; 
1425 void UMAHighlightAndActivateWindow( WindowRef inWindowRef 
, bool inActivate 
) 
1429 //              bool isHighlighted = IsWindowHighlited( inWindowRef ) ; 
1430 //              if ( inActivate != isHightlited ) 
1434                 SetPort( GetWindowPort( inWindowRef 
) ) ; 
1436                 SetPort( inWindowRef 
) ; 
1438                 SetOrigin( 0 , 0 ) ; 
1439                 HiliteWindow( inWindowRef 
, inActivate 
) ; 
1440                 ControlHandle control 
= NULL 
; 
1441                 UMAGetRootControl( inWindowRef 
, & control 
) ; 
1445                                 UMAActivateControl( control 
) ; 
1447                                 UMADeactivateControl( control 
) ; 
1452 OSStatus 
UMADrawThemePlacard( const Rect 
*inRect 
, ThemeDrawState inState 
)  
1454 #if UMA_USE_APPEARANCE 
1455   if ( UMAHasAppearance() ) 
1457     ::DrawThemePlacard( inRect 
, inState 
) ;