Slight refactor of drag end handling, for future handling of more types of drag.

This commit is contained in:
Michael Drake 2013-08-16 12:23:37 +01:00
parent 2dc8b64153
commit 5f4c624c5b
1 changed files with 17 additions and 8 deletions

View File

@ -1989,15 +1989,24 @@ void treeview_mouse_action(treeview *tree,
assert(tree != NULL);
assert(tree->root != NULL);
/* Handle selection drag end */
if (mouse == BROWSER_MOUSE_HOVER &&
tree->drag.type == TV_DRAG_SELECTION) {
treeview_commit_selection_drag(tree);
tree->drag.type = TV_DRAG_NONE;
tree->drag.start_node = NULL;
/* Handle drag ends */
if (mouse == BROWSER_MOUSE_HOVER) {
switch (tree->drag.type) {
case TV_DRAG_SELECTION:
treeview_commit_selection_drag(tree);
tree->drag.type = TV_DRAG_NONE;
tree->drag.start_node = NULL;
tree->cw_t->drag_status(tree->cw_h, CORE_WINDOW_DRAG_NONE);
return;
tree->cw_t->drag_status(tree->cw_h,
CORE_WINDOW_DRAG_NONE);
return;
case TV_DRAG_MOVE:
/* TODO */
break;
default:
/* No drag to end */
break;
}
}
if (y > tree->root->height) {