Re: [gtkmm] pack_start and AttachOptions is still confusing



>> Murray Cumming <murrayc usa net> writes:

 > Are you certain that (false, true) is never used? Can you convince me
 > or show me something official that says that?

 I can't find anything, but I found some examples which use false, true
 in the GTK+ 2 source tree.  For example:

        /* Another new separator. */
        separator = gtk_hseparator_new ();
        /* The last 3 arguments to gtk_box_pack_start are:
         * expand, fill, padding. */
        gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
        gtk_widget_show (separator);

 Looking at the vbox code, you find:

gtk_vbox_size_allocate (GtkWidget     *widget,
                        GtkAllocation *allocation)
{
  [...]
  if (nvis_children > 0)
    {
      [...]
      [...]
      while (children)
        {
          [...]
          if ((child->pack == GTK_PACK_START) && GTK_WIDGET_VISIBLE (child->widget))
            {
              if (box->homogeneous)
                {
                  [...]
                }
              else
                {
                  [...]
                  if (child->expand)
                    {
                      [...]
                    }
                }
              
              if (child->fill)
                {
                  child_allocation.height = MAX (1, child_height - (gint)child->padding * 2);
                  child_allocation.y = y + child->padding;
                }
              else
                {
                  [...]
                }

              gtk_widget_size_allocate (child->widget, &child_allocation);
              y += child_height + box->spacing;
            }
        }

      y = allocation->y + allocation->height - GTK_CONTAINER (box)->border_width;

 and a similar iteration over all the children with the first if's
 contition changed to (child->pack == GTK_PACK_END) and some signs
 changed.

 Looking at this code I couldn't really say what happens with expand =
 false, fill = true.  Playing with the demos, I don't see any
 difference.  From the Gtk::Widget documentation:

/**
 * gtk_widget_size_allocate:
 * @widget: a #GtkWidget
 * @allocation: position and size to be allocated to @widget
 *
 * This function is only used by #GtkContainer subclasses, to assign a size
 * and position to their child widgets.·
 *·
 **/

 which doesn't help (me) much.  There are other parts of the code where
 expand and fill is used, but that didn't help much.

 Perhaps a GTK+ guru knows the answer?

-- 
Marcelo



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