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);
40 #define waddwch(win, w) waddnwstr(win, &(w), 1)
42 void curses_initialize(void);
43 void curses_install(void);
45 void mutt_flushinp (void);
46 void mutt_ungetch (int, int);
48 /* ----------------------------------------------------------------------------
53 MT_COLOR_HDEFAULT = 0,
77 /* flags for mutt_get_field() */
78 #define M_ALIAS (1<<0) /* do alias "completion" by calling up the alias-menu */
79 #define M_FILE (1<<1) /* do file completion */
80 #define M_EFILE (1<<2) /* do file completion, plus incoming folders */
81 #define M_CMD (1<<3) /* do completion on previous word */
82 #define M_PASS (1<<4) /* password mode (no echo) */
83 #define M_CLEAR (1<<5) /* clear input if printable character is pressed */
84 #define M_COMMAND (1<<6) /* do command completion */
85 #define M_PATTERN (1<<7) /* pattern mode - only used for history classes */
86 #define M_LASTFOLDER (1<<8) /* last-folder mode - hack hack hack */
88 typedef struct color_line {
91 pattern_t *color_pattern; /* compiled pattern to speed up index color
96 struct color_line *next;
103 char sizestr[STRING];
106 void mutt_progress_bar (progress_t* progress, long pos);
107 void mutt_clear_error (void);
108 void mutt_edit_file (const char *);
109 void mutt_curses_error (const char *, ...)
110 __attribute__((format(printf, 1, 2)));
111 void mutt_curses_message (const char *, ...)
112 __attribute__((format(printf, 1, 2)));
113 void mutt_format_string (char *, ssize_t, int, int, int, char, const char *,
115 void mutt_format_s (char *, ssize_t, const char *, const char *);
116 void mutt_format_s_tree (char *, ssize_t, const char *, const char *);
117 void mutt_free_color (int fg, int bg);
118 void mutt_paddstr(WINDOW *, int, const char *);
119 #define mutt_perror(s) \
120 mutt_error("%s: %m (errno = %d) from %s:%i", s, errno, __FILE__, __LINE__)
121 void mutt_query_exit (void);
122 void mutt_query_menu (char *, ssize_t);
123 void mutt_show_error (void);
124 ssize_t mutt_pretty_size(char *s, ssize_t len, ssize_t n);
126 int mutt_any_key_to_continue (const char *);
127 int mutt_complete (char *, ssize_t);
128 #define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
129 int _mutt_enter_fname (const char *, char *, ssize_t, int *, int, int,
132 #define mutt_get_field(A,B,C,D) _mutt_get_field(A,B,C,D,0,NULL,NULL)
133 int _mutt_get_field (const char *, char *, ssize_t, int, int, char ***, int *);
134 int mutt_get_field_unbuffered (char *, char *, ssize_t, int);
135 int mutt_index_menu (void);
136 int mutt_is_mail_list (address_t *);
137 int mutt_is_subscribed_list (address_t *);
138 int mutt_multi_choice (const char *prompt, const char *letters);
139 int mutt_parse_color (BUFFER *, BUFFER *, unsigned long, BUFFER *);
140 int mutt_parse_uncolor (BUFFER *, BUFFER *, unsigned long, BUFFER *);
141 int mutt_query_complete (char *, ssize_t);
142 int mutt_user_is_recipient (HEADER *);
143 int mutt_yesorno (const char *, int);
144 void mutt_set_header_color (CONTEXT *, HEADER *);
146 extern int *ColorQuote;
147 extern int ColorQuoteUsed;
148 extern int ColorDefs[];
149 extern COLOR_LINE *ColorHdrList;
150 extern COLOR_LINE *ColorBodyList;
151 extern COLOR_LINE *ColorIndexList;
153 void ci_start_color (void);
155 #define mutt_make_string(A,B,C,D,E) _mutt_make_string(A,B,C,D,E,0)
156 void _mutt_make_string (char *, ssize_t, const char *, CONTEXT *,
157 HEADER *, format_flag);
159 #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; }
161 #endif /* !_MUTT_CURSES_H */