xref: /freebsd/contrib/ncurses/ncurses/base/lib_slkatron.c (revision 06bfebdedb0d353f1771adb65731f64461d9bd01)
10e3d5408SPeter Wemm /****************************************************************************
2*06bfebdeSXin LI  * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
30e3d5408SPeter Wemm  *                                                                          *
40e3d5408SPeter Wemm  * Permission is hereby granted, free of charge, to any person obtaining a  *
50e3d5408SPeter Wemm  * copy of this software and associated documentation files (the            *
60e3d5408SPeter Wemm  * "Software"), to deal in the Software without restriction, including      *
70e3d5408SPeter Wemm  * without limitation the rights to use, copy, modify, merge, publish,      *
80e3d5408SPeter Wemm  * distribute, distribute with modifications, sublicense, and/or sell       *
90e3d5408SPeter Wemm  * copies of the Software, and to permit persons to whom the Software is    *
100e3d5408SPeter Wemm  * furnished to do so, subject to the following conditions:                 *
110e3d5408SPeter Wemm  *                                                                          *
120e3d5408SPeter Wemm  * The above copyright notice and this permission notice shall be included  *
130e3d5408SPeter Wemm  * in all copies or substantial portions of the Software.                   *
140e3d5408SPeter Wemm  *                                                                          *
150e3d5408SPeter Wemm  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
160e3d5408SPeter Wemm  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
170e3d5408SPeter Wemm  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
180e3d5408SPeter Wemm  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
190e3d5408SPeter Wemm  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
200e3d5408SPeter Wemm  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
210e3d5408SPeter Wemm  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
220e3d5408SPeter Wemm  *                                                                          *
230e3d5408SPeter Wemm  * Except as contained in this notice, the name(s) of the above copyright   *
240e3d5408SPeter Wemm  * holders shall not be used in advertising or otherwise to promote the     *
250e3d5408SPeter Wemm  * sale, use or other dealings in this Software without prior written       *
260e3d5408SPeter Wemm  * authorization.                                                           *
270e3d5408SPeter Wemm  ****************************************************************************/
280e3d5408SPeter Wemm 
290e3d5408SPeter Wemm /****************************************************************************
304a1a9510SRong-En Fan  *  Author:  Juergen Pfeifer, 1997                                          *
314a1a9510SRong-En Fan  *     and:  Thomas E. Dickey 2005                                          *
320e3d5408SPeter Wemm  ****************************************************************************/
330e3d5408SPeter Wemm 
340e3d5408SPeter Wemm /*
350e3d5408SPeter Wemm  *	lib_slkatron.c
360e3d5408SPeter Wemm  *	Soft key routines.
370e3d5408SPeter Wemm  *      Switch on labels attributes
380e3d5408SPeter Wemm  */
390e3d5408SPeter Wemm #include <curses.priv.h>
400e3d5408SPeter Wemm 
41*06bfebdeSXin LI MODULE_ID("$Id: lib_slkatron.c,v 1.12 2010/03/31 23:38:02 tom Exp $")
420e3d5408SPeter Wemm 
437a69bbfbSPeter Wemm NCURSES_EXPORT(int)
44*06bfebdeSXin LI NCURSES_SP_NAME(slk_attron) (NCURSES_SP_DCLx const chtype attr)
450e3d5408SPeter Wemm {
46*06bfebdeSXin LI     T((T_CALLED("slk_attron(%p,%s)"), (void *) SP_PARM, _traceattr(attr)));
470e3d5408SPeter Wemm 
48*06bfebdeSXin LI     if (SP_PARM != 0 && SP_PARM->_slk != 0) {
49*06bfebdeSXin LI 	TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
50*06bfebdeSXin LI 	AddAttr(SP_PARM->_slk->attr, attr);
514a1a9510SRong-En Fan 	if ((attr & A_COLOR) != 0) {
52*06bfebdeSXin LI 	    SetPair(SP_PARM->_slk->attr, PairNumber(attr));
534a1a9510SRong-En Fan 	}
54*06bfebdeSXin LI 	TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP_PARM->_slk->attr))));
550e3d5408SPeter Wemm 	returnCode(OK);
567a69bbfbSPeter Wemm     } else
570e3d5408SPeter Wemm 	returnCode(ERR);
580e3d5408SPeter Wemm }
59*06bfebdeSXin LI 
60*06bfebdeSXin LI #if NCURSES_SP_FUNCS
61*06bfebdeSXin LI NCURSES_EXPORT(int)
62*06bfebdeSXin LI slk_attron(const chtype attr)
63*06bfebdeSXin LI {
64*06bfebdeSXin LI     return NCURSES_SP_NAME(slk_attron) (CURRENT_SCREEN, attr);
65*06bfebdeSXin LI }
66*06bfebdeSXin LI #endif
67