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
13 #include <lib-lib/lib-lib.h>
16 #ifdef USE_SLANG_CURSES
18 #ifndef unix /* this symbol is not defined by the hp-ux compiler (sigh) */
24 #define KEY_DC SL_KEY_DELETE
25 #define KEY_IC SL_KEY_IC
28 * ncurses and SLang seem to send different characters when the Enter key is
29 * pressed, so define some macros to properly detect the Enter key.
31 #define M_ENTER_C '\r'
32 #define M_ENTER_S "\r"
36 #ifdef HAVE_NCURSESW_NCURSES_H
37 #include <ncursesw/ncurses.h>
39 #ifdef HAVE_NCURSES_NCURSES_H
40 #include <ncurses/ncurses.h>
50 #define M_ENTER_C '\n'
51 #define M_ENTER_S "\n"
53 #endif /* USE_SLANG_CURSES */
55 /* AIX defines ``lines'' in <term.h>, but it's used as a var name in
56 * various places in Mutt
62 #define CLEARLINE_WIN(x) move(x,(option(OPTMBOXPANE)?SidebarWidth:0)), clrtoeol()
63 #define CLEARLINE(x) move(x,0), clrtoeol()
64 #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
65 #define BEEP() do { if (MCore.beep) beep(); } while (0)
67 #if ! (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
71 #if !defined(USE_SLANG_CURSES) && defined(HAVE_BKGDSET)
72 #define BKGDSET(x) bkgdset (ColorDefs[x] | ' ')
77 #if (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
78 void mutt_curs_set (int);
80 #define mutt_curs_set(x)
82 #define PAGELEN (LINES-3)
84 #define ctrl(c) ((c)-'@')
87 #define CI_is_return(c) ((c) == '\r' || (c) == '\n' || (c) == KEY_ENTER)
89 #define CI_is_return(c) ((c) == '\r' || (c) == '\n')
92 event_t mutt_getch (void);
94 void mutt_endwin (const char *);
95 void mutt_flushinp (void);
96 void mutt_refresh (void);
97 void mutt_resize_screen (void);
98 void mutt_ungetch (int, int);
99 void mutt_need_hard_redraw (void);
101 /* ----------------------------------------------------------------------------
106 MT_COLOR_HDEFAULT = 0,
130 typedef struct color_line {
133 pattern_t *color_pattern; /* compiled pattern to speed up index color
138 struct color_line *next;
145 char sizestr[STRING];
148 void mutt_progress_bar (progress_t* progress, long pos);
149 void mutt_clear_error (void);
150 void mutt_edit_file (const char *);
151 void mutt_curses_error (const char *, ...)
152 __attribute__((format(printf, 1, 2)));
153 void mutt_curses_message (const char *, ...)
154 __attribute__((format(printf, 1, 2)));
155 void mutt_format_string (char *, ssize_t, int, int, int, char, const char *,
157 void mutt_format_s (char *, ssize_t, const char *, const char *);
158 void mutt_format_s_tree (char *, ssize_t, const char *, const char *);
159 void mutt_free_color (int fg, int bg);
160 void mutt_paddstr (int, const char *);
161 #define mutt_perror(a) _mutt_perror (a, __FILE__, __LINE__)
162 void _mutt_perror (const char*, const char*,int);
163 void mutt_query_exit (void);
164 void mutt_query_menu (char *, ssize_t);
165 void mutt_show_error (void);
166 ssize_t mutt_pretty_size(char *s, ssize_t len, ssize_t n);
168 int mutt_addwch (wchar_t);
169 int mutt_alloc_color (int fg, int bg);
170 int mutt_any_key_to_continue (const char *);
171 int mutt_complete (char *, ssize_t);
172 #define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
173 int _mutt_enter_fname (const char *, char *, ssize_t, int *, int, int,
176 #define mutt_get_field(A,B,C,D) _mutt_get_field(A,B,C,D,0,NULL,NULL)
177 int _mutt_get_field (const char *, char *, ssize_t, int, int, char ***, int *);
178 int mutt_get_field_unbuffered (char *, char *, ssize_t, int);
179 int mutt_index_menu (void);
180 int mutt_is_mail_list (address_t *);
181 int mutt_is_subscribed_list (address_t *);
182 int mutt_multi_choice (char *prompt, char *letters);
183 int mutt_parse_color (BUFFER *, BUFFER *, unsigned long, BUFFER *);
184 int mutt_parse_uncolor (BUFFER *, BUFFER *, unsigned long, BUFFER *);
185 int mutt_parse_mono (BUFFER *, BUFFER *, unsigned long, BUFFER *);
186 int mutt_parse_unmono (BUFFER *, BUFFER *, unsigned long, BUFFER *);
187 int mutt_query_complete (char *, ssize_t);
188 int mutt_user_is_recipient (HEADER *);
189 int mutt_yesorno (const char *, int);
190 void mutt_set_header_color (CONTEXT *, HEADER *);
192 extern int *ColorQuote;
193 extern int ColorQuoteUsed;
194 extern int ColorDefs[];
195 extern COLOR_LINE *ColorHdrList;
196 extern COLOR_LINE *ColorBodyList;
197 extern COLOR_LINE *ColorIndexList;
199 void ci_init_color (void);
200 void ci_start_color (void);
202 #define mutt_make_string(A,B,C,D,E) _mutt_make_string(A,B,C,D,E,0)
203 void _mutt_make_string (char *, ssize_t, const char *, CONTEXT *,
204 HEADER *, format_flag);
207 #define SETCOLOR(X) attrset(ColorDefs[X])
208 #define ADDCOLOR(X) attron(ColorDefs[X])
210 #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; }
212 #define SW (option(OPTMBOXPANE)?SidebarWidth:0)
214 #endif /* !_MUTT_CURSES_H */