-#if TARGET_CARBON
- Cursor arrow;
- SetCursor (GetQDGlobalsArrow (&arrow));
-#else
- SetCursor (&(qd.arrow));
-#endif
-}
-
-// window manager
-
-GrafPtr UMAGetWindowPort( WindowRef inWindowRef )
-{
- wxASSERT( inWindowRef != NULL ) ;
-#if TARGET_CARBON
- return (GrafPtr) GetWindowPort( inWindowRef ) ;
-#else
- return (GrafPtr) inWindowRef ;
-#endif
-}
-
-void UMADisposeWindow( WindowRef inWindowRef )
-{
- wxASSERT( inWindowRef != NULL ) ;
- DisposeWindow( inWindowRef ) ;
-}
-
-void UMASetWTitle( WindowRef inWindowRef , const wxString& title , wxFontEncoding encoding)
-{
-#if TARGET_CARBON
- SetWindowTitleWithCFString( inWindowRef , wxMacCFStringHolder(title , encoding) ) ;
-#else
- Str255 ptitle ;
- wxMacStringToPascal( title , ptitle ) ;
- SetWTitle( inWindowRef , ptitle ) ;
-#endif
-}
-
-// appearance additions
-
-void UMASetControlTitle( ControlRef inControl , const wxString& title , wxFontEncoding encoding)
-{
-#if TARGET_CARBON
- SetControlTitleWithCFString( inControl , wxMacCFStringHolder(title , encoding) ) ;
-#else
- Str255 ptitle ;
- wxMacStringToPascal( title , ptitle ) ;
- SetControlTitle( inControl , ptitle ) ;
-#endif
-}
-
-void UMAActivateControl( ControlRef inControl )
-{
-#if !TARGET_API_MAC_OSX
- // we have to add the control after again to the update rgn
- // otherwise updates get lost
- if ( !IsControlActive( inControl ) )
- {
- bool visible = IsControlVisible( inControl ) ;
- if ( visible )
- SetControlVisibility( inControl , false , false ) ;
-#endif
- ::ActivateControl( inControl ) ;
-#if !TARGET_API_MAC_OSX
- if ( visible ) {
- SetControlVisibility( inControl , true , false ) ;
-
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),UMAGetControlBoundsInWindowCoords(inControl,&ctrlBounds) ) ;
- }
- }
-#endif
-}
-
-void UMADrawControl( ControlRef inControl )
-{
-#if TARGET_API_MAC_CARBON
- ::Draw1Control( inControl );
-#else
- WindowRef theWindow = GetControlOwner(inControl) ;
- wxMacPortStateHelper help( (GrafPtr) GetWindowPort(theWindow) ) ;
- RgnHandle updateRgn = NewRgn() ;
- GetWindowUpdateRgn( theWindow , updateRgn ) ;
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
- ::DrawControlInCurrentPort( inControl ) ;
- InvalWindowRgn( theWindow, updateRgn) ;
- DisposeRgn( updateRgn ) ;
-#endif
-}
-
-void UMAMoveControl( ControlRef inControl , short x , short y )
-{
-#if !TARGET_API_MAC_OSX
- bool visible = IsControlVisible( inControl ) ;
- if ( visible ) {
- SetControlVisibility( inControl , false , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
- }
-#endif
- ::MoveControl( inControl , x , y ) ;
-#if !TARGET_API_MAC_OSX
- if ( visible ) {
- SetControlVisibility( inControl , true , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
- }
-#endif
-}
-
-void UMASizeControl( ControlRef inControl , short x , short y )
-{
-#if !TARGET_API_MAC_OSX
- bool visible = IsControlVisible( inControl ) ;
- if ( visible ) {
- SetControlVisibility( inControl , false , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
- }
-#endif
- ::SizeControl( inControl , x , y ) ;
-#if !TARGET_API_MAC_OSX
- if ( visible ) {
- SetControlVisibility( inControl , true , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
- }
-#endif
-}
-
-void UMADeactivateControl( ControlRef inControl )
-{
-#if !TARGET_API_MAC_OSX
- // we have to add the control after again to the update rgn
- // otherwise updates get lost
- bool visible = IsControlVisible( inControl ) ;
- if ( visible )
- SetControlVisibility( inControl , false , false ) ;
-#endif
- ::DeactivateControl( inControl ) ;
-#if !TARGET_API_MAC_OSX
- if ( visible ) {
- SetControlVisibility( inControl , true , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),UMAGetControlBoundsInWindowCoords(inControl,&ctrlBounds) ) ;
- }
-#endif
-}
-// shows the control and adds the region to the update region
-void UMAShowControl (ControlRef inControl)
-{
- SetControlVisibility( inControl , true , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),UMAGetControlBoundsInWindowCoords(inControl,&ctrlBounds) ) ;
-}
-
-// hides the control and adds the region to the update region
-void UMAHideControl (ControlRef inControl)
-{
- SetControlVisibility( inControl , false , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),UMAGetControlBoundsInWindowCoords(inControl,&ctrlBounds) ) ;
-}
-// keyboard focus
-OSErr UMASetKeyboardFocus (WindowPtr inWindow,
- ControlRef inControl,
- ControlFocusPart inPart)
-{
- OSErr err = noErr;
- GrafPtr port ;
- GetPort( &port ) ;
-
- SetPortWindowPort( inWindow ) ;
-
- err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
- SetPort( port ) ;
- return err ;
-}
-
-// events
-void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn )
-{
- wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) inWindow) ) ;
- RgnHandle updateRgn = NewRgn() ;
- GetWindowUpdateRgn( inWindow , updateRgn ) ;
-
- Point zero = { 0 , 0 } ;
- LocalToGlobal( &zero ) ;
- OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
-
- UpdateControls( inWindow , inRgn ) ;
- InvalWindowRgn( inWindow, updateRgn) ;
- DisposeRgn( updateRgn ) ;
-}
-
-bool UMAIsWindowFloating( WindowRef inWindow )
-{
- WindowClass cl ;
-
- GetWindowClass( inWindow , &cl ) ;
- return cl == kFloatingWindowClass ;
-}
-
-bool UMAIsWindowModal( WindowRef inWindow )
-{
- WindowClass cl ;
-
- GetWindowClass( inWindow , &cl ) ;
- return cl < kFloatingWindowClass ;
-}
-
-// others
-
-void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
-{
- if ( inWindowRef )