]> ncurses.scripts.mit.edu Git - ncurses.git/blob - form/frm_win.c
ncurses 4.1
[ncurses.git] / form / frm_win.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_win.c,v 1.4 1997/05/01 16:47:54 juergen Exp $")
26
27 /*---------------------------------------------------------------------------
28 |   Facility      :  libnform  
29 |   Function      :  int set_form_win(FORM *form,WINDOW *win)
30 |   
31 |   Description   :  Set the window of the form to win. 
32 |
33 |   Return Values :  E_OK       - success
34 |                    E_POSTED   - form is posted
35 +--------------------------------------------------------------------------*/
36 int set_form_win(FORM * form, WINDOW * win)
37 {
38   if (form && (form->status & _POSTED)) 
39     RETURN(E_POSTED);
40
41   Normalize_Form( form )->win = win;
42   RETURN(E_OK);
43 }       
44
45 /*---------------------------------------------------------------------------
46 |   Facility      :  libnform  
47 |   Function      :  WINDOW *form_win(const FORM *)
48 |   
49 |   Description   :  Retrieve the window of the form.
50 |
51 |   Return Values :  The pointer to the Window or stdscr if there is none.
52 +--------------------------------------------------------------------------*/
53 WINDOW *form_win(const FORM * form)
54 {
55   const FORM* f = Normalize_Form( form );
56   return (f->win ? f->win : stdscr);
57 }
58
59 /*---------------------------------------------------------------------------
60 |   Facility      :  libnform  
61 |   Function      :  int set_form_sub(FORM *form, WINDOW *win)
62 |   
63 |   Description   :  Set the subwindow of the form to win. 
64 |
65 |   Return Values :  E_OK       - success
66 |                    E_POSTED   - form is posted
67 +--------------------------------------------------------------------------*/
68 int set_form_sub(FORM * form, WINDOW * win)
69 {
70   if (form && (form->status & _POSTED)) 
71     RETURN(E_POSTED);
72
73   Normalize_Form( form )->sub = win;
74   RETURN(E_OK);
75 }       
76
77 /*---------------------------------------------------------------------------
78 |   Facility      :  libnform  
79 |   Function      :  WINDOW *form_sub(const FORM *)
80 |   
81 |   Description   :  Retrieve the window of the form.
82 |
83 |   Return Values :  The pointer to the Subwindow.
84 +--------------------------------------------------------------------------*/
85 WINDOW *form_sub(const FORM * form)
86 {
87   const FORM* f = Normalize_Form( form );
88   return Get_Form_Window(f);
89 }
90
91 /* frm_win.c ends here */