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);
149 extern int *ColorQuote;
150 extern int ColorQuoteUsed;
151 extern int ColorDefs[];
152 extern COLOR_LINE *ColorHdrList;
153 extern COLOR_LINE *ColorBodyList;
154 extern COLOR_LINE *ColorIndexList;
156 void ci_init_color (void);
157 void ci_start_color (void);
159 #define SETCOLOR(X) attrset(ColorDefs[X])
160 #define ADDCOLOR(X) attron(ColorDefs[X])
162 #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; }
164 #endif /* !_MUTT_CURSES_H */