1193323Sed/****************************************************************************
2193323Sed * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
3193323Sed *                                                                          *
4193323Sed * Permission is hereby granted, free of charge, to any person obtaining a  *
5193323Sed * copy of this software and associated documentation files (the            *
6193323Sed * "Software"), to deal in the Software without restriction, including      *
7193323Sed * without limitation the rights to use, copy, modify, merge, publish,      *
8193323Sed * distribute, distribute with modifications, sublicense, and/or sell       *
9193323Sed * copies of the Software, and to permit persons to whom the Software is    *
10193323Sed * furnished to do so, subject to the following conditions:                 *
11193323Sed *                                                                          *
12193323Sed * The above copyright notice and this permission notice shall be included  *
13193323Sed * in all copies or substantial portions of the Software.                   *
14193323Sed *                                                                          *
15193323Sed * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16193323Sed * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17193323Sed * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18193323Sed * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19193323Sed * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20193323Sed * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21193323Sed * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22193323Sed *                                                                          *
23193323Sed * Except as contained in this notice, the name(s) of the above copyright   *
24193323Sed * holders shall not be used in advertising or otherwise to promote the     *
25193323Sed * sale, use or other dealings in this Software without prior written       *
26193323Sed * authorization.                                                           *
27193323Sed ****************************************************************************/
28193323Sed
29193323Sed/****************************************************************************
30193323Sed *   Author:  Juergen Pfeifer, 1995,1997                                    *
31193323Sed ****************************************************************************/
32193323Sed
33193323Sed#include "form.priv.h"
34193323Sed
35193323SedMODULE_ID("$Id: fld_stat.c,v 1.11 2004/12/11 22:28:00 tom Exp $")
36193323Sed
37193323Sed/*---------------------------------------------------------------------------
38193323Sed|   Facility      :  libnform
39193323Sed|   Function      :  int set_field_status(FIELD *field, bool status)
40193323Sed|
41193323Sed|   Description   :  Set or clear the 'changed' indication flag for that
42193323Sed|                    fields primary buffer.
43193323Sed|
44193323Sed|   Return Values :  E_OK            - success
45193323Sed+--------------------------------------------------------------------------*/
46193323SedNCURSES_EXPORT(int)
47193323Sedset_field_status(FIELD *field, bool status)
48193323Sed{
49193323Sed  T((T_CALLED("set_field_status(%p,%d)"), field, status));
50193323Sed
51193323Sed  Normalize_Field(field);
52193323Sed
53193323Sed  if (status)
54193323Sed    field->status |= _CHANGED;
55193323Sed  else
56193323Sed    field->status &= ~_CHANGED;
57193323Sed
58193323Sed  RETURN(E_OK);
59193323Sed}
60193323Sed
61193323Sed/*---------------------------------------------------------------------------
62193323Sed|   Facility      :  libnform
63193323Sed|   Function      :  bool field_status(const FIELD *field)
64193323Sed|
65193323Sed|   Description   :  Retrieve the value of the 'changed' indication flag
66193323Sed|                    for that fields primary buffer.
67198090Srdivacky|
68193323Sed|   Return Values :  TRUE  - buffer has been changed
69193323Sed|                    FALSE - buffer has not been changed
70193323Sed+--------------------------------------------------------------------------*/
71193323SedNCURSES_EXPORT(bool)
72193323Sedfield_status(const FIELD *field)
73193323Sed{
74193323Sed  T((T_CALLED("field_status(%p)"), field));
75193323Sed
76193323Sed  returnBool((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE);
77198090Srdivacky}
78198090Srdivacky
79193323Sed/* fld_stat.c ends here */
80193323Sed