correct scrolling of various GTK+ widgets such as GtkFrame (wxStaticBox)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@48553 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-09-04 13:24:46 +00:00
parent 9ccefe88a6
commit 1e59f7f503
2 changed files with 14 additions and 49 deletions

View File

@@ -302,6 +302,8 @@ MyCanvas::MyCanvas( wxScrolledWindow *parent, MyTopLabels *top, MyRightLabels *r
(void)new wxComboBox( this, wxID_ANY, _T("ComboBox I"), wxPoint(0,150), wxSize(100,25)); (void)new wxComboBox( this, wxID_ANY, _T("ComboBox I"), wxPoint(0,150), wxSize(100,25));
(void)new wxComboBox( this, wxID_ANY, _T("ComboBox II"), wxPoint(200,150), wxSize(100,25)); (void)new wxComboBox( this, wxID_ANY, _T("ComboBox II"), wxPoint(200,150), wxSize(100,25));
(void)new wxStaticBox( this, wxID_ANY, _T("StaticBox"), wxPoint(0,200), wxSize(200,60));
SetBackgroundColour( wxT("WHEAT") ); SetBackgroundColour( wxT("WHEAT") );
SetCursor( wxCursor( wxCURSOR_IBEAM ) ); SetCursor( wxCursor( wxCURSOR_IBEAM ) );

View File

@@ -71,8 +71,6 @@ static void gtk_pizza_forall (GtkContainer *container,
static void gtk_pizza_allocate_child (GtkPizza *pizza, static void gtk_pizza_allocate_child (GtkPizza *pizza,
GtkPizzaChild *child); GtkPizzaChild *child);
static void gtk_pizza_adjust_allocations_recurse (GtkWidget *widget,
gpointer cb_data);
static GtkType gtk_pizza_child_type (GtkContainer *container); static GtkType gtk_pizza_child_type (GtkContainer *container);
@@ -691,33 +689,16 @@ gtk_pizza_allocate_child (GtkPizza *pizza,
gtk_widget_size_allocate (child->widget, &allocation); gtk_widget_size_allocate (child->widget, &allocation);
} }
static void void
gtk_pizza_adjust_allocations_recurse (GtkWidget *widget, gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
gpointer cb_data)
{
GtkPizzaAdjData *data = cb_data;
widget->allocation.x += data->dx;
widget->allocation.y += data->dy;
if (GTK_WIDGET_NO_WINDOW (widget) && GTK_IS_CONTAINER (widget))
{
gtk_container_forall (GTK_CONTAINER (widget),
gtk_pizza_adjust_allocations_recurse,
cb_data);
}
}
static void
gtk_pizza_adjust_allocations (GtkPizza *pizza,
gint dx,
gint dy)
{ {
GList *tmp_list; GList *tmp_list;
GtkPizzaAdjData data;
data.dx = dx; pizza->m_xoffset += dx;
data.dy = dy; pizza->m_yoffset += dy;
if (pizza->bin_window)
gdk_window_scroll( pizza->bin_window, -dx, -dy );
tmp_list = pizza->children; tmp_list = pizza->children;
while (tmp_list) while (tmp_list)
@@ -725,30 +706,12 @@ gtk_pizza_adjust_allocations (GtkPizza *pizza,
GtkPizzaChild *child = tmp_list->data; GtkPizzaChild *child = tmp_list->data;
tmp_list = tmp_list->next; tmp_list = tmp_list->next;
child->widget->allocation.x += dx; GtkAllocation alloc = child->widget->allocation;
child->widget->allocation.y += dy; alloc.x -= dx;
alloc.y -= dy;
if (GTK_WIDGET_NO_WINDOW (child->widget) && gtk_widget_size_allocate( child->widget, &alloc );
GTK_IS_CONTAINER (child->widget))
{
gtk_container_forall (GTK_CONTAINER (child->widget),
gtk_pizza_adjust_allocations_recurse,
&data);
} }
} }
}
void
gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
{
pizza->m_xoffset += dx;
pizza->m_yoffset += dy;
gtk_pizza_adjust_allocations (pizza, -dx, -dy);
if (pizza->bin_window)
gdk_window_scroll( pizza->bin_window, -dx, -dy );
}
#ifdef __cplusplus #ifdef __cplusplus
} }