Back to index

tetex-bin  3.0
lib_vid_attr.c
Go to the documentation of this file.
00001 /****************************************************************************
00002  * Copyright (c) 2002 Free Software Foundation, Inc.                        *
00003  *                                                                          *
00004  * Permission is hereby granted, free of charge, to any person obtaining a  *
00005  * copy of this software and associated documentation files (the            *
00006  * "Software"), to deal in the Software without restriction, including      *
00007  * without limitation the rights to use, copy, modify, merge, publish,      *
00008  * distribute, distribute with modifications, sublicense, and/or sell       *
00009  * copies of the Software, and to permit persons to whom the Software is    *
00010  * furnished to do so, subject to the following conditions:                 *
00011  *                                                                          *
00012  * The above copyright notice and this permission notice shall be included  *
00013  * in all copies or substantial portions of the Software.                   *
00014  *                                                                          *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
00016  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
00017  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
00018  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
00019  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
00020  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
00021  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
00022  *                                                                          *
00023  * Except as contained in this notice, the name(s) of the above copyright   *
00024  * holders shall not be used in advertising or otherwise to promote the     *
00025  * sale, use or other dealings in this Software without prior written       *
00026  * authorization.                                                           *
00027  ****************************************************************************/
00028 
00029 /****************************************************************************
00030  *  Author: Thomas E. Dickey 2002                                           *
00031  ****************************************************************************/
00032 
00033 #include <curses.priv.h>
00034 #include <term.h>
00035 
00036 MODULE_ID("$Id: lib_vid_attr.c,v 1.1 2002/05/11 20:55:26 tom Exp $")
00037 
00038 #define set_color(mode, pair) mode &= ~A_COLOR; mode |= COLOR_PAIR(pair)
00039 
00040 NCURSES_EXPORT(int)
00041 vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
00042 {
00043     T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair));
00044     set_color(newmode, pair);
00045     returnCode(vidputs(newmode, outc));
00046 }
00047 
00048 #undef vid_attr
00049 NCURSES_EXPORT(int)
00050 vid_attr(attr_t newmode, short pair, void *opts GCC_UNUSED)
00051 {
00052     T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), pair));
00053     set_color(newmode, pair);
00054     returnCode(vidputs(newmode, _nc_outch));
00055 }
00056 
00057 NCURSES_EXPORT(attr_t)
00058 term_attrs(void)
00059 {
00060     attr_t attrs = WA_NORMAL;
00061 
00062     T((T_CALLED("term_attrs()")));
00063     if (enter_alt_charset_mode)
00064        attrs |= WA_ALTCHARSET;
00065 
00066     if (enter_blink_mode)
00067        attrs |= WA_BLINK;
00068 
00069     if (enter_bold_mode)
00070        attrs |= WA_BOLD;
00071 
00072     if (enter_dim_mode)
00073        attrs |= WA_DIM;
00074 
00075     if (enter_reverse_mode)
00076        attrs |= WA_REVERSE;
00077 
00078     if (enter_standout_mode)
00079        attrs |= WA_STANDOUT;
00080 
00081     if (enter_protected_mode)
00082        attrs |= WA_PROTECT;
00083 
00084     if (enter_secure_mode)
00085        attrs |= WA_INVIS;
00086 
00087     if (enter_underline_mode)
00088        attrs |= WA_UNDERLINE;
00089 
00090     if (SP->_coloron)
00091        attrs |= A_COLOR;
00092 
00093     returnAttr(attrs);
00094 }