Re: multiple-item drag-and-drop




On Aug 29, 2007, at 7:32 AM, Jeffrey Ratcliffe wrote:

But I still don't understand how to determine the height of the header
row of a Simple::List.


/me pokes at gtktreeview.c for a few minutes.


I would presume that while you are dragging a row from the tree view, you are getting events from a grab of the pointer in the treeview's bin_window. The bin_window is the GdkWindow of the scrollable part of the widget, which is anchored at a y coordinate of TREE_VIEW_HEIGHT (treeview).

In theory, then, header height = widget allocation height - bin window drawable height. The drag-motion callback doesn't give you an event, so you'd have to capture this value in the button-press-event that starts the drag, as, i'm thinking, that button-press-event will happen with $event->window == treeview->private->bin_window.


# when the user clicks, store the current header height, in case this
   # click starts a drag.
   $treeview->signal_connect (button_press_event => sub {
       my ($widget, $event) = @_;
       my (undef, $bin_window_height) = $event->window->get_size;
$widget->{header_height} = $widget->allocation->height - $bin_window_height;
       return FALSE;
   });


I can't help thinking there ought to be a way to get it to work without knowing this stuff, but i have never messed with it, so it's just conjecture. :-/


--
The Master in the art of living makes little distinction between his work and his play, his labor and his leisure, his mind and his body, his education and his recreation, his love and his religion. He hardly knows which is which. He simply pursues his vision of excellence in whatever he does, leaving others to decide whether he is working or playing. To him he is always doing both.

  -- Zen Philosophy






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