dlg_keys.h (241818) | dlg_keys.h (244850) |
---|---|
1/* | 1/* |
2 * $Id: dlg_keys.h,v 1.31 2012/07/02 23:57:52 tom Exp $ | 2 * $Id: dlg_keys.h,v 1.26 2011/06/21 22:09:22 tom Exp $ |
3 * 4 * dlg_keys.h -- runtime binding support for dialog 5 * | 3 * 4 * dlg_keys.h -- runtime binding support for dialog 5 * |
6 * Copyright 2005-2011,2012 Thomas E. Dickey | 6 * Copyright 2005-2010,2011 Thomas E. Dickey |
7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU Lesser General Public License, version 2.1 10 * as published by the Free Software Foundation. 11 * 12 * This program is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this program; if not, write to 19 * Free Software Foundation, Inc. 20 * 51 Franklin St., Fifth Floor 21 * Boston, MA 02110, USA. 22 */ 23 24#ifndef DLG_KEYS_H_included 25#define DLG_KEYS_H_included 1 | 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU Lesser General Public License, version 2.1 10 * as published by the Free Software Foundation. 11 * 12 * This program is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this program; if not, write to 19 * Free Software Foundation, Inc. 20 * 51 Franklin St., Fifth Floor 21 * Boston, MA 02110, USA. 22 */ 23 24#ifndef DLG_KEYS_H_included 25#define DLG_KEYS_H_included 1 |
26/* *INDENT-OFF* */ | |
27 28#include <dialog.h> 29 30#ifdef USE_WIDE_CURSES 31#include <wctype.h> 32#define dlg_toupper(ch) towupper((wint_t)ch) 33#define dlg_isupper(ch) iswupper((wint_t)ch) 34#else | 26 27#include <dialog.h> 28 29#ifdef USE_WIDE_CURSES 30#include <wctype.h> 31#define dlg_toupper(ch) towupper((wint_t)ch) 32#define dlg_isupper(ch) iswupper((wint_t)ch) 33#else |
35#define dlg_toupper(ch) (((ch) > 0 && (ch) <= 255) ? toupper(ch) : (ch)) | 34#define dlg_toupper(ch) toupper(ch) |
36#define dlg_isupper(ch) (isalpha(ch) && isupper(ch)) 37#endif 38 39#ifdef __cplusplus 40extern "C" { 41#endif 42 43typedef struct { 44 int is_function_key; 45 int curses_key; 46 int dialog_key; 47} DLG_KEYS_BINDING; 48 | 35#define dlg_isupper(ch) (isalpha(ch) && isupper(ch)) 36#endif 37 38#ifdef __cplusplus 39extern "C" { 40#endif 41 42typedef struct { 43 int is_function_key; 44 int curses_key; 45 int dialog_key; 46} DLG_KEYS_BINDING; 47 |
49#define DLG_KEYS_DATA(dialog, curses) { (curses) >= KEY_MIN, curses, dialog } | 48#define DLG_KEYS_DATA(dialog, curses) { curses >= KEY_MIN, curses, dialog } |
50 51#define END_KEYS_BINDING { -1, 0, 0 } 52 53/* 54 * Define dialog's internal function-keys past the range used by curses. 55 */ 56typedef enum { 57 DLGK_MIN = KEY_MAX + 1, --- 13 unchanged lines hidden (view full) --- 71 DLGK_ITEM_LAST, 72 DLGK_ITEM_NEXT, 73 DLGK_ITEM_PREV, 74 /* moving from field to field (or buttons) */ 75 DLGK_FIELD_FIRST, 76 DLGK_FIELD_LAST, 77 DLGK_FIELD_NEXT, 78 DLGK_FIELD_PREV, | 49 50#define END_KEYS_BINDING { -1, 0, 0 } 51 52/* 53 * Define dialog's internal function-keys past the range used by curses. 54 */ 55typedef enum { 56 DLGK_MIN = KEY_MAX + 1, --- 13 unchanged lines hidden (view full) --- 70 DLGK_ITEM_LAST, 71 DLGK_ITEM_NEXT, 72 DLGK_ITEM_PREV, 73 /* moving from field to field (or buttons) */ 74 DLGK_FIELD_FIRST, 75 DLGK_FIELD_LAST, 76 DLGK_FIELD_NEXT, 77 DLGK_FIELD_PREV, |
79 /* moving from form-field to form-field (or buttons) */ 80 DLGK_FORM_FIRST, 81 DLGK_FORM_LAST, 82 DLGK_FORM_NEXT, 83 DLGK_FORM_PREV, | |
84 /* moving within a grid */ 85 DLGK_GRID_UP, 86 DLGK_GRID_DOWN, 87 DLGK_GRID_LEFT, 88 DLGK_GRID_RIGHT, 89 /* delete */ 90 DLGK_DELETE_LEFT, 91 DLGK_DELETE_RIGHT, --- 45 unchanged lines hidden (view full) --- 137 DLG_KEYS_DATA( DLGK_PAGE_LAST, KEY_END ), \ 138 DLG_KEYS_DATA( DLGK_PAGE_NEXT, 'F' ), \ 139 DLG_KEYS_DATA( DLGK_PAGE_NEXT, 'f' ), \ 140 DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ), \ 141 DLG_KEYS_DATA( DLGK_PAGE_PREV, 'B' ), \ 142 DLG_KEYS_DATA( DLGK_PAGE_PREV, 'b' ), \ 143 DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE ) 144 | 78 /* moving within a grid */ 79 DLGK_GRID_UP, 80 DLGK_GRID_DOWN, 81 DLGK_GRID_LEFT, 82 DLGK_GRID_RIGHT, 83 /* delete */ 84 DLGK_DELETE_LEFT, 85 DLGK_DELETE_RIGHT, --- 45 unchanged lines hidden (view full) --- 131 DLG_KEYS_DATA( DLGK_PAGE_LAST, KEY_END ), \ 132 DLG_KEYS_DATA( DLGK_PAGE_NEXT, 'F' ), \ 133 DLG_KEYS_DATA( DLGK_PAGE_NEXT, 'f' ), \ 134 DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ), \ 135 DLG_KEYS_DATA( DLGK_PAGE_PREV, 'B' ), \ 136 DLG_KEYS_DATA( DLGK_PAGE_PREV, 'b' ), \ 137 DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE ) 138 |
145#define TRAVERSE_BINDINGS \ 146 DLG_KEYS_DATA( DLGK_ENTER, ' ' ), \ 147 DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_DOWN ), \ 148 DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ), \ 149 DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ), \ 150 DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_UP ), \ 151 DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ), \ 152 DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ) 153 | |
154extern int dlg_lookup_key(WINDOW * /*win*/, int /*curses_key*/, int * /*dialog_key*/); 155extern int dlg_result_key(int /*dialog_key*/, int /*fkey*/, int * /*resultp*/); 156extern void dlg_register_buttons(WINDOW * /*win*/, const char * /*name*/, const char ** /*buttons*/); 157extern void dlg_register_window(WINDOW * /*win*/, const char * /*name*/, DLG_KEYS_BINDING * /*binding*/); 158extern void dlg_unregister_window(WINDOW * /*win*/); 159 160#ifdef HAVE_RC_FILE 161extern int dlg_parse_bindkey(char * /*params*/); 162extern void dlg_dump_keys(FILE * /*fp*/); | 139extern int dlg_lookup_key(WINDOW * /*win*/, int /*curses_key*/, int * /*dialog_key*/); 140extern int dlg_result_key(int /*dialog_key*/, int /*fkey*/, int * /*resultp*/); 141extern void dlg_register_buttons(WINDOW * /*win*/, const char * /*name*/, const char ** /*buttons*/); 142extern void dlg_register_window(WINDOW * /*win*/, const char * /*name*/, DLG_KEYS_BINDING * /*binding*/); 143extern void dlg_unregister_window(WINDOW * /*win*/); 144 145#ifdef HAVE_RC_FILE 146extern int dlg_parse_bindkey(char * /*params*/); 147extern void dlg_dump_keys(FILE * /*fp*/); |
163extern void dlg_dump_window_keys(FILE * /*fp*/, WINDOW * /*win*/); | |
164#endif 165 166#ifdef __cplusplus 167} 168#endif | 148#endif 149 150#ifdef __cplusplus 151} 152#endif |
169/* *INDENT-ON* */ | |
170 171#endif /* DLG_KEYS_H_included */ | 153 154#endif /* DLG_KEYS_H_included */ |