Re: Inserting a Gtk::StockID image in a treeview cell



I'm not sure if it's correct solution, but you can use a Gtk::Image:

Gtk::Image img(Gtk::Stock::OPEN, Gtk::ICON_SIZE_MENU);
row[mColumns.m_col_state] = img.get_pixbuf();

If anyone has a better solution, share it, please.

2010/7/5, Guillaume Radenne <guillaume radenne gmail com>:
> Hello,
>
> I'm wondering how i can put a Gtk::StockID image in a treeview cell ?
>
> I curently know how to put a png file (as an example) but i don't know how
> to do the same thing with an icon such as Gtk::StockID(Gtk::Stock::YES) ...
>
> Here is what I have :
>
>     class ModelColumns : public Gtk::TreeModelColumnRecord
>     {
>     public:
>
>         ModelColumns() {
>             add(m_col_selected);
>             add(m_col_name);
>             add(m_col_state);
>         }
>
>         Gtk::TreeModelColumn<bool> m_col_selected;
>         Gtk::TreeModelColumn<Glib::ustring> m_col_name;
>         Gtk::TreeModelColumn < Glib::RefPtr < Gdk::Pixbuf > > m_col_state;
>     };
>
>
> .....
>
> row[mColumns.m_col_state] =
> Gdk::Pixbuf::create("/usr/share/icons/Human/32x32/actions/media-eject.png");
>
> --
> Guillaume Radenne
>


-- 
2b || !2b


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