Re: Changing which CList columns expands



>>>>> "me" == Roland Roberts <roland astrofoto org> writes:

    me> Is there a way to change which CList column automagically
    me> expands when I change the parent widget size?  I have a CList
    me> with 3 columns and I would like for column 2 to get whatever
    me> extra space is available.  Columns 1 and 3 can be fixed size
    me> (although I haven't tried to force that).

I thought I could do this with code like the following, which is
executed right after recreating the window which contains the CList.
However, the window itself is smaller than the sum of the optimal
widths.  Here's a partial widget tree showing everything leading up to
the CList:

    o GnomeApp
    |
    +- GnomeDock
    |  |
    |  +- GnomeDockItem
    |  |  |
    |  |  +- GtkMenubar
    |  |  |
    |  +- GnomeDockItem
    |  |  |
    |  |  +- GtkToolbar
    |  |
    |  +- GtkViewport
    |     |
    |     +- GtkScrolledWindow
    |        |
    |        +- GtkCList
    |
    +- GnomeAppBar

What confuses me is that I really thought my size requests should have
been honored by the CList even if the top level window didn't get
resized (I half expected the scrolled window to eat the size change
and just adjust the scrollbars).

void
aipw_filelist_reload (void)
{
   GtkWidget *clist;
   gint i, optimum_width;
   gchar *text[3];

   clist = lookup_widget (GTK_WIDGET(aipw_filelist), "aipw_filelist_clist");
   g_assert (clist != NULL);
   for (i = 0; i < files.num_files; i++)
   {
      text[0] = NULL;
      text[1] = files.file[i].name;
      text[2] = "1.0";
      gtk_clist_append (GTK_CLIST(clist), text);
   }
   optimum_width = gtk_clist_optimal_column_width (GTK_CLIST(clist), 0);
   gtk_clist_set_column_min_width (GTK_CLIST(clist), 0, optimum_width);
   gtk_clist_set_column_max_width (GTK_CLIST(clist), 0, optimum_width);
   optimum_width = gtk_clist_optimal_column_width (GTK_CLIST(clist), 2);
   gtk_clist_set_column_width (GTK_CLIST(clist), 1, optimum_width);
   gtk_clist_set_column_min_width (GTK_CLIST(clist), 1, optimum_width);
   optimum_width = gtk_clist_optimal_column_width (GTK_CLIST(clist), 2);
   gtk_clist_set_column_min_width (GTK_CLIST(clist), 2, optimum_width);
   gtk_clist_set_column_max_width (GTK_CLIST(clist), 2, optimum_width);

   return;
}

roland
-- 
		       PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD                             RL Enterprises
roland rlenter com                     76-15 113th Street, Apt 3B
rbroberts acm org                          Forest Hills, NY 11375




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