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 #ifdef USE_SLANG_CURSES
15 #ifndef unix /* this symbol is not defined by the hp-ux compiler (sigh) */
21 #define KEY_DC SL_KEY_DELETE
22 #define KEY_IC SL_KEY_IC
25 * ncurses and SLang seem to send different characters when the Enter key is
26 * pressed, so define some macros to properly detect the Enter key.
28 #define M_ENTER_C '\r'
29 #define M_ENTER_S "\r"
33 #ifdef HAVE_NCURSESW_NCURSES_H
34 #include <ncursesw/ncurses.h>
36 #ifdef HAVE_NCURSES_NCURSES_H
37 #include <ncurses/ncurses.h>
47 #define M_ENTER_C '\n'
48 #define M_ENTER_S "\n"
50 #endif /* USE_SLANG_CURSES */
52 /* AIX defines ``lines'' in <term.h>, but it's used as a var name in
53 * various places in Mutt
59 #define CLEARLINE_WIN(x) move(x,(option(OPTMBOXPANE)?SidebarWidth:0)), clrtoeol()
60 #define CLEARLINE(x) move(x,0), clrtoeol()
61 #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
62 #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
64 #if ! (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
68 #if !defined(USE_SLANG_CURSES) && defined(HAVE_BKGDSET)
69 #define BKGDSET(x) bkgdset (ColorDefs[x] | ' ')
74 #if (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
75 void mutt_curs_set (int);
77 #define mutt_curs_set(x)
79 #define PAGELEN (LINES-3)
81 #define ctrl(c) ((c)-'@')
84 #define CI_is_return(c) ((c) == '\r' || (c) == '\n' || (c) == KEY_ENTER)
86 #define CI_is_return(c) ((c) == '\r' || (c) == '\n')
89 event_t mutt_getch (void);
91 void mutt_endwin (const char *);
92 void mutt_flushinp (void);
93 void mutt_refresh (void);
94 void mutt_resize_screen (void);
95 void mutt_ungetch (int, int);
96 void mutt_need_hard_redraw (void);
98 /* ----------------------------------------------------------------------------
103 MT_COLOR_HDEFAULT = 0,
127 typedef struct color_line {
130 pattern_t *color_pattern; /* compiled pattern to speed up index color
135 struct color_line *next;
142 char sizestr[SHORT_STRING];
145 void mutt_progress_bar (progress_t* progress, long pos);
147 extern int *ColorQuote;
148 extern int ColorQuoteUsed;
149 extern int ColorDefs[];
150 extern COLOR_LINE *ColorHdrList;
151 extern COLOR_LINE *ColorBodyList;
152 extern COLOR_LINE *ColorIndexList;
154 void ci_init_color (void);
155 void ci_start_color (void);
157 #define SETCOLOR(X) attrset(ColorDefs[X])
158 #define ADDCOLOR(X) attron(ColorDefs[X])
160 #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; }
162 /* ----------------------------------------------------------------------------
163 * These are here to avoid compiler warnings with -Wall under SunOS 4.1.x
166 #if !defined(STDC_HEADERS) && !defined(NCURSES_VERSION) && !defined(USE_SLANG_CURSES)
167 extern int endwin ();
168 extern int printw ();
170 extern int isendwin ();
171 extern int w32addch ();
172 extern int keypad ();
173 extern int wclrtobot ();
174 extern int mvprintw ();
175 extern int getcurx ();
176 extern int getcury ();
177 extern int noecho ();
178 extern int wdelch ();
179 extern int wrefresh ();
181 extern int wclear ();
182 extern int waddstr ();
183 extern int wclrtoeol ();
186 #endif /* !_MUTT_CURSES_H */