150276Speter/****************************************************************************
2166124Srafan * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
350276Speter *                                                                          *
450276Speter * Permission is hereby granted, free of charge, to any person obtaining a  *
550276Speter * copy of this software and associated documentation files (the            *
650276Speter * "Software"), to deal in the Software without restriction, including      *
750276Speter * without limitation the rights to use, copy, modify, merge, publish,      *
850276Speter * distribute, distribute with modifications, sublicense, and/or sell       *
950276Speter * copies of the Software, and to permit persons to whom the Software is    *
1050276Speter * furnished to do so, subject to the following conditions:                 *
1150276Speter *                                                                          *
1250276Speter * The above copyright notice and this permission notice shall be included  *
1350276Speter * in all copies or substantial portions of the Software.                   *
1450276Speter *                                                                          *
1550276Speter * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
1650276Speter * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
1750276Speter * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
1850276Speter * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
1950276Speter * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
2050276Speter * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
2150276Speter * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
2250276Speter *                                                                          *
2350276Speter * Except as contained in this notice, the name(s) of the above copyright   *
2450276Speter * holders shall not be used in advertising or otherwise to promote the     *
2550276Speter * sale, use or other dealings in this Software without prior written       *
2650276Speter * authorization.                                                           *
2750276Speter ****************************************************************************/
2850276Speter
2950276Speter/****************************************************************************
30166124Srafan *   Author:  Juergen Pfeifer, 1995,1997                                    *
3150276Speter ****************************************************************************/
3250276Speter
3350276Speter#include "form.priv.h"
3450276Speter
35166124SrafanMODULE_ID("$Id: fld_stat.c,v 1.11 2004/12/11 22:28:00 tom Exp $")
3650276Speter
3750276Speter/*---------------------------------------------------------------------------
3850276Speter|   Facility      :  libnform
3950276Speter|   Function      :  int set_field_status(FIELD *field, bool status)
4050276Speter|
4150276Speter|   Description   :  Set or clear the 'changed' indication flag for that
4250276Speter|                    fields primary buffer.
4350276Speter|
4450276Speter|   Return Values :  E_OK            - success
4550276Speter+--------------------------------------------------------------------------*/
4676726SpeterNCURSES_EXPORT(int)
47166124Srafanset_field_status(FIELD *field, bool status)
4850276Speter{
49166124Srafan  T((T_CALLED("set_field_status(%p,%d)"), field, status));
5050276Speter
51166124Srafan  Normalize_Field(field);
52166124Srafan
5350276Speter  if (status)
5450276Speter    field->status |= _CHANGED;
5550276Speter  else
5650276Speter    field->status &= ~_CHANGED;
5750276Speter
58166124Srafan  RETURN(E_OK);
5950276Speter}
6050276Speter
6150276Speter/*---------------------------------------------------------------------------
6250276Speter|   Facility      :  libnform
6350276Speter|   Function      :  bool field_status(const FIELD *field)
6450276Speter|
6550276Speter|   Description   :  Retrieve the value of the 'changed' indication flag
6650276Speter|                    for that fields primary buffer.
6750276Speter|
6850276Speter|   Return Values :  TRUE  - buffer has been changed
6950276Speter|                    FALSE - buffer has not been changed
7050276Speter+--------------------------------------------------------------------------*/
7176726SpeterNCURSES_EXPORT(bool)
72166124Srafanfield_status(const FIELD *field)
7350276Speter{
74166124Srafan  T((T_CALLED("field_status(%p)"), field));
75166124Srafan
76166124Srafan  returnBool((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE);
7750276Speter}
7850276Speter
7950276Speter/* fld_stat.c ends here */
80