1 /* ncmpc (Ncurses MPD Client)
2 * (c) 2004-2017 The Music Player Daemon Project
3 * Project homepage: http://musicpd.org
4 *
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.
9 *
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.
14 *
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"
24 #include "ncmpc_curses.h"
26 #include <glib.h>
28 #ifndef NCMPC_MINI
30 /* completion callback data */
31 extern void *wrln_completion_callback_data;
33 /* called after TAB is pressed but before g_completion_complete */
34 typedef void (*wrln_gcmp_pre_cb_t) (GCompletion *gcmp, gchar *buf, void *data);
35 extern wrln_gcmp_pre_cb_t wrln_pre_completion_callback;
37 /* post completion callback */
38 typedef void (*wrln_gcmp_post_cb_t) (GCompletion *gcmp, gchar *s, GList *l,
39 void *data);
40 extern wrln_gcmp_post_cb_t wrln_post_completion_callback;
42 #endif
44 /* Note, wreadln calls curs_set() and noecho(), to enable cursor and
45 * disable echo. wreadln will not restore these settings when exiting! */
46 gchar *wreadln(WINDOW *w, /* the curses window to use */
47 const gchar *prompt, /* the prompt string or NULL */
48 const gchar *initial_value, /* initial value or NULL for a empty line
49 * (char *) -1 = get value from history */
50 unsigned x1, /* the maximum x position or 0 */
51 GList **history, /* a pointer to a history list or NULL */
52 GCompletion *gcmp /* a GCompletion structure or NULL */
53 );
55 gchar *
56 wreadln_masked(WINDOW *w,
57 const gchar *prompt,
58 const gchar *initial_value,
59 unsigned x1,
60 GList **history,
61 GCompletion *gcmp);
63 #endif