{
UInt32 attributes = cEvent.GetParameter<UInt32>(kEventParamAttributes,typeUInt32) ;
Rect newRect = cEvent.GetParameter<Rect>(kEventParamCurrentBounds) ;
- wxRect r( newRect.left , newRect.top , newRect.right - newRect.left , newRect.bottom - newRect.top ) ;
if ( (attributes & kWindowBoundsChangeSizeChanged) || (attributes & kWindowBoundsChangeOriginChanged) )
{
+ // all (Mac) rects are in content area coordinates, all wxRects in structure coordinates
+ int left , top , right , bottom ;
+ toplevelWindow->MacGetContentAreaInset( left , top , right , bottom ) ;
+ wxRect r( newRect.left - left , newRect.top - top ,
+ newRect.right - newRect.left + left + right , newRect.bottom - newRect.top + top + bottom ) ;
// this is a EVT_SIZING not a EVT_SIZE type !
wxSizeEvent wxevent( r , toplevelWindow->GetId() ) ;
wxevent.SetEventObject( toplevelWindow ) ;
wxRect adjustR = r ;
if ( toplevelWindow->GetEventHandler()->ProcessEvent(wxevent) )
- {
adjustR = wxevent.GetRect() ;
- }
+
if ( toplevelWindow->GetMaxWidth() != -1 && adjustR.GetWidth() > toplevelWindow->GetMaxWidth() )
adjustR.SetWidth( toplevelWindow->GetMaxWidth() ) ;
if ( toplevelWindow->GetMaxHeight() != -1 && adjustR.GetHeight() > toplevelWindow->GetMaxHeight() )
adjustR.SetWidth( toplevelWindow->GetMinWidth() ) ;
if ( toplevelWindow->GetMinHeight() != -1 && adjustR.GetHeight() < toplevelWindow->GetMinHeight() )
adjustR.SetHeight( toplevelWindow->GetMinHeight() ) ;
- Rect adjustedRect = { adjustR.y , adjustR.x , adjustR.y + adjustR.height , adjustR.x + adjustR.width } ;
+ Rect adjustedRect = { adjustR.y + top , adjustR.x + left , adjustR.y + adjustR.height + bottom , adjustR.x + adjustR.width + right } ;
if ( !EqualRect( &newRect , &adjustedRect ) )
cEvent.SetParameter( kEventParamCurrentBounds , &adjustedRect ) ;
}
// init our fields
Init();
+ style = style & ~wxFRAME_SHAPED ;
+
m_windowStyle = style;
SetName(name);
// we are still using coordinates of the content view, todo switch to structure bounds
+void wxTopLevelWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , int &bottom )
+{
+ Rect content ;
+ Rect structure ;
+ GetWindowBounds( (WindowRef) m_macWindow, kWindowStructureRgn , &structure ) ;
+ GetWindowBounds( (WindowRef) m_macWindow, kWindowContentRgn , &content ) ;
+
+ left = content.left - structure.left ;
+ top = content.top - structure.top ;
+ right = structure.right - content.right ;
+ bottom = structure.bottom - content.bottom ;
+}
+
void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
{
Rect bounds = { y , x , y + height , x + width } ;
if ( y ) *y = y1 ;
}
+void wxWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , int &bottom )
+{
+ RgnHandle rgn = NewRgn() ;
+ Rect content ;
+ if ( GetControlRegion( (ControlRef) m_macControl , kControlContentMetaPart , rgn ) == noErr )
+ {
+ GetRegionBounds( rgn , &content ) ;
+ DisposeRgn( rgn ) ;
+ }
+ else
+ {
+ GetControlBounds( (ControlRef) m_macControl , &content ) ;
+ }
+ Rect structure ;
+ GetControlBounds( (ControlRef) m_macControl , &structure ) ;
+#if !TARGET_API_MAC_OSX
+ OffsetRect( &content , -structure.left , -structure.top ) ;
+#endif
+ left = content.left - structure.left ;
+ top = content.top - structure.top ;
+ right = structure.right - content.right ;
+ bottom = structure.bottom - content.bottom ;
+}
+
wxSize wxWindowMac::DoGetSizeFromClientSize( const wxSize & size ) const
{
wxSize sizeTotal = size;