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 #ifdef USE_SLANG_CURSES
17 #ifndef unix /* this symbol is not defined by the hp-ux compiler (sigh) */
23 #define KEY_DC SL_KEY_DELETE
24 #define KEY_IC SL_KEY_IC
27 * ncurses and SLang seem to send different characters when the Enter key is
28 * pressed, so define some macros to properly detect the Enter key.
30 #define M_ENTER_C '\r'
31 #define M_ENTER_S "\r"
35 #ifdef HAVE_NCURSESW_NCURSES_H
36 #include <ncursesw/ncurses.h>
38 #ifdef HAVE_NCURSES_NCURSES_H
39 #include <ncurses/ncurses.h>
49 #define M_ENTER_C '\n'
50 #define M_ENTER_S "\n"
52 #endif /* USE_SLANG_CURSES */
54 /* AIX defines ``lines'' in <term.h>, but it's used as a var name in
55 * various places in Mutt
61 #define CLEARLINE_WIN(x) move(x,(option(OPTMBOXPANE)?SidebarWidth:0)), clrtoeol()
62 #define CLEARLINE(x) move(x,0), clrtoeol()
63 #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
64 #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
66 #if ! (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
70 #if !defined(USE_SLANG_CURSES) && defined(HAVE_BKGDSET)
71 #define BKGDSET(x) bkgdset (ColorDefs[x] | ' ')
76 #if (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
77 void mutt_curs_set (int);
79 #define mutt_curs_set(x)
81 #define PAGELEN (LINES-3)
83 #define ctrl(c) ((c)-'@')
86 #define CI_is_return(c) ((c) == '\r' || (c) == '\n' || (c) == KEY_ENTER)
88 #define CI_is_return(c) ((c) == '\r' || (c) == '\n')
91 event_t mutt_getch (void);
93 void mutt_endwin (const char *);
94 void mutt_flushinp (void);
95 void mutt_refresh (void);
96 void mutt_resize_screen (void);
97 void mutt_ungetch (int, int);
98 void mutt_need_hard_redraw (void);
100 /* ----------------------------------------------------------------------------
105 MT_COLOR_HDEFAULT = 0,
129 typedef struct color_line {
132 pattern_t *color_pattern; /* compiled pattern to speed up index color
137 struct color_line *next;
144 char sizestr[SHORT_STRING];
147 void mutt_progress_bar (progress_t* progress, long pos);
148 void mutt_clear_error (void);
149 void mutt_edit_file (const char *, const char *);
150 void mutt_curses_error (const char *, ...);
151 void mutt_curses_message (const char *, ...);
152 void mutt_format_string (char *, ssize_t, int, int, int, char, const char *,
154 void mutt_format_s (char *, ssize_t, const char *, const char *);
155 void mutt_format_s_tree (char *, ssize_t, const char *, const char *);
156 void mutt_free_color (int fg, int bg);
157 void mutt_paddstr (int, const char *);
158 #define mutt_perror(a) _mutt_perror (a, __FILE__, __LINE__)
159 void _mutt_perror (const char*, const char*,int);
160 void mutt_query_exit (void);
161 void mutt_query_menu (char *, ssize_t);
162 void mutt_show_error (void);
164 int mutt_addwch (wchar_t);
165 int mutt_alloc_color (int fg, int bg);
166 int mutt_any_key_to_continue (const char *);
167 int mutt_complete (char *, ssize_t);
168 #define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
169 int _mutt_enter_fname (const char *, char *, ssize_t, int *, int, int,
172 #define mutt_get_field(A,B,C,D) _mutt_get_field(A,B,C,D,0,NULL,NULL)
173 int _mutt_get_field (const char *, char *, ssize_t, int, int, char ***, int *);
174 int mutt_get_field_unbuffered (char *, char *, ssize_t, int);
175 int mutt_index_menu (void);
176 int mutt_is_mail_list (address_t *);
177 int mutt_is_subscribed_list (address_t *);
178 int mutt_multi_choice (char *prompt, char *letters);
179 int mutt_parse_color (BUFFER *, BUFFER *, unsigned long, BUFFER *);
180 int mutt_parse_uncolor (BUFFER *, BUFFER *, unsigned long, BUFFER *);
181 int mutt_parse_mono (BUFFER *, BUFFER *, unsigned long, BUFFER *);
182 int mutt_parse_unmono (BUFFER *, BUFFER *, unsigned long, BUFFER *);
183 int mutt_query_complete (char *, ssize_t);
184 int mutt_strwidth (const char *);
185 int mutt_user_is_recipient (HEADER *);
186 int mutt_yesorno (const char *, int);
187 void mutt_set_header_color (CONTEXT *, HEADER *);
189 extern int *ColorQuote;
190 extern int ColorQuoteUsed;
191 extern int ColorDefs[];
192 extern COLOR_LINE *ColorHdrList;
193 extern COLOR_LINE *ColorBodyList;
194 extern COLOR_LINE *ColorIndexList;
196 void ci_init_color (void);
197 void ci_start_color (void);
199 #define mutt_make_string(A,B,C,D,E) _mutt_make_string(A,B,C,D,E,0)
200 void _mutt_make_string (char *, ssize_t, const char *, CONTEXT *,
201 HEADER *, format_flag);
204 #define SETCOLOR(X) attrset(ColorDefs[X])
205 #define ADDCOLOR(X) attron(ColorDefs[X])
207 #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; }
209 #endif /* !_MUTT_CURSES_H */