src/input.h

Wed, 09 Apr 2014 09:34:07 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 09 Apr 2014 09:34:07 +0200
changeset 32
8a0b85303ee8
parent 30
a285ee393860
child 35
6c64b7a073af
permissions
-rw-r--r--

improved async input + improved build system + added time values to move struct

universe@3 1 /*
universe@3 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
universe@3 3 *
universe@3 4 * Copyright 2014 Mike Becker. All rights reserved.
universe@3 5 *
universe@3 6 * Redistribution and use in source and binary forms, with or without
universe@3 7 * modification, are permitted provided that the following conditions are met:
universe@3 8 *
universe@3 9 * 1. Redistributions of source code must retain the above copyright
universe@3 10 * notice, this list of conditions and the following disclaimer.
universe@3 11 *
universe@3 12 * 2. Redistributions in binary form must reproduce the above copyright
universe@3 13 * notice, this list of conditions and the following disclaimer in the
universe@3 14 * documentation and/or other materials provided with the distribution.
universe@3 15 *
universe@3 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
universe@3 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
universe@3 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
universe@3 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
universe@3 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
universe@3 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
universe@3 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
universe@3 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
universe@3 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
universe@3 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
universe@3 26 * POSSIBILITY OF SUCH DAMAGE.
universe@3 27 *
universe@3 28 */
universe@3 29
universe@3 30 #ifndef INPUT_H
universe@3 31 #define INPUT_H
universe@3 32
universe@30 33 #include <stdlib.h>
universe@30 34 #include <ncurses.h>
universe@30 35
universe@3 36 #ifdef __cplusplus
universe@3 37 extern "C" {
universe@3 38 #endif
universe@3 39
universe@7 40 #define COL_YB 1
universe@7 41 #define COL_BW 2
universe@7 42 #define COL_WB 3
universe@7 43
universe@7 44 void init_colorpairs();
universe@7 45
universe@7 46 int prompt_yesno(char *msg);
universe@3 47
universe@32 48
universe@32 49 /**
universe@32 50 * Asynchronous variant of mvwgetnstr().
universe@32 51 *
universe@32 52 * Needs halfdelay mode enabled!
universe@32 53 *
universe@32 54 * @param w the window
universe@32 55 * @param y the window y position
universe@32 56 * @param x the window x position
universe@32 57 * @param str the buffer for the read string
universe@32 58 * @param pos a pointer to the object containing the current buffer position
universe@32 59 * @param len the length of the buffer
universe@32 60 * @return 0 if reading is in progress and 1 when a complete line is read
universe@32 61 */
universe@32 62 int mvwasyncgetnstr(WINDOW* w,int y,int x,char *str,size_t *pos,size_t len);
universe@32 63
universe@32 64 /**
universe@32 65 * Asynchronous variant of mvgetnstr().
universe@32 66 *
universe@32 67 * Needs halfdelay mode enabled!
universe@32 68 *
universe@32 69 * @param y the window y position
universe@32 70 * @param x the window x position
universe@32 71 * @param str the buffer for the read string
universe@32 72 * @param pos a pointer to the object containing the current buffer position
universe@32 73 * @param len the length of the buffer
universe@32 74 * @return 0 if reading is in progress and 1 when a complete line is read
universe@32 75 */
universe@32 76 #define mvasyncgetnstr(y,x,str,pos,len) mvwasyncgetnstr(stdscr,y,x,str,pos,len)
universe@32 77
universe@32 78 /**
universe@32 79 * Asynchronous variant of getnstr().
universe@32 80 *
universe@32 81 * Needs halfdelay mode enabled!
universe@32 82 *
universe@32 83 * @param str the buffer for the read string
universe@32 84 * @param pos a pointer to the object containing the current buffer position
universe@32 85 * @param len the length of the buffer
universe@32 86 * @return 0 if reading is in progress and 1 when a complete line is read
universe@32 87 */
universe@32 88 #define asyncgetnstr(str,pos,len) mvwasyncgetnstr(stdscr, stdscr->_cury, \
universe@32 89 stdscr->_curx, str, pos, len)
universe@30 90
universe@3 91
universe@3 92 #ifdef __cplusplus
universe@3 93 }
universe@3 94 #endif
universe@3 95
universe@3 96 #endif /* INPUT_H */
universe@3 97

mercurial