]> ncurses.scripts.mit.edu Git - ncurses.git/blob - form/frm_opts.c
0adb88f53d845c1acaa197b55ba5976e192884bc
[ncurses.git] / form / frm_opts.c
1 /*-----------------------------------------------------------------------------+
2 |           The ncurses form library is  Copyright (C) 1995-1997               |
3 |             by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de>                 |
4 |                          All Rights Reserved.                                |
5 |                                                                              |
6 | Permission to use, copy, modify, and distribute this software and its        |
7 | documentation for any purpose and without fee is hereby granted, provided    |
8 | that the above copyright notice appear in all copies and that both that      |
9 | copyright notice and this permission notice appear in supporting             |
10 | documentation, and that the name of the above listed copyright holder(s) not |
11 | be used in advertising or publicity pertaining to distribution of the        |
12 | software without specific, written prior permission.                         | 
13 |                                                                              |
14 | THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO  |
15 | THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-  |
16 | NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR   |
17 | ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- |
18 | SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
19 | NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH    |
20 | THE USE OR PERFORMANCE OF THIS SOFTWARE.                                     |
21 +-----------------------------------------------------------------------------*/
22
23 #include "form.priv.h"
24
25 MODULE_ID("$Id: frm_opts.c,v 1.3 1997/05/01 16:47:54 juergen Exp $")
26
27 /*---------------------------------------------------------------------------
28 |   Facility      :  libnform  
29 |   Function      :  int set_form_opts(FORM *form, Form_Options opts)
30 |   
31 |   Description   :  Turns on the named options and turns off all the
32 |                    remaining options for that form.
33 |
34 |   Return Values :  E_OK              - success
35 |                    E_BAD_ARGUMENT    - invalid options
36 +--------------------------------------------------------------------------*/
37 int set_form_opts(FORM * form, Form_Options  opts)
38 {
39   if (opts & ~ALL_FORM_OPTS)
40     RETURN(E_BAD_ARGUMENT);
41   else
42     {
43       Normalize_Form( form )->opts = opts;
44       RETURN(E_OK);
45     }
46 }
47
48 /*---------------------------------------------------------------------------
49 |   Facility      :  libnform  
50 |   Function      :  Form_Options form_opts(const FORM *)
51 |   
52 |   Description   :  Retrieves the current form options.
53 |
54 |   Return Values :  The option flags.
55 +--------------------------------------------------------------------------*/
56 Form_Options form_opts(const FORM * form)
57 {
58   return (Normalize_Form(form)->opts & ALL_FORM_OPTS);
59 }
60
61 /*---------------------------------------------------------------------------
62 |   Facility      :  libnform  
63 |   Function      :  int form_opts_on(FORM *form, Form_Options opts)
64 |   
65 |   Description   :  Turns on the named options; no other options are 
66 |                    changed.
67 |
68 |   Return Values :  E_OK            - success 
69 |                    E_BAD_ARGUMENT  - invalid options
70 +--------------------------------------------------------------------------*/
71 int form_opts_on(FORM * form, Form_Options opts)
72 {
73   if (opts & ~ALL_FORM_OPTS)
74     RETURN(E_BAD_ARGUMENT);
75   else
76     {
77       Normalize_Form( form )->opts |= opts;     
78       RETURN(E_OK);
79     }
80 }
81
82 /*---------------------------------------------------------------------------
83 |   Facility      :  libnform  
84 |   Function      :  int form_opts_off(FORM *form, Form_Options opts)
85 |   
86 |   Description   :  Turns off the named options; no other options are 
87 |                    changed.
88 |
89 |   Return Values :  E_OK            - success 
90 |                    E_BAD_ARGUMENT  - invalid options
91 +--------------------------------------------------------------------------*/
92 int form_opts_off(FORM * form, Form_Options opts)
93 {
94   if (opts & ~ALL_FORM_OPTS)
95     RETURN(E_BAD_ARGUMENT);
96   else
97     {
98       Normalize_Form(form)->opts &= ~opts;
99       RETURN(E_OK);
100     }
101 }
102
103 /* frm_opts.c ends here */