1 #ifndef WREADLN_H
2 #define WREADLN_H
4 #include "config.h"
6 #include <glib.h>
8 #ifdef HAVE_NCURSESW_NCURSES_H
9 #include <ncursesw/ncurses.h>
10 #else
11 #include <ncurses.h>
12 #endif
14 #ifndef NCMPC_MINI
16 /* completion callback data */
17 extern void *wrln_completion_callback_data;
19 /* called after TAB is pressed but before g_completion_complete */
20 typedef void (*wrln_gcmp_pre_cb_t) (GCompletion *gcmp, gchar *buf, void *data);
21 extern wrln_gcmp_pre_cb_t wrln_pre_completion_callback;
23 /* post completion callback */
24 typedef void (*wrln_gcmp_post_cb_t) (GCompletion *gcmp, gchar *s, GList *l,
25 void *data);
26 extern wrln_gcmp_post_cb_t wrln_post_completion_callback;
28 #endif
30 /* Note, wreadln calls curs_set() and noecho(), to enable cursor and
31 * disable echo. wreadln will not restore these settings when exiting! */
32 gchar *wreadln(WINDOW *w, /* the curses window to use */
33 const gchar *prompt, /* the prompt string or NULL */
34 const gchar *initial_value, /* initial value or NULL for a empty line
35 * (char *) -1 = get value from history */
36 unsigned x1, /* the maximum x position or 0 */
37 GList **history, /* a pointer to a history list or NULL */
38 GCompletion *gcmp /* a GCompletion structure or NULL */
39 );
41 gchar *
42 wreadln_masked(WINDOW *w,
43 const gchar *prompt,
44 const gchar *initial_value,
45 unsigned x1,
46 GList **history,
47 GCompletion *gcmp);
49 #endif