1119483Sobrien/**************************************************************************** 2141060Srwatson * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * 398542Smckusick * * 498542Smckusick * Permission is hereby granted, free of charge, to any person obtaining a * 598542Smckusick * copy of this software and associated documentation files (the * 6141060Srwatson * "Software"), to deal in the Software without restriction, including * 7141060Srwatson * without limitation the rights to use, copy, modify, merge, publish, * 8141060Srwatson * distribute, distribute with modifications, sublicense, and/or sell * 998542Smckusick * copies of the Software, and to permit persons to whom the Software is * 10141060Srwatson * furnished to do so, subject to the following conditions: * 11141060Srwatson * * 12141060Srwatson * The above copyright notice and this permission notice shall be included * 13141060Srwatson * in all copies or substantial portions of the Software. * 14141060Srwatson * * 15141060Srwatson * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 16141060Srwatson * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 17141060Srwatson * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 18141060Srwatson * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 19141060Srwatson * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 20141060Srwatson * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 21141060Srwatson * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 22141060Srwatson * * 23141060Srwatson * Except as contained in this notice, the name(s) of the above copyright * 24141060Srwatson * holders shall not be used in advertising or otherwise to promote the * 25141060Srwatson * sale, use or other dealings in this Software without prior written * 26141060Srwatson * authorization. * 27141060Srwatson ****************************************************************************/ 28141060Srwatson 29141060Srwatson/**************************************************************************** 30141060Srwatson * Author: Juergen Pfeifer, 1995,1997 * 31141060Srwatson ****************************************************************************/ 3297860Sphk 3397860Sphk#include "form.priv.h" 3497860Sphk 3597860SphkMODULE_ID("$Id: frm_opts.c,v 1.17 2013/08/24 22:58:47 tom Exp $") 3697860Sphk 3797860Sphk/*--------------------------------------------------------------------------- 3897860Sphk| Facility : libnform 3997860Sphk| Function : int set_form_opts(FORM *form, Form_Options opts) 4097860Sphk| 4197860Sphk| Description : Turns on the named options and turns off all the 4297860Sphk| remaining options for that form. 4397860Sphk| 4497860Sphk| Return Values : E_OK - success 4597860Sphk| E_BAD_ARGUMENT - invalid options 46119483Sobrien+--------------------------------------------------------------------------*/ 47119483SobrienNCURSES_EXPORT(int) 4897860Sphkset_form_opts(FORM *form, Form_Options opts) 4998542Smckusick{ 50192972Sdfr T((T_CALLED("set_form_opts(%p,%d)"), (void *)form, opts)); 5197860Sphk 52223938Smarius opts &= (Form_Options) ALL_FORM_OPTS; 53173040Sjhb if ((unsigned)opts & ~ALL_FORM_OPTS) 54111456Sobrien RETURN(E_BAD_ARGUMENT); 55173040Sjhb else 56173040Sjhb { 57111410Smckusick Normalize_Form(form)->opts = opts; 58111410Smckusick RETURN(E_OK); 59111456Sobrien } 6097860Sphk} 61235988Sgleb 62235988Sgleb/*--------------------------------------------------------------------------- 6397860Sphk| Facility : libnform 6497860Sphk| Function : Form_Options form_opts(const FORM *) 6597860Sphk| 6697860Sphk| Description : Retrieves the current form options. 67104678Sphk| 68104678Sphk| Return Values : The option flags. 6997860Sphk+--------------------------------------------------------------------------*/ 7097860SphkNCURSES_EXPORT(Form_Options) 71104678Sphkform_opts(const FORM *form) 72104678Sphk{ 7398542Smckusick T((T_CALLED("form_opts(%p)"), (const void *)form)); 7498542Smckusick returnCode((Form_Options) ((unsigned)Normalize_Form(form)->opts & ALL_FORM_OPTS)); 7598542Smckusick} 7698542Smckusick 7797860Sphk/*--------------------------------------------------------------------------- 7897860Sphk| Facility : libnform 7997860Sphk| Function : int form_opts_on(FORM *form, Form_Options opts) 8097860Sphk| 8197860Sphk| Description : Turns on the named options; no other options are 8297864Sphk| changed. 8398542Smckusick| 8498542Smckusick| Return Values : E_OK - success 8598542Smckusick| E_BAD_ARGUMENT - invalid options 8698542Smckusick+--------------------------------------------------------------------------*/ 8797864SphkNCURSES_EXPORT(int) 8897864Sphkform_opts_on(FORM *form, Form_Options opts) 8997860Sphk{ 90235988Sgleb T((T_CALLED("form_opts_on(%p,%d)"), (void *)form, opts)); 91235988Sgleb 9297860Sphk opts &= (Form_Options) ALL_FORM_OPTS; 93219452Srdivacky if ((unsigned)opts & ~ALL_FORM_OPTS) 9497860Sphk RETURN(E_BAD_ARGUMENT); 9597860Sphk else 96223938Smarius { 97235988Sgleb Normalize_Form(form)->opts |= opts; 9897860Sphk RETURN(E_OK); 99233105Smarius } 100192972Sdfr} 10197861Sphk 10297861Sphk/*--------------------------------------------------------------------------- 10397860Sphk| Facility : libnform 10497861Sphk| Function : int form_opts_off(FORM *form, Form_Options opts) 10597861Sphk| 10698542Smckusick| Description : Turns off the named options; no other options are 10798542Smckusick| changed. 10898542Smckusick| 10998542Smckusick| Return Values : E_OK - success 11098542Smckusick| E_BAD_ARGUMENT - invalid options 111192972Sdfr+--------------------------------------------------------------------------*/ 11298542SmckusickNCURSES_EXPORT(int) 11398542Smckusickform_opts_off(FORM *form, Form_Options opts) 11498542Smckusick{ 11597861Sphk T((T_CALLED("form_opts_off(%p,%d)"), (void *)form, opts)); 11697861Sphk 11797864Sphk opts &= (Form_Options) ALL_FORM_OPTS; 11897861Sphk if ((unsigned)opts & ~ALL_FORM_OPTS) 11997860Sphk RETURN(E_BAD_ARGUMENT); 12097860Sphk else 121235988Sgleb { 12297860Sphk Normalize_Form(form)->opts &= ~opts; 12397860Sphk RETURN(E_OK); 124233105Smarius } 12597861Sphk} 126235988Sgleb 12797861Sphk/* frm_opts.c ends here */ 128218716Sdim