1 #ifndef WREADLN_H
2 #define WREADLN_H
4 #include <glib.h>
5 #include <ncurses.h>
7 /* max size allocated for a line */
8 extern guint wrln_max_line_size;
10 /* max items stored in the history list */
11 extern guint wrln_max_history_length;
13 /* custom wgetch function */
14 typedef int (*wrln_wgetch_fn_t) (WINDOW *w);
15 extern wrln_wgetch_fn_t wrln_wgetch;
17 /* completion callback data */
18 extern void *wrln_completion_callback_data;
20 /* called after TAB is pressed but before g_completion_complete */
21 typedef void (*wrln_gcmp_pre_cb_t) (GCompletion *gcmp, gchar *buf, void *data);
22 extern wrln_gcmp_pre_cb_t wrln_pre_completion_callback;
24 /* post completion callback */
25 typedef void (*wrln_gcmp_post_cb_t) (GCompletion *gcmp, gchar *s, GList *l,
26 void *data);
27 extern wrln_gcmp_post_cb_t wrln_post_completion_callback;
29 /* Note, wreadln calls curs_set() and noecho(), to enable cursor and
30 * disable echo. wreadln will not restore these settings when exiting! */
31 gchar *wreadln(WINDOW *w, /* the curses window to use */
32 const gchar *prompt, /* the prompt string or NULL */
33 const gchar *initial_value, /* initial value or NULL for a empty line
34 * (char *) -1 = get value from history */
35 gint x1, /* the maximum x position or 0 */
36 GList **history, /* a pointer to a history list or NULL */
37 GCompletion *gcmp /* a GCompletion structure or NULL */
38 );
40 gchar *
41 wreadln_masked(WINDOW *w,
42 const gchar *prompt,
43 const gchar *initial_value,
44 gint x1,
45 GList **history,
46 GCompletion *gcmp);
48 #endif