Hi,

I am having an issue with a new container widget I am writing. I have
overridden the size_request and size_allocate methods.[0]

For some reason, the children are all rendered in the top-left corner
of the main window. Not even near the container.


http://svn.xfce.org/svn/goodies/ristretto/trunk/src/thumbnail_bar.c:152

>static void
>rstto_thumbnail_bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
>{
>    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(widget);
>    gint border_width =  0;
>    widget->allocation = *allocation;
>    GtkAllocation child_allocation;
>    GtkRequisition child_requisition;
>
>    child_allocation.x = allocation->x + border_width;
>    child_allocation.y = allocation->y + border_width;
>    child_allocation.width = 70 - border_width;
>    child_allocation.height = 70 - border_width;
>
>    GSList *iter = bar->priv->thumbs;
>
>    /*
>    if (GTK_WIDGET_REALIZED (widget))
>    {
>        gdk_window_move_resize (widget->window,
>                              allocation->x + border_width,
>                              allocation->y + border_width,
>                              allocation->width - border_width * 2,
>                              allocation->height - border_width * 2);
>  }
>    */
>
>
>    switch(bar->priv->orientation)
>    {
>        case GTK_ORIENTATION_HORIZONTAL:
>            if(iter)
>            {
>                gtk_widget_get_child_requisition(GTK_WIDGET(iter->data), 
> &child_requisition);
>                gtk_widget_size_allocate(GTK_WIDGET(iter->data), 
> &child_allocation);
>                if (child_allocation.x < (allocation->x + allocation->width))
>                    gtk_widget_set_child_visible(GTK_WIDGET(iter->data), TRUE);
>                else
>                    gtk_widget_set_child_visible(GTK_WIDGET(iter->data), 
> FALSE);
>
>                child_allocation.x += child_requisition.width;
>                iter = g_slist_next(iter);
>            }
>            break;
>        case GTK_ORIENTATION_VERTICAL:
>            break;
>    }
>}

What am I doing wrong?

Regards,

Stephan Arts


[0] http://svn.xfce.org/svn/goodies/ristretto/trunk/src/thumbnail_bar.c
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to