32d243dc498394662cbd98963510c0544e5a87c5
1 /* ncmpc (Ncurses MPD Client)
2 * (c) 2004-2009 The Music Player Daemon Project
3 * Project homepage: http://musicpd.org
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program 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.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
20 #ifndef WREADLN_H
21 #define WREADLN_H
23 #include "config.h"
25 #include <glib.h>
27 #ifdef HAVE_NCURSESW_NCURSES_H
28 #include <ncursesw/ncurses.h>
29 #else
30 #include <ncurses.h>
31 #endif
33 #ifndef NCMPC_MINI
35 /* completion callback data */
36 extern void *wrln_completion_callback_data;
38 /* called after TAB is pressed but before g_completion_complete */
39 typedef void (*wrln_gcmp_pre_cb_t) (GCompletion *gcmp, gchar *buf, void *data);
40 extern wrln_gcmp_pre_cb_t wrln_pre_completion_callback;
42 /* post completion callback */
43 typedef void (*wrln_gcmp_post_cb_t) (GCompletion *gcmp, gchar *s, GList *l,
44 void *data);
45 extern wrln_gcmp_post_cb_t wrln_post_completion_callback;
47 #endif
49 /* Note, wreadln calls curs_set() and noecho(), to enable cursor and
50 * disable echo. wreadln will not restore these settings when exiting! */
51 gchar *wreadln(WINDOW *w, /* the curses window to use */
52 const gchar *prompt, /* the prompt string or NULL */
53 const gchar *initial_value, /* initial value or NULL for a empty line
54 * (char *) -1 = get value from history */
55 unsigned x1, /* the maximum x position or 0 */
56 GList **history, /* a pointer to a history list or NULL */
57 GCompletion *gcmp /* a GCompletion structure or NULL */
58 );
60 gchar *
61 wreadln_masked(WINDOW *w,
62 const gchar *prompt,
63 const gchar *initial_value,
64 unsigned x1,
65 GList **history,
66 GCompletion *gcmp);
68 #endif