xref: /openbsd-src/lib/libform/frm_win.c (revision a4afd6dad3fba28f80e70208181c06c482259988)
1 
2 /***************************************************************************
3 *                            COPYRIGHT NOTICE                              *
4 ****************************************************************************
5 *                ncurses is copyright (C) 1992-1995                        *
6 *                          Zeyd M. Ben-Halim                               *
7 *                          zmbenhal@netcom.com                             *
8 *                          Eric S. Raymond                                 *
9 *                          esr@snark.thyrsus.com                           *
10 *                                                                          *
11 *        Permission is hereby granted to reproduce and distribute ncurses  *
12 *        by any means and for any fee, whether alone or as part of a       *
13 *        larger distribution, in source or in binary form, PROVIDED        *
14 *        this notice is included with any such distribution, and is not    *
15 *        removed from any of its header files. Mention of ncurses in any   *
16 *        applications linked with it is highly appreciated.                *
17 *                                                                          *
18 *        ncurses comes AS IS with no warranty, implied or expressed.       *
19 *                                                                          *
20 ***************************************************************************/
21 
22 #include "form.priv.h"
23 
24 /*---------------------------------------------------------------------------
25 |   Facility      :  libnform
26 |   Function      :  int set_form_win(FORM *form,WINDOW *win)
27 |
28 |   Description   :  Set the window of the form to win.
29 |
30 |   Return Values :  E_OK       - success
31 |                    E_POSTED   - form is posted
32 +--------------------------------------------------------------------------*/
33 int set_form_win(FORM * form, WINDOW * win)
34 {
35   if (form && (form->status & _POSTED))
36     RETURN(E_POSTED);
37 
38   Normalize_Form( form )->win = win;
39   RETURN(E_OK);
40 }
41 
42 /*---------------------------------------------------------------------------
43 |   Facility      :  libnform
44 |   Function      :  WINDOW *form_win(const FORM *)
45 |
46 |   Description   :  Retrieve the window of the form.
47 |
48 |   Return Values :  The pointer to the Window or NULL if there is none.
49 +--------------------------------------------------------------------------*/
50 WINDOW *form_win(const FORM * form)
51 {
52   return Normalize_Form( form )->win;
53 }
54 
55 /*---------------------------------------------------------------------------
56 |   Facility      :  libnform
57 |   Function      :  int set_form_sub(FORM *form, WINDOW *win)
58 |
59 |   Description   :  Set the subwindow of the form to win.
60 |
61 |   Return Values :  E_OK       - success
62 |                    E_POSTED   - form is posted
63 +--------------------------------------------------------------------------*/
64 int set_form_sub(FORM * form, WINDOW * win)
65 {
66   if (form && (form->status & _POSTED))
67     RETURN(E_POSTED);
68 
69   Normalize_Form( form )->sub = win;
70   RETURN(E_OK);
71 }
72 
73 /*---------------------------------------------------------------------------
74 |   Facility      :  libnform
75 |   Function      :  WINDOW *form_sub(const FORM *)
76 |
77 |   Description   :  Retrieve the window of the form.
78 |
79 |   Return Values :  The pointer to the Window or NULL if there is none.
80 +--------------------------------------------------------------------------*/
81 WINDOW *form_sub(const FORM * form)
82 {
83   return Normalize_Form( form )->sub;
84 }
85 
86 /* frm_win.c ends here */
87