mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-03 17:54:33 +03:00
Enable double click to launch from treeview.
This commit is contained in:
parent
8692bb6876
commit
23a0520b40
@ -428,7 +428,6 @@ nserror treeview_delete_node(struct treeview *tree, struct treeview_node *n)
|
||||
{
|
||||
struct treeview_node_msg msg;
|
||||
msg.msg = TREE_MSG_NODE_DELETE;
|
||||
msg.data.node_delete.node = n;
|
||||
|
||||
/* Destroy children first */
|
||||
while (n->children != NULL) {
|
||||
@ -1116,11 +1115,14 @@ static bool treeview_node_mouse_action_cb(struct treeview_node *node, void *ctx)
|
||||
/* Clear any existing selection */
|
||||
redraw |= treeview_clear_selection(ma->tree, &r);
|
||||
|
||||
/* Toggle node expansion */
|
||||
if (node->flags & TREE_NODE_EXPANDED) {
|
||||
err = treeview_node_contract(ma->tree, node);
|
||||
} else {
|
||||
err = treeview_node_expand(ma->tree, node);
|
||||
}
|
||||
|
||||
/* Set up redraw */
|
||||
redraw = true;
|
||||
if (r.y0 > ma->current_y)
|
||||
r.y0 = ma->current_y;
|
||||
@ -1128,11 +1130,15 @@ static bool treeview_node_mouse_action_cb(struct treeview_node *node, void *ctx)
|
||||
|
||||
} else if ((node->type == TREE_NODE_ENTRY) &&
|
||||
(ma->mouse & BROWSER_MOUSE_DOUBLE_CLICK) && click) {
|
||||
struct treeview_node_msg msg;
|
||||
msg.msg = TREE_MSG_NODE_LAUNCH;
|
||||
msg.data.node_launch.mouse = ma->mouse;
|
||||
|
||||
/* Clear any existing selection */
|
||||
redraw |= treeview_clear_selection(ma->tree, &r);
|
||||
|
||||
/* Tell client an entry was launched */
|
||||
/* TODO */
|
||||
tree->callbacks->entry(msg, n->client_data);
|
||||
|
||||
} else if (ma->mouse & BROWSER_MOUSE_PRESS_1 &&
|
||||
!(node->flags & TREE_NODE_SELECTED) &&
|
||||
|
@ -39,19 +39,19 @@ enum treeview_relationship {
|
||||
|
||||
enum treeview_msg {
|
||||
TREE_MSG_NODE_DELETE,
|
||||
TREE_MSG_FIELD_EDIT
|
||||
TREE_MSG_NODE_EDIT,
|
||||
TREE_MSG_NODE_LAUNCH
|
||||
};
|
||||
struct treeview_node_msg {
|
||||
enum treeview_msg msg; /**< The message type */
|
||||
union {
|
||||
struct {
|
||||
struct treeview_node *node;
|
||||
} node_delete;
|
||||
lwc_string *feild; /* The field being edited */
|
||||
const char *text; /* The proposed new value */
|
||||
} node_edit; /* Client may call treeview_update_node_* */
|
||||
struct {
|
||||
struct treeview_node *node;
|
||||
lwc_string *feild;
|
||||
const char *text;
|
||||
} field_edit;
|
||||
browser_mouse_state mouse; /* Button / modifier used */
|
||||
} node_launch;
|
||||
} data; /**< The message data. */
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user