1 /* 2 * Copyright 2016 Vincent Sanders <vince@netsurf-browser.org> 3 * 4 * This file is part of NetSurf, http://www.netsurf-browser.org/ 5 * 6 * NetSurf is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; version 2 of the License. 9 * 10 * NetSurf is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 /** 20 * \file 21 * 22 * Interface to key press operations. 23 */ 24 25 #ifndef _NETSURF_KEYPRESS_H_ 26 #define _NETSURF_KEYPRESS_H_ 27 28 struct browser_window; 29 30 enum input_key { 31 32 NS_KEY_SELECT_ALL = 1, 33 NS_KEY_COPY_SELECTION = 3, 34 35 NS_KEY_DELETE_LEFT = 8, 36 NS_KEY_TAB = 9, 37 38 NS_KEY_NL = 10, 39 NS_KEY_SHIFT_TAB = 11, 40 NS_KEY_CR = 13, 41 42 NS_KEY_DELETE_LINE = 21, 43 NS_KEY_PASTE = 22, 44 NS_KEY_CUT_SELECTION = 24, 45 NS_KEY_CLEAR_SELECTION = 26, 46 47 NS_KEY_ESCAPE = 27, 48 49 /* cursor movement keys */ 50 NS_KEY_LEFT = 28, 51 NS_KEY_RIGHT, 52 NS_KEY_UP, 53 NS_KEY_DOWN, 54 55 NS_KEY_DELETE_RIGHT = 127, 56 57 NS_KEY_LINE_START = 128, 58 NS_KEY_LINE_END, 59 NS_KEY_TEXT_START, 60 NS_KEY_TEXT_END, 61 NS_KEY_WORD_LEFT, 62 NS_KEY_WORD_RIGHT, 63 NS_KEY_PAGE_UP, 64 NS_KEY_PAGE_DOWN, 65 NS_KEY_DELETE_LINE_END, 66 NS_KEY_DELETE_LINE_START, 67 68 NS_KEY_UNDO, 69 NS_KEY_REDO 70 }; 71 72 73 /** 74 * Handle key presses in a browser window. 75 * 76 * \param bw The root browser window 77 * \param key The UCS4 character codepoint 78 * \return true if key handled, false otherwise 79 */ 80 bool browser_window_key_press(struct browser_window *bw, uint32_t key); 81 82 83 #endif 84