0

I try to implement tree like in windows explorer using gtkmm3.

My problem is that to add icon I add a column for it, so it look strange 1 : * The tree triangle and dot line is on the left * All text label is aligned on there row on the right. * And icon are floating between us aligned on the left => See attached image for more details...

My goal it to have text not aligned on a row but following the icon with a fixed width.

Thanks for your help,

WCdr
  • 185
  • 4
  • 12

1 Answers1

0

Self-service : solution is here : https://developer.gnome.org/gtkmm-tutorial/stable/sec-treeview.html.en - 9.2.3. More than one Model Column per View Column => Who said that there's no documentation...

1 - Create a Gtk::TreeView::Column 2 - Add column with icon
* fct : column->pack_start ( put your column id here, false ); <= false (no padding) * Model : Gtk::TreeModelColumn 3 - Add column with text * fct : column->pack_start ( put your column id here, true ); <= true (padding) * Model : Gtk::TreeModelColumn 4 - Add colun to tree : tree->append_column ( column) 5 - set line icon and text * row[column text id] = "Billy Bob"; * row[column icon id ] = Gdk::Pixbuf::create_from_file ( "png path in my case" );

Warning icon size is 1:1 to adjust size you need to add more code. In my case i use svg so i can build the pix with the right size...

Tips : To hide header : tree->set_headers_visible ( false );

WCdr
  • 185
  • 4
  • 12