corrected control functions

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13110 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2001-12-19 21:50:05 +00:00
parent 1c31098539
commit 22e751a559
2 changed files with 40 additions and 26 deletions

View File

@@ -396,8 +396,10 @@ void UMAGetWTitleC( WindowRef inWindowRef , char *title )
void UMAActivateControl( ControlHandle inControl ) void UMAActivateControl( ControlHandle inControl )
{ {
if ( !IsControlActive( inControl ) ) // we have to add the control after again to the update rgn
{ // otherwise updates get lost
if ( !IsControlActive( inControl ) )
{
bool visible = IsControlVisible( inControl ) ; bool visible = IsControlVisible( inControl ) ;
if ( visible ) if ( visible )
SetControlVisibility( inControl , false , false ) ; SetControlVisibility( inControl , false , false ) ;
@@ -407,7 +409,7 @@ void UMAActivateControl( ControlHandle inControl )
Rect ctrlBounds ; Rect ctrlBounds ;
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ; InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
} }
} }
} }
void UMADrawControl( ControlHandle inControl ) void UMADrawControl( ControlHandle inControl )
@@ -415,13 +417,12 @@ void UMADrawControl( ControlHandle inControl )
WindowRef theWindow = GetControlOwner(inControl) ; WindowRef theWindow = GetControlOwner(inControl) ;
RgnHandle updateRgn = NewRgn() ; RgnHandle updateRgn = NewRgn() ;
GetWindowUpdateRgn( theWindow , updateRgn ) ; GetWindowUpdateRgn( theWindow , updateRgn ) ;
Point zero = { 0 , 0 } ; Point zero = { 0 , 0 } ;
LocalToGlobal( &zero ) ; LocalToGlobal( &zero ) ;
OffsetRgn( updateRgn , -zero.h , -zero.v ) ; OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
::DrawControlInCurrentPort( inControl ) ; ::DrawControlInCurrentPort( inControl ) ;
InvalWindowRgn( theWindow, updateRgn) ; InvalWindowRgn( theWindow, updateRgn) ;
DisposeRgn( updateRgn ) ; DisposeRgn( updateRgn ) ;
} }
void UMAMoveControl( ControlHandle inControl , short x , short y ) void UMAMoveControl( ControlHandle inControl , short x , short y )
@@ -458,8 +459,8 @@ void UMASizeControl( ControlHandle inControl , short x , short y )
void UMADeactivateControl( ControlHandle inControl ) void UMADeactivateControl( ControlHandle inControl )
{ {
if ( IsControlActive( inControl ) ) // we have to add the control after again to the update rgn
{ // otherwise updates get lost
bool visible = IsControlVisible( inControl ) ; bool visible = IsControlVisible( inControl ) ;
if ( visible ) if ( visible )
SetControlVisibility( inControl , false , false ) ; SetControlVisibility( inControl , false , false ) ;
@@ -469,7 +470,6 @@ void UMADeactivateControl( ControlHandle inControl )
Rect ctrlBounds ; Rect ctrlBounds ;
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ; InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
} }
}
} }
// shows the control and adds the region to the update region // shows the control and adds the region to the update region
void UMAShowControl (ControlHandle inControl) void UMAShowControl (ControlHandle inControl)
@@ -479,6 +479,13 @@ void UMAShowControl (ControlHandle inControl)
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&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 // keyboard focus
OSErr UMASetKeyboardFocus (WindowPtr inWindow, OSErr UMASetKeyboardFocus (WindowPtr inWindow,
ControlHandle inControl, ControlHandle inControl,

View File

@@ -396,8 +396,10 @@ void UMAGetWTitleC( WindowRef inWindowRef , char *title )
void UMAActivateControl( ControlHandle inControl ) void UMAActivateControl( ControlHandle inControl )
{ {
if ( !IsControlActive( inControl ) ) // we have to add the control after again to the update rgn
{ // otherwise updates get lost
if ( !IsControlActive( inControl ) )
{
bool visible = IsControlVisible( inControl ) ; bool visible = IsControlVisible( inControl ) ;
if ( visible ) if ( visible )
SetControlVisibility( inControl , false , false ) ; SetControlVisibility( inControl , false , false ) ;
@@ -407,7 +409,7 @@ void UMAActivateControl( ControlHandle inControl )
Rect ctrlBounds ; Rect ctrlBounds ;
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ; InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
} }
} }
} }
void UMADrawControl( ControlHandle inControl ) void UMADrawControl( ControlHandle inControl )
@@ -415,13 +417,12 @@ void UMADrawControl( ControlHandle inControl )
WindowRef theWindow = GetControlOwner(inControl) ; WindowRef theWindow = GetControlOwner(inControl) ;
RgnHandle updateRgn = NewRgn() ; RgnHandle updateRgn = NewRgn() ;
GetWindowUpdateRgn( theWindow , updateRgn ) ; GetWindowUpdateRgn( theWindow , updateRgn ) ;
Point zero = { 0 , 0 } ; Point zero = { 0 , 0 } ;
LocalToGlobal( &zero ) ; LocalToGlobal( &zero ) ;
OffsetRgn( updateRgn , -zero.h , -zero.v ) ; OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
::DrawControlInCurrentPort( inControl ) ; ::DrawControlInCurrentPort( inControl ) ;
InvalWindowRgn( theWindow, updateRgn) ; InvalWindowRgn( theWindow, updateRgn) ;
DisposeRgn( updateRgn ) ; DisposeRgn( updateRgn ) ;
} }
void UMAMoveControl( ControlHandle inControl , short x , short y ) void UMAMoveControl( ControlHandle inControl , short x , short y )
@@ -458,8 +459,8 @@ void UMASizeControl( ControlHandle inControl , short x , short y )
void UMADeactivateControl( ControlHandle inControl ) void UMADeactivateControl( ControlHandle inControl )
{ {
if ( IsControlActive( inControl ) ) // we have to add the control after again to the update rgn
{ // otherwise updates get lost
bool visible = IsControlVisible( inControl ) ; bool visible = IsControlVisible( inControl ) ;
if ( visible ) if ( visible )
SetControlVisibility( inControl , false , false ) ; SetControlVisibility( inControl , false , false ) ;
@@ -469,7 +470,6 @@ void UMADeactivateControl( ControlHandle inControl )
Rect ctrlBounds ; Rect ctrlBounds ;
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ; InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
} }
}
} }
// shows the control and adds the region to the update region // shows the control and adds the region to the update region
void UMAShowControl (ControlHandle inControl) void UMAShowControl (ControlHandle inControl)
@@ -479,6 +479,13 @@ void UMAShowControl (ControlHandle inControl)
InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&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 // keyboard focus
OSErr UMASetKeyboardFocus (WindowPtr inWindow, OSErr UMASetKeyboardFocus (WindowPtr inWindow,
ControlHandle inControl, ControlHandle inControl,