src/input.h

Wed, 16 Apr 2014 22:20:59 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 16 Apr 2014 22:20:59 +0200
changeset 43
12141136a0da
parent 37
bcf624518909
child 55
54ea19938d57
permissions
-rw-r--r--

changed netcode numbers

/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 2014 Mike Becker. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   1. Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *
 *   2. Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 */

#ifndef INPUT_H
#define	INPUT_H

#include <stdlib.h>
#include <ncurses.h>

#ifdef	__cplusplus
extern "C" {
#endif

int prompt_yesno(char *msg);


/**
 * Asynchronous variant of mvwgetnstr().
 * 
 * Needs halfdelay mode enabled!
 * 
 * @param w the window
 * @param y the window y position
 * @param x the window x position
 * @param str the buffer for the read string
 * @param pos a pointer to the object containing the current buffer position
 * @param len the length of the buffer
 * @return 0 if reading is in progress and 1 when a complete line is read
 */
int mvwasyncgetnstr(WINDOW* w,int y,int x,char *str,size_t *pos,size_t len);

/**
 * Asynchronous variant of mvgetnstr().
 * 
 * Needs halfdelay mode enabled!
 * 
 * @param y the window y position
 * @param x the window x position
 * @param str the buffer for the read string
 * @param pos a pointer to the object containing the current buffer position
 * @param len the length of the buffer
 * @return 0 if reading is in progress and 1 when a complete line is read
 */
#define mvasyncgetnstr(y,x,str,pos,len) mvwasyncgetnstr(stdscr,y,x,str,pos,len)

/**
 * Asynchronous variant of getnstr().
 * 
 * Needs halfdelay mode enabled!
 * 
 * @param str the buffer for the read string
 * @param pos a pointer to the object containing the current buffer position
 * @param len the length of the buffer
 * @return 0 if reading is in progress and 1 when a complete line is read
 */
#define asyncgetnstr(str,pos,len) mvwasyncgetnstr(stdscr, getcury(stdscr), \
    getcurx(stdscr), str, pos, len)


#ifdef	__cplusplus
}
#endif

#endif	/* INPUT_H */

mercurial