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:
@@ -354,30 +354,27 @@ static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRe
|
|||||||
GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
|
GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
|
||||||
sizeof( newContentRect ), NULL, &newContentRect );
|
sizeof( newContentRect ), NULL, &newContentRect );
|
||||||
|
|
||||||
wxRect contentRect(newContentRect.left , newContentRect.top ,
|
wxSize formerSize = toplevelWindow->GetSize() ;
|
||||||
newContentRect.right - newContentRect.left ,
|
|
||||||
newContentRect.bottom - newContentRect.top) ;
|
|
||||||
|
|
||||||
bool handled = false ;
|
if ( (attributes & kWindowBoundsChangeSizeChanged ) ||
|
||||||
if ((attributes & kWindowBoundsChangeSizeChanged) != 0)
|
( 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());
|
SetEventParameter( event , kEventParamCurrentBounds , typeQDRectangle, sizeof( adjustedRect ) , &adjustedRect ) ;
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( toplevelWindow->GetSize() != formerSize )
|
||||||
|
toplevelWindow->Update() ;
|
||||||
|
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
@@ -354,30 +354,27 @@ static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRe
|
|||||||
GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
|
GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
|
||||||
sizeof( newContentRect ), NULL, &newContentRect );
|
sizeof( newContentRect ), NULL, &newContentRect );
|
||||||
|
|
||||||
wxRect contentRect(newContentRect.left , newContentRect.top ,
|
wxSize formerSize = toplevelWindow->GetSize() ;
|
||||||
newContentRect.right - newContentRect.left ,
|
|
||||||
newContentRect.bottom - newContentRect.top) ;
|
|
||||||
|
|
||||||
bool handled = false ;
|
if ( (attributes & kWindowBoundsChangeSizeChanged ) ||
|
||||||
if ((attributes & kWindowBoundsChangeSizeChanged) != 0)
|
( 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());
|
SetEventParameter( event , kEventParamCurrentBounds , typeQDRectangle, sizeof( adjustedRect ) , &adjustedRect ) ;
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( toplevelWindow->GetSize() != formerSize )
|
||||||
|
toplevelWindow->Update() ;
|
||||||
|
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
Reference in New Issue
Block a user