/****************************************************************************1* Copyright (c) 1998 Free Software Foundation, Inc. *2* *3* Permission is hereby granted, free of charge, to any person obtaining a *4* copy of this software and associated documentation files (the *5* "Software"), to deal in the Software without restriction, including *6* without limitation the rights to use, copy, modify, merge, publish, *7* distribute, distribute with modifications, sublicense, and/or sell *8* copies of the Software, and to permit persons to whom the Software is *9* furnished to do so, subject to the following conditions: *10* *11* The above copyright notice and this permission notice shall be included *12* in all copies or substantial portions of the Software. *13* *14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *15* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *16* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *17* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *20* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *21* *22* Except as contained in this notice, the name(s) of the above copyright *23* holders shall not be used in advertising or otherwise to promote the *24* sale, use or other dealings in this Software without prior written *25* authorization. *26****************************************************************************/2728/****************************************************************************29* Author: Juergen Pfeifer <[email protected]> 1995,1997 *30****************************************************************************/31#include "form.priv.h"32MODULE_ID("$Id$")3334/*----------------------------------------------------------------------------35Field-Attribute manipulation routines36--------------------------------------------------------------------------*/37/* "Template" macro to generate a function to set a fields attribute */38#define GEN_FIELD_ATTR_SET_FCT( name ) \39int set_field_ ## name (FIELD * field, chtype attr)\40{\41int res = E_BAD_ARGUMENT;\42if ( attr==A_NORMAL || ((attr & A_ATTRIBUTES)==attr) )\43{\44Normalize_Field( field );\45if ((field -> name) != attr)\46{\47field -> name = attr;\48res = _nc_Synchronize_Attributes( field );\49}\50else\51res = E_OK;\52}\53RETURN(res);\54}5556/* "Template" macro to generate a function to get a fields attribute */57#define GEN_FIELD_ATTR_GET_FCT( name ) \58chtype field_ ## name (const FIELD * field)\59{\60return ( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\61}6263/*---------------------------------------------------------------------------64| Facility : libnform65| Function : int set_field_fore(FIELD *field, chtype attr)66|67| Description : Sets the foreground of the field used to display the68| field contents.69|70| Return Values : E_OK - success71| E_BAD_ARGUMENT - invalid attributes72| E_SYSTEM_ERROR - system error73+--------------------------------------------------------------------------*/74GEN_FIELD_ATTR_SET_FCT( fore )7576/*---------------------------------------------------------------------------77| Facility : libnform78| Function : chtype field_fore(const FIELD *)79|80| Description : Retrieve fields foreground attribute81|82| Return Values : The foreground attribute83+--------------------------------------------------------------------------*/84GEN_FIELD_ATTR_GET_FCT( fore )8586/*---------------------------------------------------------------------------87| Facility : libnform88| Function : int set_field_back(FIELD *field, chtype attr)89|90| Description : Sets the background of the field used to display the91| fields extend.92|93| Return Values : E_OK - success94| E_BAD_ARGUMENT - invalid attributes95| E_SYSTEM_ERROR - system error96+--------------------------------------------------------------------------*/97GEN_FIELD_ATTR_SET_FCT( back )9899/*---------------------------------------------------------------------------100| Facility : libnform101| Function : chtype field_back(const102|103| Description : Retrieve fields background attribute104|105| Return Values : The background attribute106+--------------------------------------------------------------------------*/107GEN_FIELD_ATTR_GET_FCT( back )108109/* fld_attr.c ends here */110111112