Using CellRendererPixbuf



Hi,

    I'm trying to implement images in treeview cells using an image cell
render.  All I could find regarding this was:
http://mail.gnome.org/archives/gtkmm-list/2003-September/msg00077.html -
which looks promising.

    Assuming Gtk::TreeModelColumn<Gdk::Pixbuf> icon;  How would I add
the Pixbuf of a stock image to the row's cell, row[column_set.icon] = ???
Image::get_pixbuf() returns a RefPtr which as I understand can't be
dereferenced.

    Can anyone provide any guidance?  This is my first gtkmm app so I'm
quite clueless.

    Thanks in advance,
    C.


Archive Code Snip:

  /* Create renderer */

  Gtk::CellRendererPixbuf *imagerenderer =

      Gtk::manage(new Gtk::CellRendererPixbuf);

  /* Create col */

  Gtk::TreeViewColumn* iconcolumn =

      Gtk::manage(new Gtk::TreeViewColumn("Icon", *imagerenderer));

  /* Add renderer and Gtk::ModelViewColumn to the Gtk::TreeView::Column */

  iconcolumn->set_renderer(*imagerenderer, this->column_set.icon);

  /* Add col to Gtk::TreeView */

  this->tree_view.append_column (*iconcolumn);




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