Re: Attaching pixmap to Tree item



On Thu, 2002-08-29 at 08:15, Deekshit Mantampady wrote:
Hi All,

  I wanted to attach pixmap for a tree item(at the time of tree initialization
and later dynamically). The tree item will have both label and pixmap(somthing
like MS Windows Explorer). Can any body help me to find the procedure for the
same.

Yea I had this problem before. It is not well documented.  Here is how
you do it (note: this is just how to set up the column, effectively all
you are doing it packing more than one renderer into a single column):


  GtkCellRenderer *renderer_text;
  GtkCellRenderer *renderer_image;
  GtkTreeViewColumn *column;

  /* cell renderer's */
  renderer_image = gtk_cell_renderer_pixbuf_new();
  renderer_text = gtk_cell_renderer_text_new();

  column = gtk_tree_view_column_new();

  /* COL_IMAGE */
  gtk_tree_view_column_pack_start(column,renderer_image,FALSE);
  gtk_tree_view_column_add_attribute(column,
                                     renderer_image,
                                     "pixbuf",COL_IMAGE);  

  /* COL_NAME */
  gtk_tree_view_column_pack_end(column,renderer_text,TRUE);
  gtk_tree_view_column_add_attribute(column,
                                     renderer_text,
                                     "text",COL_NAME);



  /* insert column */
  gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview),column,-1);


Thanks in advance

Regards
Deekshit

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Regards,

Martyn




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