Re: [glade--]Treeview no glademm

PhYx schrieb:
thx you very much but dont lose your time to do this exemple, i have finally decided to use gtkmm without glade. I really need the treeview and i am part of a member of 4 people so we have to do a sound table mix for school, its our projet.

I put together a _minimal_ (only glademm file created and 30 lines of code added to window1.hh and example of a treeview with glade(mm).

It should give you (and other people) an idea of how much work has to be done to get treeview support with current glade-2.

btw i ll need to use drag and drop to take a file from a treeview in a window and to drop it in another window, if you have any advice about doing that in gtkmm thx to tell me =)

Look into my example (running). You can drop lines into _existing_ positions but you cannot move a line to become a child of another (unless it already has children). This is a problem of gtk2.2 (fixed in 2.3). If this is important for you should raise your voice on gtk-devel, see

i saw there is a signal drag and drop in treeview but it works only to drag and drop in the treeview right ?

You can drag and drop between treeviews, given that you implement it yourself. You have to derive from the Model (!) [TreeStore] and override the dnd vfuncs:

class MyTreeStore : public Gtk::TreeStore
{       MyTreeStore(const Gtk::TreeModelColumnRecord& cols)
                : Gtk::TreeStore(cols) {}
virtual bool drag_data_get_vfunc(const Gtk::TreeModel::Path& path, GtkSelectionData* selection_data); virtual bool drag_data_delete_vfunc(const Gtk::TreeModel::Path& path); virtual bool drag_data_received_vfunc(const TreeModel::Path& dest, GtkSelectionData* selection_data);
static Glib::RefPtr<MyTreeStore> MyTreeStore::create(const Gtk::TreeModelColumnRecord& cols)
        {  MyTreeStore *x=new MyTreeStore(cols);
           return Glib::RefPtr<MyTreeStore>(x);

I experimented with drag_data_received beeing like:

   GtkTreeModel *model=0;
   GtkTreePath *path=0;
   if (!gtk_tree_get_row_drag_data(selection_data,&model,&path))
      return false;
   Glib::RefPtr<Gtk::TreeModel> source=Glib::wrap(model);
Gtk::TreeIter sourceit=source->get_iter(Gtk::TreeModel::Path(path,false)),

that should give you an initial idea about what to do.

Feel free to ask more

Attachment: minimal_tv_example.tgz
Description: GNU Unix tar archive

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