mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-18 16:49:18 +03:00
Start keypress handling.
This commit is contained in:
parent
6599f415f7
commit
df1667bd58
@ -1195,6 +1195,54 @@ static void treeview_commit_selection_drag(struct treeview *tree)
|
||||
treeview_node_selection_walk_cb, &sw);
|
||||
}
|
||||
|
||||
|
||||
/* Exported interface, documented in treeview.h */
|
||||
bool treeview_keypress(struct treeview *tree, uint32_t key)
|
||||
{
|
||||
struct rect r; /**< Redraw rectangle */
|
||||
bool redraw = false;
|
||||
|
||||
assert(tree != NULL);
|
||||
|
||||
switch (key) {
|
||||
case KEY_SELECT_ALL:
|
||||
redraw = treeview_select_all(tree, &r);
|
||||
break;
|
||||
case KEY_COPY_SELECTION:
|
||||
/* TODO: Copy selection as text */
|
||||
break;
|
||||
case KEY_DELETE_LEFT:
|
||||
case KEY_DELETE_RIGHT:
|
||||
/* TODO: Delete selection */
|
||||
break;
|
||||
case KEY_CR:
|
||||
case KEY_NL:
|
||||
/* TODO: Launch selection */
|
||||
break;
|
||||
case KEY_ESCAPE:
|
||||
case KEY_CLEAR_SELECTION:
|
||||
redraw = treeview_clear_selection(tree, &r);
|
||||
break;
|
||||
/* TODO: Trivial keyboard navigation */
|
||||
case KEY_LEFT:
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
break;
|
||||
case KEY_UP:
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
tree->cw_t->redraw_request(tree->cw_h, r);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct treeview_mouse_action {
|
||||
struct treeview *tree;
|
||||
browser_mouse_state mouse;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "desktop/core_window.h"
|
||||
#include "desktop/textinput.h"
|
||||
#include "utils/types.h"
|
||||
|
||||
struct treeview;
|
||||
@ -231,6 +232,15 @@ nserror treeview_node_contract(struct treeview *tree,
|
||||
void treeview_redraw(struct treeview *tree, int x, int y, struct rect *clip,
|
||||
const struct redraw_context *ctx);
|
||||
|
||||
/**
|
||||
* Key press handling for treeviews.
|
||||
*
|
||||
* \param tree The treeview which got the keypress
|
||||
* \param key The ucs4 character codepoint
|
||||
* \return true if the keypress is dealt with, false otherwise.
|
||||
*/
|
||||
bool treeview_keypress(struct treeview *tree, uint32_t key);
|
||||
|
||||
/**
|
||||
* Handles all kinds of mouse action
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user