+void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
+{
+ int former_x = m_x ;
+ int former_y = m_y ;
+ int former_w = m_width ;
+ int former_h = m_height ;
+
+ int currentX, currentY;
+ GetPosition(¤tX, ¤tY);
+ int currentW,currentH;
+ GetSize(¤tW, ¤tH);
+
+ int actualWidth = width;
+ int actualHeight = height;
+ int actualX = x;
+ int actualY = y;
+ if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+ actualX = currentX;
+ if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+ actualY = currentY;
+ if (width == -1)
+ actualWidth = currentW ;
+ if (height == -1)
+ actualHeight = currentH ;
+
+ if ( actualX == currentX && actualY == currentY && actualWidth == currentW && actualHeight == currentH)
+ {
+ MacRepositionScrollBars() ; // we might have a real position shift
+ return ;
+ }
+
+ AdjustForParentClientOrigin(actualX, actualY, sizeFlags);
+
+
+ bool doMove = false ;
+ bool doResize = false ;
+
+ if ( actualX != former_x || actualY != former_y )
+ {
+ doMove = true ;
+ }
+ if ( actualWidth != former_w || actualHeight != former_h )
+ {
+ doResize = true ;
+ }
+
+ if ( doMove || doResize )
+ {
+ if ( m_macWindowData )
+ {
+ }
+ else
+ {
+ // erase former position
+ {
+ wxMacDrawingClientHelper focus( this ) ;
+ if ( focus.Ok() )
+ {
+ Rect clientrect = { 0 , 0 , m_height , m_width } ;
+ InvalRect( &clientrect ) ;
+ }
+ }
+ }
+ m_x = actualX ;
+ m_y = actualY ;
+ m_width = actualWidth ;
+ m_height = actualHeight ;
+ if ( m_macWindowData )
+ {
+ if ( doMove )
+ ::MoveWindow(m_macWindowData->m_macWindow, m_x, m_y, false); // don't make frontmost
+
+ if ( doResize )
+ ::SizeWindow(m_macWindowData->m_macWindow, m_width, m_height, true);
+
+ // the OS takes care of invalidating and erasing
+
+ if ( IsKindOf( CLASSINFO( wxFrame ) ) )
+ {
+ wxFrame* frame = (wxFrame*) this ;
+ frame->PositionStatusBar();
+ frame->PositionToolBar();
+ }
+ }
+ else
+ {
+ // erase new position
+ {
+ wxMacDrawingClientHelper focus( this ) ;
+ if ( focus.Ok() )
+ {
+ Rect clientrect = { 0 , 0 , m_height , m_width } ;
+ InvalRect( &clientrect ) ;
+ }
+ }
+ if ( doMove )
+ wxWindow::MacSuperChangedPosition() ; // like this only children will be notified
+ }
+ MacRepositionScrollBars() ;
+ if ( doMove )
+ {
+ wxMoveEvent event(wxPoint(m_x, m_y), m_windowId);
+ event.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(event) ;
+ }
+ if ( doResize )
+ {
+ MacRepositionScrollBars() ;
+ wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
+ event.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(event);
+ }
+ }
+}