| 29 |
29 |
| 30 #ifndef INPUT_H |
30 #ifndef INPUT_H |
| 31 #define INPUT_H |
31 #define INPUT_H |
| 32 |
32 |
| 33 #include <stdlib.h> |
33 #include <stdlib.h> |
| 34 #include <stdbool.h> /* necessary to avoid errors with outdated curses.h */ |
|
| 35 #include <curses.h> |
|
| 36 |
34 |
| 37 #ifdef __cplusplus |
35 #ifdef __cplusplus |
| 38 extern "C" { |
36 extern "C" { |
| 39 #endif |
37 #endif |
| 40 |
38 |
| 41 int prompt_yesno(char *msg); |
39 int prompt_yesno(char *msg); |
| 42 |
|
| 43 |
|
| 44 /** |
|
| 45 * Asynchronous variant of mvwgetnstr(). |
|
| 46 * |
|
| 47 * Needs halfdelay mode enabled! |
|
| 48 * |
|
| 49 * @param w the window |
|
| 50 * @param y the window y position |
|
| 51 * @param x the window x position |
|
| 52 * @param str the buffer for the read string |
|
| 53 * @param pos a pointer to the object containing the current buffer position |
|
| 54 * @param len the length of the buffer |
|
| 55 * @return 0 if reading is in progress and 1 when a complete line is read |
|
| 56 */ |
|
| 57 int mvwasyncgetnstr(WINDOW* w,int y,int x,char *str,size_t *pos,size_t len); |
|
| 58 |
|
| 59 /** |
|
| 60 * Asynchronous variant of mvgetnstr(). |
|
| 61 * |
|
| 62 * Needs halfdelay mode enabled! |
|
| 63 * |
|
| 64 * @param y the window y position |
|
| 65 * @param x the window x position |
|
| 66 * @param str the buffer for the read string |
|
| 67 * @param pos a pointer to the object containing the current buffer position |
|
| 68 * @param len the length of the buffer |
|
| 69 * @return 0 if reading is in progress and 1 when a complete line is read |
|
| 70 */ |
|
| 71 #define mvasyncgetnstr(y,x,str,pos,len) mvwasyncgetnstr(stdscr,y,x,str,pos,len) |
|
| 72 |
40 |
| 73 /** |
41 /** |
| 74 * Asynchronous variant of getnstr(). |
42 * Asynchronous variant of getnstr(). |
| 75 * |
43 * |
| 76 * Needs halfdelay mode enabled! |
44 * Needs halfdelay mode enabled! |
| 78 * @param str the buffer for the read string |
46 * @param str the buffer for the read string |
| 79 * @param pos a pointer to the object containing the current buffer position |
47 * @param pos a pointer to the object containing the current buffer position |
| 80 * @param len the length of the buffer |
48 * @param len the length of the buffer |
| 81 * @return 0 if reading is in progress and 1 when a complete line is read |
49 * @return 0 if reading is in progress and 1 when a complete line is read |
| 82 */ |
50 */ |
| 83 #define asyncgetnstr(str,pos,len) mvwasyncgetnstr(stdscr, getcury(stdscr), \ |
51 int asyncgetnstr(char *str, size_t *pos, size_t len); |
| 84 getcurx(stdscr), str, pos, len) |
|
| 85 |
52 |
| 86 |
53 |
| 87 #ifdef __cplusplus |
54 #ifdef __cplusplus |
| 88 } |
55 } |
| 89 #endif |
56 #endif |