/** * This implementation of <code>dragOver</code> provides a default drag under effect for the * feedback specified in <code>event.feedback</code>. The class description lists the FEEDBACK * constants that are applicable to the class. * * <p>For additional information see <code>DropTargetAdapter.dragOver</code>. * * <p>Subclasses that override this method should call <code>super.dragOver(event)</code> to get * the default drag under effect implementation. * * @param event the information associated with the drag over event * @see DropTargetAdapter * @see DropTargetEvent * @see DND#FEEDBACK_SELECT * @see DND#FEEDBACK_SCROLL */ public void dragOver(DropTargetEvent event) { Table table = (Table) control; long /*int*/ handle = table.handle; int effect = checkEffect(event.feedback); Point coordinates = new Point(event.x, event.y); coordinates = table.toControl(coordinates); long /*int*/[] path = new long /*int*/[1]; OS.gtk_tree_view_get_path_at_pos(handle, coordinates.x, coordinates.y, path, null, null, null); int index = -1; if (path[0] != 0) { long /*int*/ indices = OS.gtk_tree_path_get_indices(path[0]); if (indices != 0) { int[] temp = new int[1]; OS.memmove(temp, indices, 4); index = temp[0]; } } if ((effect & DND.FEEDBACK_SCROLL) == 0) { scrollBeginTime = 0; scrollIndex = -1; } else { if (index != -1 && scrollIndex == index && scrollBeginTime != 0) { if (System.currentTimeMillis() >= scrollBeginTime) { if (coordinates.y < table.getItemHeight()) { OS.gtk_tree_path_prev(path[0]); } else { OS.gtk_tree_path_next(path[0]); } if (path[0] != 0) { OS.gtk_tree_view_scroll_to_cell(handle, path[0], 0, false, 0, 0); OS.gtk_tree_path_free(path[0]); path[0] = 0; OS.gtk_tree_view_get_path_at_pos( handle, coordinates.x, coordinates.y, path, null, null, null); } scrollBeginTime = 0; scrollIndex = -1; } } else { scrollBeginTime = System.currentTimeMillis() + SCROLL_HYSTERESIS; scrollIndex = index; } } if (path[0] != 0) { int position = 0; if ((effect & DND.FEEDBACK_SELECT) != 0) position = OS.GTK_TREE_VIEW_DROP_INTO_OR_BEFORE; // if ((effect & DND.FEEDBACK_INSERT_BEFORE) != 0) position = OS.GTK_TREE_VIEW_DROP_BEFORE; // if ((effect & DND.FEEDBACK_INSERT_AFTER) != 0) position = OS.GTK_TREE_VIEW_DROP_AFTER; if (position != 0) { OS.gtk_tree_view_set_drag_dest_row(handle, path[0], OS.GTK_TREE_VIEW_DROP_INTO_OR_BEFORE); } else { OS.gtk_tree_view_set_drag_dest_row(handle, 0, OS.GTK_TREE_VIEW_DROP_BEFORE); } } else { OS.gtk_tree_view_set_drag_dest_row(handle, 0, OS.GTK_TREE_VIEW_DROP_BEFORE); } if (path[0] != 0) OS.gtk_tree_path_free(path[0]); }