added live resizing

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23392 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2003-09-05 02:07:28 +00:00
parent 456fef85bb
commit 83901ec20c
2 changed files with 36 additions and 42 deletions

View File

@ -354,30 +354,27 @@ static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRe
GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
sizeof( newContentRect ), NULL, &newContentRect );
wxRect contentRect(newContentRect.left , newContentRect.top ,
newContentRect.right - newContentRect.left ,
newContentRect.bottom - newContentRect.top) ;
wxSize formerSize = toplevelWindow->GetSize() ;
bool handled = false ;
if ((attributes & kWindowBoundsChangeSizeChanged) != 0)
if ( (attributes & kWindowBoundsChangeSizeChanged ) ||
( attributes & kWindowBoundsChangeOriginChanged ) )
toplevelWindow->SetSize( newContentRect.left , newContentRect.top ,
newContentRect.right - newContentRect.left ,
newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING);
int x , y , w , h ;
toplevelWindow->GetPosition( &x , &y ) ;
toplevelWindow->GetSize( &w , &h ) ;
Rect adjustedRect = { y , x , y + h , x + w } ;
if ( !EqualRect( &newContentRect , &adjustedRect ) )
{
wxSizeEvent event(contentRect , toplevelWindow->GetId());
event.SetEventObject(toplevelWindow);
handled = toplevelWindow->GetEventHandler()->ProcessEvent(event);
contentRect = event.GetRect() ;
}
else if ( attributes & kWindowBoundsChangeOriginChanged != 0)
{
wxMoveEvent event(contentRect , toplevelWindow->GetId());
event.SetEventObject(toplevelWindow);
handled = toplevelWindow->GetEventHandler()->ProcessEvent(event);
contentRect = event.GetRect() ;
}
if ( handled )
{
SetRect( &newContentRect , contentRect.GetLeft() , contentRect.GetTop() , contentRect.GetRight() , contentRect.GetBottom() ) ;
SetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, sizeof( newContentRect ), &newContentRect );
SetEventParameter( event , kEventParamCurrentBounds , typeQDRectangle, sizeof( adjustedRect ) , &adjustedRect ) ;
}
if ( toplevelWindow->GetSize() != formerSize )
toplevelWindow->Update() ;
result = noErr ;
}
break ;

View File

@ -354,30 +354,27 @@ static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRe
GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
sizeof( newContentRect ), NULL, &newContentRect );
wxRect contentRect(newContentRect.left , newContentRect.top ,
newContentRect.right - newContentRect.left ,
newContentRect.bottom - newContentRect.top) ;
wxSize formerSize = toplevelWindow->GetSize() ;
bool handled = false ;
if ((attributes & kWindowBoundsChangeSizeChanged) != 0)
if ( (attributes & kWindowBoundsChangeSizeChanged ) ||
( attributes & kWindowBoundsChangeOriginChanged ) )
toplevelWindow->SetSize( newContentRect.left , newContentRect.top ,
newContentRect.right - newContentRect.left ,
newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING);
int x , y , w , h ;
toplevelWindow->GetPosition( &x , &y ) ;
toplevelWindow->GetSize( &w , &h ) ;
Rect adjustedRect = { y , x , y + h , x + w } ;
if ( !EqualRect( &newContentRect , &adjustedRect ) )
{
wxSizeEvent event(contentRect , toplevelWindow->GetId());
event.SetEventObject(toplevelWindow);
handled = toplevelWindow->GetEventHandler()->ProcessEvent(event);
contentRect = event.GetRect() ;
}
else if ( attributes & kWindowBoundsChangeOriginChanged != 0)
{
wxMoveEvent event(contentRect , toplevelWindow->GetId());
event.SetEventObject(toplevelWindow);
handled = toplevelWindow->GetEventHandler()->ProcessEvent(event);
contentRect = event.GetRect() ;
}
if ( handled )
{
SetRect( &newContentRect , contentRect.GetLeft() , contentRect.GetTop() , contentRect.GetRight() , contentRect.GetBottom() ) ;
SetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, sizeof( newContentRect ), &newContentRect );
SetEventParameter( event , kEventParamCurrentBounds , typeQDRectangle, sizeof( adjustedRect ) , &adjustedRect ) ;
}
if ( toplevelWindow->GetSize() != formerSize )
toplevelWindow->Update() ;
result = noErr ;
}
break ;