rearrange some code in DoSetSize to facilitate upcoming changes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71236 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2012-04-19 16:44:59 +00:00
parent 34670bdafe
commit 4d711190c7

View File

@@ -2624,17 +2624,22 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
height = sizeBest.y; height = sizeBest.y;
} }
const wxSize oldSize(m_width, m_height); if (width == -1)
if (width != -1) width = m_width;
m_width = width; if (height == -1)
if (height != -1) height = m_height;
m_height = height;
if (m_parent->m_wxwindow) const bool sizeChange = m_width != width || m_height != height;
if (sizeChange || m_x != x || m_y != y)
{ {
m_x = x; m_x = x;
m_y = y; m_y = y;
m_width = width;
m_height = height;
}
if (m_parent->m_wxwindow)
{
int left_border = 0; int left_border = 0;
int right_border = 0; int right_border = 0;
int top_border = 0; int top_border = 0;
@@ -2661,21 +2666,15 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
m_height+top_border+bottom_border ); m_height+top_border+bottom_border );
} }
if (m_width != oldSize.x || m_height != oldSize.y) if (sizeChange)
{ {
// update these variables to keep size_allocate handler // update these variables to keep size_allocate handler
// from sending another size event for this change // from sending another size event for this change
GetClientSize( &m_oldClientWidth, &m_oldClientHeight ); GetClientSize( &m_oldClientWidth, &m_oldClientHeight );
gtk_widget_queue_resize(m_widget); gtk_widget_queue_resize(m_widget);
if (!m_nativeSizeEvent) }
{ if ((sizeChange && !m_nativeSizeEvent) || (sizeFlags & wxSIZE_FORCE_EVENT))
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
HandleWindowEvent( event );
}
} else
if (sizeFlags & wxSIZE_FORCE_EVENT)
{ {
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );