Added scrolling of widgets and sample
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1444,11 +1444,9 @@ static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
|
||||
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
|
||||
GTK_WIDGET(child->m_widget),
|
||||
child->m_x,
|
||||
child->m_y );
|
||||
|
||||
gtk_widget_set_usize( child->m_widget,
|
||||
child->m_width,
|
||||
child->m_height );
|
||||
child->m_y,
|
||||
child->m_width,
|
||||
child->m_height );
|
||||
|
||||
if (parent->m_windowStyle & wxTAB_TRAVERSAL)
|
||||
{
|
||||
@@ -2037,55 +2035,42 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
|
||||
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
|
||||
|
||||
int border = 0;
|
||||
|
||||
if (GTK_WIDGET_HAS_DEFAULT(m_widget))
|
||||
{
|
||||
/* the default button has a border around it */
|
||||
int border = 5;
|
||||
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x-border, m_y-border );
|
||||
|
||||
gtk_widget_set_usize( m_widget, m_width+2*border, m_height+2*border );
|
||||
border = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x, m_y );
|
||||
|
||||
if ((old_width != m_width) || (old_height != m_height))
|
||||
{
|
||||
gtk_widget_set_usize( m_widget, m_width, m_height );
|
||||
/* this is the result of hours of debugging: the following 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 resize itself.
|
||||
this will lead to that m_widget (GtkScrolledWindow) will
|
||||
calculate how much size it needs for scrollbars etc and
|
||||
it will then call XXX_size_allocate of its child, which
|
||||
is m_wxwindow. m_wxwindow in turn will do the same with its
|
||||
children and so on. problems can arise if this happens
|
||||
before all the children have been realized as some widgets
|
||||
stupidy need to be realized during XXX_size_allocate (e.g.
|
||||
GtkNotebook) and they will segv if called otherwise. this
|
||||
emergency is tested in gtk_myfixed_size_allocate. Normally
|
||||
this shouldn't be needed and only gtk_widget_queue_resize()
|
||||
should be enough to provoke a resize at the next appropriate
|
||||
moment, but this seems to fail, e.g. when a wxNotebook contains
|
||||
a wxSplitterWindow: the splitter window's children won't
|
||||
show up properly resized then. */
|
||||
|
||||
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
|
||||
m_widget,
|
||||
m_x-border,
|
||||
m_y-border,
|
||||
m_width+2*border,
|
||||
m_height+2*border );
|
||||
|
||||
/* this is the result of hours of debugging: the following 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 resize itself.
|
||||
this will lead to that m_widget (GtkScrolledWindow) will
|
||||
calculate how much size it needs for scrollbars etc and
|
||||
it will then call XXX_size_allocate of its child, which
|
||||
is m_wxwindow. m_wxwindow in turn will do the same with its
|
||||
children and so on. problems can arise if this happens
|
||||
before all the children have been realized as some widgets
|
||||
stupidy need to be realized during XXX_size_allocate (e.g.
|
||||
GtkNotebook) and they will segv if called otherwise. this
|
||||
emergency is tested in gtk_myfixed_size_allocate. Normally
|
||||
this shouldn't be needed and only gtk_widget_queue_resize()
|
||||
should be enough to provoke a resize at the next appropriate
|
||||
moment, but this seems to fail, e.g. when a wxNotebook contains
|
||||
a wxSplitterWindow: the splitter window's children won't
|
||||
show up properly resized then. */
|
||||
|
||||
if (m_wxwindow)
|
||||
{
|
||||
GtkAllocation alloc;
|
||||
alloc.x = m_x;
|
||||
alloc.y = m_y;
|
||||
alloc.width = m_width;
|
||||
alloc.height = m_height;
|
||||
gtk_widget_size_allocate( m_widget, &alloc );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_sizeSet = TRUE;
|
||||
|
Reference in New Issue
Block a user