diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-11-11 13:09:12 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2011-11-11 13:09:12 +0000 |
commit | dd267bd90a9d4ddd6f6247fc4eceaf7ed80839d0 (patch) | |
tree | c88b1b50fd5359fe0632815fd6f86ca00a16b9ff /desktop | |
parent | 36599a09cead791900935aeadcea49d46ff6a786 (diff) | |
download | netsurf-dd267bd90a9d4ddd6f6247fc4eceaf7ed80839d0.tar.gz netsurf-dd267bd90a9d4ddd6f6247fc4eceaf7ed80839d0.tar.bz2 |
Trap RMB and select the node under the pointer if no other node selected
svn path=/trunk/netsurf/; revision=13146
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/tree.c | 23 | ||||
-rw-r--r-- | desktop/tree.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/desktop/tree.c b/desktop/tree.c index 2ddedf620..097408e87 100644 --- a/desktop/tree.c +++ b/desktop/tree.c @@ -2314,6 +2314,29 @@ void tree_launch_selected(struct tree *tree, bool tabs) /** + * Updates the node at position x,y to a selected state. + * The required areas of the tree are redrawn. + * + * \param tree the tree to update nodes for, may be NULL + * \param x x position in tree + * \param y y position in tree + * \param selected the selection state to set + */ +void tree_set_node_selected_at(struct tree *tree, int x, int y, bool selected) +{ + bool expansion_toggle; + struct node *node; + + node = tree_get_node_at(tree->root, x, y, &expansion_toggle); + + if ((node == NULL) || (expansion_toggle == true)) + return; + + tree_set_node_selected(tree, node, false, selected); +} + + +/** * Handles a mouse action for a tree * * \param tree the tree to handle a click for diff --git a/desktop/tree.h b/desktop/tree.h index ed71f911e..1f3ee0c74 100644 --- a/desktop/tree.h +++ b/desktop/tree.h @@ -157,6 +157,7 @@ void tree_set_node_expanded(struct tree *tree, struct node *node, bool expanded, bool folder, bool leaf); void tree_set_node_selected(struct tree *tree, struct node *node, bool all, bool selected); +void tree_set_node_selected_at(struct tree *tree, int x, int y, bool selected); void tree_set_node_sort_function(struct tree *tree, struct node *node, int (*sort) (struct node *, struct node *)); void tree_set_node_user_callback(struct node *node, |