gtk vbox size allocate



The overlap occurs  when I packed the widgets whose size requisition are

larger than the allocation of vbox into vobx.When I check the source
code I found that the overlap will occur if the  allocation of vbox is
smaller than the requisition of child widgets . Is it  a design
heuristic  to let the overlap  occur when the available space is not
enough?
Does this rule can be break  if it is necessary  ?

if (box->homogeneous)
        {
          height = (allocation->height -
                   GTK_CONTAINER (box)->border_width * 2 -
                   (nvis_children - 1) * box->spacing);
          extra = height / nvis_children;
        }
      else if (nexpand_children > 0)
        {
/* In this case the height and extra  will be negative if the allocation

height is smaller than the  widget->requisition.heigh */
          height = (gint) allocation->height - (gint)
widget->requisition.height;
          extra = height / nexpand_children;
        }
      else
        {
          height = 0;
          extra = 0;
        }

.............................................


 if (child->expand)
          {
                      if (nexpand_children == 1)
                        child_height += height;
                      else
                        child_height += extra;  /* It will be negative
if the extra is negative */

                      nexpand_children -= 1;
                      height -= extra;
            }

....................................

And induce the overlap of allocation .

         gtk_widget_size_allocate (child->widget, &child_allocation);

           y += child_height + box->spacing;  /* overlap allocation
occurs when the child_height is negative*/


Jacky



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]