Fixed a bug which sometimes lead to windows

showing up at the size of 20x20 (default).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2333 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-05-03 21:09:58 +00:00
parent b0795d4568
commit e208b369f0
10 changed files with 88 additions and 28 deletions

View File

@@ -584,11 +584,13 @@ void wxComboBox::OnSize( wxSizeEvent &event )
{ {
wxControl::OnSize( event ); wxControl::OnSize( event );
/*
int w = 21; int w = 21;
gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height ); gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height );
gtk_widget_set_uposition( GTK_COMBO(m_widget)->button, m_x+m_width-w, m_y ); gtk_widget_set_uposition( GTK_COMBO(m_widget)->button, m_x+m_width-w, m_y );
gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height ); gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height );
*/
} }
void wxComboBox::ApplyWidgetStyle() void wxComboBox::ApplyWidgetStyle()

View File

@@ -667,6 +667,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
m_frameMenuBar->m_height = hh; m_frameMenuBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameMenuBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameMenuBar->m_widget, xx, yy );
// m_frameMenuBar->m_widget->requisition.width = ww;
// m_frameMenuBar->m_widget->requisition.height = hh;
gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
client_area_y_offset += hh; client_area_y_offset += hh;
@@ -692,6 +695,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
m_frameToolBar->m_width = ww; m_frameToolBar->m_width = ww;
gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameToolBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameToolBar->m_widget, xx, yy );
// m_frameToolBar->m_widget->requisition.width = ww;
// m_frameToolBar->m_widget->requisition.height = hh;
gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
client_area_y_offset += hh; client_area_y_offset += hh;
@@ -703,7 +709,10 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
int client_w = m_width - 2*m_miniEdge; int client_w = m_width - 2*m_miniEdge;
int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle; int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
// m_wxwindow->requisition.width = client_w;
// m_wxwindow->requisition.height = client_h;
gtk_widget_set_usize( m_wxwindow, client_w, client_h ); gtk_widget_set_usize( m_wxwindow, client_w, client_h );
} }
else else
{ {
@@ -724,6 +733,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
m_frameStatusBar->m_height = hh; m_frameStatusBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy );
// m_frameStatusBar->m_widget->requisition.width = ww;
// m_frameStatusBar->m_widget->requisition.height = hh;
gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh );
} }

View File

@@ -384,8 +384,12 @@ gtk_myfixed_size_request (GtkWidget *widget,
myfixed = GTK_MYFIXED (widget); myfixed = GTK_MYFIXED (widget);
/*
requisition->width = 0; requisition->width = 0;
requisition->height = 0; requisition->height = 0;
*/
requisition->width = widget->requisition.width;
requisition->height = widget->requisition.height;
children = myfixed->children; children = myfixed->children;
while (children) while (children)

View File

@@ -1446,7 +1446,7 @@ static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
child->m_x, child->m_x,
child->m_y ); child->m_y );
gtk_widget_set_usize( GTK_WIDGET(child->m_widget), gtk_widget_set_usize( child->m_widget,
child->m_width, child->m_width,
child->m_height ); child->m_height );
@@ -1994,7 +1994,7 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
if (m_resizing) return; /* I don't like recursions */ if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE; m_resizing = TRUE;
if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */ if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook page */
{ {
/* don't set the size for children of wxNotebook, just take the values. */ /* don't set the size for children of wxNotebook, just take the values. */
m_x = x; m_x = x;
@@ -2053,15 +2053,27 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
if ((old_width != m_width) || (old_height != m_height)) if ((old_width != m_width) || (old_height != m_height))
{ {
/* /*
wxPrintf( _T("On DoSetSize from ") );
wxPrintf( GetClassInfo()->GetClassName() );
wxPrintf( _T(": %d %d.\n"), m_width, m_height );
*/
gtk_widget_set_usize( m_widget, m_width, m_height );
/* this is the result of hours of debugging: the followomg code
means that if we have a m_wxwindow and we set the size of
m_widget, m_widget (which is a GtkScrolledWindow) does NOT
automatically propagate its size down to its m_wxwindow,
which is its client area. therefore, we have to tell the
client area directly that it has to get resize itself */
GtkAllocation alloc; GtkAllocation alloc;
alloc.x = m_x; alloc.x = m_x;
alloc.y = m_y; alloc.y = m_y;
alloc.width = m_width; alloc.width = m_width;
alloc.height = m_height; alloc.height = m_height;
gtk_widget_size_allocate( m_widget, &alloc ); gtk_widget_size_allocate( m_widget, &alloc );
*/
gtk_widget_set_usize( m_widget, m_width, m_height );
} }
} }
} }

View File

@@ -584,11 +584,13 @@ void wxComboBox::OnSize( wxSizeEvent &event )
{ {
wxControl::OnSize( event ); wxControl::OnSize( event );
/*
int w = 21; int w = 21;
gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height ); gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height );
gtk_widget_set_uposition( GTK_COMBO(m_widget)->button, m_x+m_width-w, m_y ); gtk_widget_set_uposition( GTK_COMBO(m_widget)->button, m_x+m_width-w, m_y );
gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height ); gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height );
*/
} }
void wxComboBox::ApplyWidgetStyle() void wxComboBox::ApplyWidgetStyle()

View File

@@ -667,6 +667,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
m_frameMenuBar->m_height = hh; m_frameMenuBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameMenuBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameMenuBar->m_widget, xx, yy );
// m_frameMenuBar->m_widget->requisition.width = ww;
// m_frameMenuBar->m_widget->requisition.height = hh;
gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
client_area_y_offset += hh; client_area_y_offset += hh;
@@ -692,6 +695,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
m_frameToolBar->m_width = ww; m_frameToolBar->m_width = ww;
gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameToolBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_frameToolBar->m_widget, xx, yy );
// m_frameToolBar->m_widget->requisition.width = ww;
// m_frameToolBar->m_widget->requisition.height = hh;
gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
client_area_y_offset += hh; client_area_y_offset += hh;
@@ -703,7 +709,10 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
int client_w = m_width - 2*m_miniEdge; int client_w = m_width - 2*m_miniEdge;
int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle; int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
// m_wxwindow->requisition.width = client_w;
// m_wxwindow->requisition.height = client_h;
gtk_widget_set_usize( m_wxwindow, client_w, client_h ); gtk_widget_set_usize( m_wxwindow, client_w, client_h );
} }
else else
{ {
@@ -724,6 +733,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
m_frameStatusBar->m_height = hh; m_frameStatusBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy );
// m_frameStatusBar->m_widget->requisition.width = ww;
// m_frameStatusBar->m_widget->requisition.height = hh;
gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh );
} }

View File

@@ -384,8 +384,12 @@ gtk_myfixed_size_request (GtkWidget *widget,
myfixed = GTK_MYFIXED (widget); myfixed = GTK_MYFIXED (widget);
/*
requisition->width = 0; requisition->width = 0;
requisition->height = 0; requisition->height = 0;
*/
requisition->width = widget->requisition.width;
requisition->height = widget->requisition.height;
children = myfixed->children; children = myfixed->children;
while (children) while (children)

View File

@@ -1446,7 +1446,7 @@ static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
child->m_x, child->m_x,
child->m_y ); child->m_y );
gtk_widget_set_usize( GTK_WIDGET(child->m_widget), gtk_widget_set_usize( child->m_widget,
child->m_width, child->m_width,
child->m_height ); child->m_height );
@@ -1994,7 +1994,7 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
if (m_resizing) return; /* I don't like recursions */ if (m_resizing) return; /* I don't like recursions */
m_resizing = TRUE; m_resizing = TRUE;
if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */ if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook page */
{ {
/* don't set the size for children of wxNotebook, just take the values. */ /* don't set the size for children of wxNotebook, just take the values. */
m_x = x; m_x = x;
@@ -2053,15 +2053,27 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
if ((old_width != m_width) || (old_height != m_height)) if ((old_width != m_width) || (old_height != m_height))
{ {
/* /*
wxPrintf( _T("On DoSetSize from ") );
wxPrintf( GetClassInfo()->GetClassName() );
wxPrintf( _T(": %d %d.\n"), m_width, m_height );
*/
gtk_widget_set_usize( m_widget, m_width, m_height );
/* this is the result of hours of debugging: the followomg code
means that if we have a m_wxwindow and we set the size of
m_widget, m_widget (which is a GtkScrolledWindow) does NOT
automatically propagate its size down to its m_wxwindow,
which is its client area. therefore, we have to tell the
client area directly that it has to get resize itself */
GtkAllocation alloc; GtkAllocation alloc;
alloc.x = m_x; alloc.x = m_x;
alloc.y = m_y; alloc.y = m_y;
alloc.width = m_width; alloc.width = m_width;
alloc.height = m_height; alloc.height = m_height;
gtk_widget_size_allocate( m_widget, &alloc ); gtk_widget_size_allocate( m_widget, &alloc );
*/
gtk_widget_set_usize( m_widget, m_width, m_height );
} }
} }
} }