From 83901ec20cbd8a133c2c9e965a7880a3d17aef89 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 5 Sep 2003 02:07:28 +0000 Subject: [PATCH] added live resizing git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23392 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/toplevel.cpp | 39 +++++++++++++++++-------------------- src/mac/toplevel.cpp | 39 +++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 42 deletions(-) diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index fce9d1fbf5..a4b965bcbf 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -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 ; diff --git a/src/mac/toplevel.cpp b/src/mac/toplevel.cpp index fce9d1fbf5..a4b965bcbf 100644 --- a/src/mac/toplevel.cpp +++ b/src/mac/toplevel.cpp @@ -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 ;