2 * Copyright notice from original mutt:
3 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
4 * Copyright (C) 2004 g10 Code GmbH
6 * This file is part of mutt-ng, see http://www.muttng.org/.
7 * It's licensed under the GNU General Public License,
8 * please see the file GPL in the top level source directory.
10 #ifndef _MUTT_CURSES_H
11 #define _MUTT_CURSES_H
15 /* AIX defines ``lines'' in <term.h>, but it's used as a var name in
16 * various places in Mutt
22 #define CLEARLINE(W, x) wmove(W, x,0), wclrtoeol(W)
23 #define BEEP() do { if (mod_core.beep) beep(); } while (0)
25 #define BKGDSET(W, x) wbkgdset(W, ColorDefs[x] | ' ')
26 #define SETCOLOR(W, X) wattrset(W, ColorDefs[X])
27 #define ADDCOLOR(W, X) wattron(W, ColorDefs[X])
29 void mutt_curs_set (int);
31 #define ctrl(c) ((c)-'@')
34 #define CI_is_return(c) ((c) == '\r' || (c) == '\n' || (c) == KEY_ENTER)
36 #define CI_is_return(c) ((c) == '\r' || (c) == '\n')
39 event_t mutt_getch (void);
41 int waddwch(WINDOW *win, wchar_t w);
43 #define waddwch(win, w) waddnwstr(win, &(w), 1)
46 void curses_initialize(void);
47 void curses_install(void);
49 void mutt_flushinp (void);
50 void mutt_ungetch (int, int);
52 /* ----------------------------------------------------------------------------
57 MT_COLOR_HDEFAULT = 0,
81 typedef struct color_line {
84 pattern_t *color_pattern; /* compiled pattern to speed up index color
89 struct color_line *next;
99 void mutt_progress_bar (progress_t* progress, long pos);
100 void mutt_clear_error (void);
101 void mutt_edit_file (const char *);
102 void mutt_curses_error (const char *, ...)
103 __attribute__((format(printf, 1, 2)));
104 void mutt_curses_message (const char *, ...)
105 __attribute__((format(printf, 1, 2)));
106 void mutt_format_string (char *, ssize_t, int, int, int, char, const char *,
108 void mutt_format_s (char *, ssize_t, const char *, const char *);
109 void mutt_format_s_tree (char *, ssize_t, const char *, const char *);
110 void mutt_free_color (int fg, int bg);
111 void mutt_paddstr(WINDOW *, int, const char *);
112 #define mutt_perror(s) \
113 mutt_error("%s: %m (errno = %d) from %s:%i", s, errno, __FILE__, __LINE__)
114 void mutt_query_exit (void);
115 void mutt_query_menu (char *, ssize_t);
116 void mutt_show_error (void);
117 ssize_t mutt_pretty_size(char *s, ssize_t len, ssize_t n);
119 int mutt_any_key_to_continue (const char *);
120 void mutt_what_key (void);
121 int mutt_complete (char *, ssize_t);
122 #define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
123 int _mutt_enter_fname (const char *, char *, ssize_t, int *, int, int,
126 #define mutt_get_field(A,B,C,D) _mutt_get_field(A,B,C,D,0,NULL,NULL)
127 int _mutt_get_field (const char *, char *, ssize_t, int, int, char ***, int *);
128 int mutt_get_field_unbuffered (char *, char *, ssize_t, int);
129 int mutt_index_menu (void);
130 int mutt_is_mail_list (address_t *);
131 int mutt_is_subscribed_list (address_t *);
132 int mutt_multi_choice (const char *prompt, const char *letters);
133 int mutt_parse_color (BUFFER *, BUFFER *, unsigned long, BUFFER *);
134 int mutt_parse_uncolor (BUFFER *, BUFFER *, unsigned long, BUFFER *);
135 int mutt_query_complete (char *, ssize_t);
136 int mutt_user_is_recipient (HEADER *);
137 int mutt_yesorno (const char *, int);
138 void mutt_set_header_color (CONTEXT *, HEADER *);
140 extern int *ColorQuote;
141 extern int ColorQuoteUsed;
142 extern int ColorDefs[];
143 extern COLOR_LINE *ColorHdrList;
144 extern COLOR_LINE *ColorBodyList;
145 extern COLOR_LINE *ColorIndexList;
147 void ci_start_color (void);
149 #define mutt_make_string(A,B,C,D,E) _mutt_make_string(A,B,C,D,E,0)
150 void _mutt_make_string (char *, ssize_t, const char *, CONTEXT *,
151 HEADER *, format_flag);
153 #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; }
155 #endif /* !_MUTT_CURSES_H */