Re: TreeView column autoresize



В Чтв, 14/12/2006 в 19:21 +0300, Andrew E. Makeev пишет:
> Hello.
> 
> There is feature for GtkTreeView.
> When you double click with MB1 on the separator (just between 2 columns)
> inside tree column header then left column should be autoresized to
> appropriate width.
> Yes, column should have RESIZABLE and GTK_COLUMN_FIXED set.
> 
> I found that feature "fixed" from version GTK+-2.4.13 to GTK+-2.4.14.
> 
> I would to know where to look to restore that feature in the code?
> And, could someone write me the new version of GTK+ where it works well
> not only for Linux, but for Win32 as well, please?

Well, I found it.

void
_gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
                                      gboolean           install_handler)
{
  GList *list;

  for (list = tree_column->cell_list; list; list = list->next)
    {
      GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;

      info->requested_width = 0;
    }
  tree_column->dirty = TRUE;

//!!! This line was removed since 2.4.14, and never restored/reimplemented again.
  tree_column->resized_width = MAX (tree_column->requested_width, tree_column->button_request);
//!!! So, autoresize with double click is lost in further versions of GTK+-2

  tree_column->requested_width = -1;
  tree_column->width = 0;

  if (tree_column->tree_view &&
      GTK_WIDGET_REALIZED (tree_column->tree_view))
    {
      if (install_handler)
        _gtk_tree_view_install_mark_rows_col_dirty (GTK_TREE_VIEW (tree_column->tree_view));
      else
        GTK_TREE_VIEW (tree_column->tree_view)->priv->mark_rows_col_dirty = TRUE;
      gtk_widget_queue_resize (tree_column->tree_view);
    }
}





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