-void UMADrawControl( ControlHandle inControl )
-{
- 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 ) ;
-}
-
-void UMAMoveControl( ControlHandle inControl , short x , short y )
-{
- bool visible = IsControlVisible( inControl ) ;
- if ( visible ) {
- SetControlVisibility( inControl , false , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
- }
- ::MoveControl( inControl , x , y ) ;
- if ( visible ) {
- SetControlVisibility( inControl , true , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
- }
-}
-
-void UMASizeControl( ControlHandle inControl , short x , short y )
-{
- bool visible = IsControlVisible( inControl ) ;
- if ( visible ) {
- SetControlVisibility( inControl , false , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
- }
- ::SizeControl( inControl , x , y ) ;
- if ( visible ) {
- SetControlVisibility( inControl , true , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
- }
-}
-
-void UMADeactivateControl( ControlHandle inControl )
-{
- // 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 ) ;
- ::DeactivateControl( inControl ) ;
- if ( visible ) {
- SetControlVisibility( inControl , true , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
- }
-}
-// shows the control and adds the region to the update region
-void UMAShowControl (ControlHandle inControl)
-{
- SetControlVisibility( inControl , true , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-}
-
-// shows the control and adds the region to the update region
-void UMAHideControl (ControlHandle inControl)
-{
- SetControlVisibility( inControl , false , false ) ;
- Rect ctrlBounds ;
- InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-}
-// keyboard focus
-OSErr UMASetKeyboardFocus (WindowPtr inWindow,
- ControlHandle 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 )
- {
-// bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
-// if ( inActivate != isHightlited )
- GrafPtr port ;
- GetPort( &port ) ;
- SetPortWindowPort( inWindowRef ) ;
- HiliteWindow( inWindowRef , inActivate ) ;
- ControlHandle control = NULL ;
- ::GetRootControl( inWindowRef , & control ) ;
- if ( control )
- {
- if ( inActivate )
- UMAActivateControl( control ) ;
- else
- UMADeactivateControl( control ) ;
- }
- SetPort( port ) ;
- }
-}
-
-OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
-{
- return ::DrawThemePlacard( inRect , inState ) ;
-}
-
-#if !TARGET_CARBON
-static OSStatus helpMenuStatus = noErr ;
-static MenuItemIndex firstCustomItemIndex = 0 ;
-#endif
-