]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/panel.3x
ncurses 6.4 - patch 20231014
[ncurses.git] / man / panel.3x
1 .\"***************************************************************************
2 .\" Copyright 2018-2022,2023 Thomas E. Dickey                                *
3 .\" Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: panel.3x,v 1.57 2023/10/14 19:20:40 tom Exp $
31 .TH panel 3X 2023-10-14 "ncurses 6.4" "Library calls"
32 .ie \n(.g \{\
33 .ds `` \(lq
34 .ds '' \(rq
35 .\}
36 .el \{\
37 .ie t .ds `` ``
38 .el   .ds `` ""
39 .ie t .ds '' ''
40 .el   .ds '' ""
41 .\}
42 .
43 .de bP
44 .ie n  .IP \(bu 4
45 .el    .IP \(bu 2
46 ..
47 .SH NAME
48 panel \-
49 panel stack extension for curses
50 .SH SYNOPSIS
51 .nf
52 \fB#include <panel.h>
53 .PP
54 \fBPANEL *new_panel(WINDOW *\fIwin\fP);
55 .PP
56 \fBint bottom_panel(PANEL *\fIpan\fP);
57 \fBint top_panel(PANEL *\fIpan\fP);
58 \fBint show_panel(PANEL *\fIpan\fP);
59 \fBvoid update_panels(void);
60 \fBint hide_panel(PANEL *\fIpan\fP);
61 .PP
62 \fBWINDOW *panel_window(const PANEL *\fIpan\fP);
63 \fBint replace_panel(PANEL *\fIpan\fP, WINDOW *\fIwindow\fP);
64 \fBint move_panel(PANEL *\fIpan\fP, int \fIstarty\fP, int \fIstartx\fP);
65 \fBint panel_hidden(const PANEL *\fIpan\fP);
66 .PP
67 \fBPANEL *panel_above(const PANEL *\fIpan\fP);
68 \fBPANEL *panel_below(const PANEL *\fIpan\fP);
69 .PP
70 \fBint set_panel_userptr(PANEL *\fIpan\fP, const void *\fIptr\fP);
71 \fBconst void *panel_userptr(const PANEL *\fIpan\fP);
72 .PP
73 \fBint del_panel(PANEL *\fIpan\fP);
74 .PP
75 \fI/* ncurses extensions */\fP
76 \fBPANEL *ground_panel(SCREEN *\fIsp\fP);
77 \fBPANEL *ceiling_panel(SCREEN *\fIsp\fP);
78 .fi
79 .SH DESCRIPTION
80 Panels are \fBcurses\fP(3X) windows with the added feature of
81 depth.
82 Panel functions allow the use of stacked windows and ensure
83 the proper portions of each window and the curses \fBstdscr\fP window are
84 hidden or displayed when panels are added, moved, modified or removed.
85 The set of currently visible panels is the stack of panels.
86 The
87 \fBstdscr\fP window is beneath all panels, and is not considered part
88 of the stack.
89 .P
90 A window is associated with every panel.
91 The panel routines enable
92 you to create, move, hide, and show panels, as well as position a
93 panel at any desired location in the stack.
94 .P
95 Panel routines are a functional layer added to \fBcurses\fP(3X), make only
96 high-level curses calls, and work anywhere terminfo curses does.
97 .SH FUNCTIONS
98 .\" ---------
99 .SS bottom_panel
100 \fBbottom_panel(\fIpan\fB)\fR
101 puts panel \fIpan\fP at the bottom of all panels.
102 .\" ---------
103 .SS ceiling_panel
104 \fBceiling_panel(\fIsp\fB)\fR
105 acts like \fBpanel_below(NULL)\fP, for the given \fBSCREEN\fP \fIsp\fP.
106 .\" ---------
107 .SS del_panel
108 \fBdel_panel(\fIpan\fB)\fR
109 removes the given panel \fIpan\fP from the  stack and deallocates the
110 \fBPANEL\fP structure (but not its associated window).
111 .\" ---------
112 .SS ground_panel
113 \fBground_panel(\fIsp\fB)\fR
114 acts like \fBpanel_above(NULL)\fP, for the given \fBSCREEN\fP \fIsp\fP.
115 .\" ---------
116 .SS hide_panel
117 \fBhide_panel(\fIpan\fB)\fR
118 removes the given panel \fIpan\fP from the panel stack
119 and thus hides it from view.
120 The \fBPANEL\fP structure is not lost, merely removed from the stack.
121 .\" ---------
122 .SS move_panel
123 \fBmove_panel(\fIpan\fB,\fIstarty\fB,\fIstartx\fB)\fR
124 moves the given panel \fIpan\fP's window so that its upper-left corner is at
125 \fIstarty\fP, \fIstartx\fP.
126 It does not change the position of the panel in the stack.
127 Be sure to use this function, not \fBmvwin\fP(3X), to move a panel window.
128 .\" ---------
129 .SS new_panel
130 \fBnew_panel(\fIwin\fB)\fR allocates a \fBPANEL\fR structure,
131 associates it with \fIwin\fP, places the panel on the top of the stack
132 (causes  it to  be  displayed above any other panel) and returns a
133 pointer to the new panel.
134 .\" ---------
135 .SS panel_above
136 \fBpanel_above(\fIpan\fB)\fR
137 returns a pointer to the panel above \fIpan\fP.
138 If the panel argument is
139 \fB(PANEL *)0\fP, it returns a pointer to the bottom panel in the stack.
140 .\" ---------
141 .SS panel_below
142 \fBpanel_below(\fIpan\fB)\fR
143 returns a pointer to the panel just below \fIpan\fP.
144 If the panel argument
145 is \fB(PANEL *)0\fP, it returns a pointer to the top panel in the stack.
146 .\" ---------
147 .SS panel_hidden
148 \fBpanel_hidden(\fIpan\fB)\fR
149 returns \fBFALSE\fP if the panel \fIpan\fP is in the panel stack,
150 \fBTRUE\fP if it is not.
151 If the panel is a null pointer, return \fBERR\fP.
152 .\" ---------
153 .SS panel_userptr
154 \fBpanel_userptr(\fIpan\fB)\fR
155 returns the user pointer for a given panel \fIpan\fP.
156 .\" ---------
157 .SS panel_window
158 \fBpanel_window(\fIpan\fB)\fR
159 returns a pointer to the window of the given panel \fIpan\fP.
160 .\" ---------
161 .SS replace_panel
162 \fBreplace_panel(\fIpan\fB,\fIwindow\fB)\fR
163 replaces the current window of panel \fIpan\fP with \fIwindow\fP
164 This is useful, for example if you want to resize a panel.
165 In \fBncurses\fP, you can call \fBreplace_panel\fP
166 to resize a panel using a window resized with \fBwresize\fP(3X).
167 It does not change the position of the panel in the stack.
168 .\" ---------
169 .SS set_panel_userptr
170 \fBset_panel_userptr(\fIpan\fB,\fIptr\fB)\fR
171 sets the panel's user pointer.
172 .\" ---------
173 .SS show_panel
174 \fBshow_panel(\fIpan\fB)\fR
175 makes a hidden panel visible by placing it on top of the panels in the
176 panel stack.
177 See \fBCOMPATIBILITY\fP below.
178 .\" ---------
179 .SS top_panel
180 \fBtop_panel(\fIpan\fB)\fR
181 puts the given visible panel \fIpan\fP on top of all panels in the stack.
182 See \fBCOMPATIBILITY\fP below.
183 .\" ---------
184 .SS update_panels
185 \fBupdate_panels()\fR
186 refreshes the \fIvirtual screen\fP to reflect the relations between the
187 panels in the stack, but does not call \fBdoupdate\fP(3X) to refresh the
188 \fIphysical screen\fP.
189 Use this function and not \fBwrefresh\fP(3X) or \fBwnoutrefresh\fP(3X).
190 .PP
191 \fBupdate_panels\fP may be called more than once before a call to
192 \fBdoupdate\fP, but \fBdoupdate\fP is the function responsible for updating
193 the \fIphysical screen\fP.
194 .SH DIAGNOSTICS
195 Each routine that returns a pointer returns \fBNULL\fP if an error
196 occurs.
197 Each routine that returns an int value returns \fBOK\fP if it
198 executes successfully and \fBERR\fP if not.
199 .PP
200 Except as noted, the \fIpan\fP and \fIwindow\fP parameters must be non-null.
201 If those are null, an error is returned.
202 .PP
203 The \fBmove_panel\fP function uses \fBmvwin\fP(3X),
204 and will return an error if \fBmvwin\fP returns an error.
205 .SH COMPATIBILITY
206 Reasonable care has been taken to  ensure  compatibility
207 with  the  native  panel facility introduced in System V (inspection of
208 the SVr4 manual pages suggests the programming interface is unchanged).
209 The \fBPANEL\fP data structures are merely  similar.
210 The  programmer
211 is cautioned not to directly use \fBPANEL\fP fields.
212 .P
213 The functions \fBshow_panel\fP and \fBtop_panel\fP are identical
214 in this implementation, and work equally well with displayed or hidden
215 panels.
216 In the native System V implementation, \fBshow_panel\fP is
217 intended for making a hidden panel visible (at the top of the stack)
218 and \fBtop_panel\fP is intended for making an already-visible panel
219 move to the top of the stack.
220 You are cautioned to use the correct
221 function to ensure compatibility with native panel libraries.
222 .SH NOTE
223 In your library list, libpanel.a should be before libncurses.a; that is,
224 you should say \*(``\-lpanel \-lncurses\*('', not the other way around
225 (which would give a link-error with static libraries).
226 .SH PORTABILITY
227 The panel facility was documented in SVr4.2 in
228 \fICharacter User Interface Programming (UNIX SVR4.2)\fP.
229 .PP
230 It is not part of X/Open Curses.
231 .PP
232 A few implementations exist:
233 .bP
234 Systems based on SVr4 source code,
235 e.g., Solaris, provide this library.
236 .bP
237 \fBncurses\fP (since version 0.6 in 1993)
238 and \fBPDCurses\fP (since version 2.2 in 1995)
239 provide a panel library whose common ancestor
240 was a public domain implementation by Warren Tucker
241 published in \fIu386mon\fP 2.20 (1990).
242 .IP
243 According to Tucker, the System\ V panel library
244 was first released in SVr3.2 (1988),
245 and his implementation helped with a port to SVr3.1 (1987).
246 .IP
247 Several developers have improved each of these;
248 they are no longer the same as Tucker's implementation.
249 .bP
250 NetBSD 8 (2018)
251 has a panel library begun by Valery Ushakov in 2015.
252 This is based on the AT&T documentation.
253 .SH AUTHOR
254 Originally written by Warren Tucker <wht@n4hgf.mt-park.ga.us>,
255 primarily to assist in porting \fIu386mon\fP to systems without a native
256 panels library.
257 .PP
258 Repackaged for ncurses by Zeyd ben-Halim.
259 .PP
260 Juergen Pfeifer and Thomas E. Dickey revised/improved the library.
261 .SH SEE ALSO
262 \fB\%curses\fP(3X),
263 \fB\%curs_variables\fP(3X)