[gtkmm] treeview drag and drop



Hi all,

I am implementing a "dnd" on a treeview that allows
users to drag a string from somewhere and drop onto a
treeview. I want to figure out in which row the drop
point is,  so I do like this in "drop" event handler:

bool CTreeview_Frame::on_drag_drop
(const Glib::RefPtr<Gdk::DragContext>& context, int x,
int y, guint time)
{
    TreeModel::Path path;
    TreeViewColumn* column;
    int cell_x,cell_y;
    if(!m_tree_view.get_path_at_pos(x, y, path,
column, cell_x, cell_y))
        return true;
    Gtk::TreeRow row = (m_tree_store->get_iter(path));
    ......
}

But I found I always get the row after the one the
cursor points to. It seems the (x,y) above is the
position related to the upper-left corner of the whole
treeview widget, while the "get_path_at_pos" asks
position related to the upper-left corner of the first
row. (Not accounting for the column header). Is this
inconsistency a problem of gtk/gtkmm or what is
expected?  
The easist way to work around this is pass (x,
y-height_of_header) to the "get_path_at_pos", I
reckon. Can anyone tell me how to get the height of
the  
header (treeviewcolumn)?

Cheers,

Dan


=====
----------------------------------------------------------
Have fun!
__________________________________________________________

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



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