NeoMutt  2019-12-07-60-g0cfa53
Teaching an old dog new tricks
DOXYGEN
mutt_curses.c File Reference

Define wrapper functions around Curses/Slang. More...

#include "config.h"
#include "mutt_curses.h"
#include "color.h"
#include "globals.h"
+ Include dependency graph for mutt_curses.c:

Go to the source code of this file.

Functions

void mutt_curses_set_attr (int attr)
 Set the attributes for text. More...
 
void mutt_curses_set_color (enum ColorId color)
 Set the current colour for text. More...
 
void mutt_curses_set_cursor (enum MuttCursorState state)
 Set the cursor state. More...
 

Detailed Description

Define wrapper functions around Curses/Slang.

Authors
  • Michael R. Elkins
  • g10 Code GmbH
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file mutt_curses.c.

Function Documentation

◆ mutt_curses_set_attr()

void mutt_curses_set_attr ( int  attr)

Set the attributes for text.

Parameters
attrAttributes to set, e.g. A_UNDERLINE

Definition at line 40 of file mutt_curses.c.

41 {
42 #ifdef HAVE_BKGDSET
43  bkgdset(attr | ' ');
44 #endif
45 }
+ Here is the caller graph for this function:

◆ mutt_curses_set_color()

void mutt_curses_set_color ( enum ColorId  color)

Set the current colour for text.

Parameters
colorColour to set, e.g. MT_COLOR_HEADER

If the system has bkgdset() use it rather than attrset() so that the clr*() functions will properly set the background attributes all the way to the right column.

Definition at line 55 of file mutt_curses.c.

56 {
57  if (!Colors)
58  return;
59 #ifdef HAVE_BKGDSET
60  if (Colors->defs[color] != 0)
61  bkgdset(Colors->defs[color] | ' ');
62  else
63  bkgdset(Colors->defs[MT_COLOR_NORMAL] | ' ');
64 #else
65  if (Colors->defs[color] != 0)
66  attrset(Colors->defs[color]);
67  else
68  attrset(Colors->defs[MT_COLOR_NORMAL]);
69 #endif
70 }
int * defs
Array of all fixed colours, see enum ColorId.
Definition: color.h:132
Plain text.
Definition: color.h:78
Definition: color.h:130
+ Here is the caller graph for this function:

◆ mutt_curses_set_cursor()

void mutt_curses_set_cursor ( enum MuttCursorState  state)

Set the cursor state.

Parameters
stateState to set, e.g. MUTT_CURSOR_INVISIBLE

Definition at line 76 of file mutt_curses.c.

77 {
78 #if (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET))
79  static int SavedCursor = MUTT_CURSOR_VISIBLE;
80 
81  if (state == MUTT_CURSOR_RESTORE_LAST)
82  state = SavedCursor;
83  else
84  SavedCursor = state;
85 
86  if (curs_set(state) == ERR)
87  {
88  if (state == MUTT_CURSOR_VISIBLE)
89  curs_set(MUTT_CURSOR_VERY_VISIBLE);
90  }
91 #endif
92 }
Display a very visible cursor.
Definition: mutt_curses.h:83
Display a normal cursor.
Definition: mutt_curses.h:82
Restore the previous cursor state.
Definition: mutt_curses.h:80
+ Here is the caller graph for this function: