3 * Define wrapper functions around Curses/Slang
6 * Copyright (C) 1996-2000,2012 Michael R. Elkins <me@mutt.org>
7 * Copyright (C) 2004 g10 Code GmbH
8 * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
11 * This program is free software: you can redistribute it and/or modify it under
12 * the terms of the GNU General Public License as published by the Free Software
13 * Foundation, either version 2 of the License, or (at your option) any later
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 * You should have received a copy of the GNU General Public License along with
22 * this program. If not, see <http://www.gnu.org/licenses/>.
26 #include "mutt_curses.h"
30 * mutt_curses_set_attr - Set the attributes for text
31 * @param attr Attributes to set, e.g. A_UNDERLINE
33 void mutt_curses_set_attr(int attr)
41 * mutt_curses_set_color - Set the current colour for text
42 * @param color Colour to set, e.g. #MT_COLOR_HEADER
44 * If the system has bkgdset() use it rather than attrset() so that the clr*()
45 * functions will properly set the background attributes all the way to the
48 void mutt_curses_set_color(enum ColorId color)
51 if (ColorDefs[color] != 0)
52 bkgdset(ColorDefs[color] | ' ');
54 bkgdset(ColorDefs[MT_COLOR_NORMAL] | ' ');
56 if (ColorDefs[color] != 0)
57 attrset(ColorDefs[color]);
59 attrset(ColorDefs[MT_COLOR_NORMAL]);
64 * mutt_curses_set_cursor - Set the cursor state
65 * @param state State to set, e.g. #MUTT_CURSOR_INVISIBLE
67 void mutt_curses_set_cursor(enum MuttCursorState state)
69 #if (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
70 static int SavedCursor = MUTT_CURSOR_VISIBLE;
72 if (state == MUTT_CURSOR_RESTORE_LAST)
77 if (curs_set(state) == ERR)
79 if (state == MUTT_CURSOR_VISIBLE)
80 curs_set(MUTT_CURSOR_VERY_VISIBLE);