NeoMutt  2021-10-29-225-gb9986f
Teaching an old dog new tricks
DOXYGEN
mutt_curses.c File Reference

Define wrapper functions around Curses. More...

#include "config.h"
#include "mutt_curses.h"
#include "color/lib.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_by_id (enum ColorId cid)
 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.

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 39 of file mutt_curses.c.

40 {
41  bkgdset(attr | ' ');
42 }
+ Here is the caller graph for this function:

◆ mutt_curses_set_color_by_id()

void mutt_curses_set_color_by_id ( enum ColorId  cid)

Set the current colour for text.

Parameters
cidColour 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 52 of file mutt_curses.c.

53 {
54  const int chosen = simple_color_get(cid);
55  const int normal = simple_color_get(MT_COLOR_NORMAL);
56  bkgdset((chosen ? chosen : normal) | ' ');
57 }
int simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition: simple.c:68
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:53
+ Here is the call graph for this function:
+ 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 63 of file mutt_curses.c.

64 {
65  static int SavedCursor = MUTT_CURSOR_VISIBLE;
66 
67  if (state == MUTT_CURSOR_RESTORE_LAST)
68  state = SavedCursor;
69  else
70  SavedCursor = state;
71 
72  if (curs_set(state) == ERR)
73  {
74  if (state == MUTT_CURSOR_VISIBLE)
75  curs_set(MUTT_CURSOR_VERY_VISIBLE);
76  }
77 }
@ MUTT_CURSOR_RESTORE_LAST
Restore the previous cursor state.
Definition: mutt_curses.h:53
@ MUTT_CURSOR_VISIBLE
Display a normal cursor.
Definition: mutt_curses.h:55
@ MUTT_CURSOR_VERY_VISIBLE
Display a very visible cursor.
Definition: mutt_curses.h:56
+ Here is the caller graph for this function: