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>
35 #elif HAVE_NCURSES_NCURSES_H
36 #include <ncurses/ncurses.h>
43 #define M_ENTER_C '\n'
44 #define M_ENTER_S "\n"
46 #endif /* USE_SLANG_CURSES */
48 /* AIX defines ``lines'' in <term.h>, but it's used as a var name in
49 * various places in Mutt
55 #define CLEARLINE_WIN(x) move(x,(option(OPTMBOXPANE)?SidebarWidth:0)), clrtoeol()
56 #define CLEARLINE(x) move(x,0), clrtoeol()
57 #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
58 #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
60 #if ! (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
64 #if !defined(USE_SLANG_CURSES) && defined(HAVE_BKGDSET)
65 #define BKGDSET(x) bkgdset (ColorDefs[x] | ' ')
70 #if (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
71 void mutt_curs_set (int);
73 #define mutt_curs_set(x)
75 #define PAGELEN (LINES-3)
77 #define ctrl(c) ((c)-'@')
80 #define CI_is_return(c) ((c) == '\r' || (c) == '\n' || (c) == KEY_ENTER)
82 #define CI_is_return(c) ((c) == '\r' || (c) == '\n')
85 event_t mutt_getch (void);
87 void mutt_endwin (const char *);
88 void mutt_flushinp (void);
89 void mutt_refresh (void);
90 void mutt_resize_screen (void);
91 void mutt_ungetch (int, int);
92 void mutt_need_hard_redraw (void);
94 /* ----------------------------------------------------------------------------
99 MT_COLOR_HDEFAULT = 0,
123 typedef struct color_line {
126 pattern_t *color_pattern; /* compiled pattern to speed up index color
131 struct color_line *next;
138 char sizestr[SHORT_STRING];
141 void mutt_progress_bar (progress_t* progress, long pos);
143 extern int *ColorQuote;
144 extern int ColorQuoteUsed;
145 extern int ColorDefs[];
146 extern COLOR_LINE *ColorHdrList;
147 extern COLOR_LINE *ColorBodyList;
148 extern COLOR_LINE *ColorIndexList;
150 void ci_init_color (void);
151 void ci_start_color (void);
153 #define SETCOLOR(X) attrset(ColorDefs[X])
154 #define ADDCOLOR(X) attron(ColorDefs[X])
156 #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; }
158 /* ----------------------------------------------------------------------------
159 * These are here to avoid compiler warnings with -Wall under SunOS 4.1.x
162 #if !defined(STDC_HEADERS) && !defined(NCURSES_VERSION) && !defined(USE_SLANG_CURSES)
163 extern int endwin ();
164 extern int printw ();
166 extern int isendwin ();
167 extern int w32addch ();
168 extern int keypad ();
169 extern int wclrtobot ();
170 extern int mvprintw ();
171 extern int getcurx ();
172 extern int getcury ();
173 extern int noecho ();
174 extern int wdelch ();
175 extern int wrefresh ();
177 extern int wclear ();
178 extern int waddstr ();
179 extern int wclrtoeol ();
182 #endif /* !_MUTT_CURSES_H */