]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/panel.3x
ncurses 6.4 - patch 20230923
[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.52 2023/09/23 23:37:26 tom Exp $
31 .TH panel 3X 2023-09-23 "ncurses 6.4" "Library calls"
32 .ie \n(.g .ds `` \(lq
33 .el       .ds `` ``
34 .ie \n(.g .ds '' \(rq
35 .el       .ds '' ''
36 .de bP
37 .ie n  .IP \(bu 4
38 .el    .IP \(bu 2
39 ..
40 .SH NAME
41 panel \-
42 panel stack extension for curses
43 .SH SYNOPSIS
44 \fB#include <panel.h>\fP
45 .P
46 \fBcc [flags] sourcefiles \-lpanel \-lncurses\fP
47 .P
48 \fBPANEL *new_panel(WINDOW *\fIwin\fB);\fR
49 .sp
50 \fBint bottom_panel(PANEL *\fIpan\fB);\fR
51 .br
52 \fBint top_panel(PANEL *\fIpan\fB);\fR
53 .br
54 \fBint show_panel(PANEL *\fIpan\fB);\fR
55 .br
56 \fBvoid update_panels(void);\fP
57 .br
58 \fBint hide_panel(PANEL *\fIpan\fB);\fR
59 .sp
60 \fBWINDOW *panel_window(const PANEL *\fIpan\fB);\fR
61 .br
62 \fBint replace_panel(PANEL *\fIpan\fB, WINDOW *\fIwindow\fB);\fR
63 .br
64 \fBint move_panel(PANEL *\fIpan\fB, int \fIstarty\fB, int \fIstartx\fB);\fR
65 .br
66 \fBint panel_hidden(const PANEL *\fIpan\fB);\fR
67 .sp
68 \fBPANEL *panel_above(const PANEL *\fIpan\fB);\fR
69 .br
70 \fBPANEL *panel_below(const PANEL *\fIpan\fB);\fR
71 .sp
72 \fBint set_panel_userptr(PANEL *\fIpan\fB, const void *\fIptr\fB);\fR
73 .br
74 \fBconst void *panel_userptr(const PANEL *\fIpan\fB);\fR
75 .sp
76 \fBint del_panel(PANEL *\fIpan\fB);\fR
77 .sp
78 \fR/* ncurses-extensions */\fP
79 .br
80 \fBPANEL *ground_panel(SCREEN *\fIsp\fB);\fR
81 .br
82 \fBPANEL *ceiling_panel(SCREEN *\fIsp\fB);\fR
83 .br
84 .SH DESCRIPTION
85 Panels are \fBcurses\fP(3X) windows with the added feature of
86 depth.
87 Panel functions allow the use of stacked windows and ensure
88 the proper portions of each window and the curses \fBstdscr\fP window are
89 hidden or displayed when panels are added, moved, modified or removed.
90 The set of currently visible panels is the stack of panels.
91 The
92 \fBstdscr\fP window is beneath all panels, and is not considered part
93 of the stack.
94 .P
95 A window is associated with every panel.
96 The panel routines enable
97 you to create, move, hide, and show panels, as well as position a
98 panel at any desired location in the stack.
99 .P
100 Panel routines are a functional layer added to \fBcurses\fP(3X), make only
101 high-level curses calls, and work anywhere terminfo curses does.
102 .SH FUNCTIONS
103 .\" ---------
104 .SS bottom_panel
105 \fBbottom_panel(\fIpan\fB)\fR
106 puts panel \fIpan\fP at the bottom of all panels.
107 .\" ---------
108 .SS ceiling_panel
109 \fBceiling_panel(\fIsp\fB)\fR
110 acts like \fBpanel_below(NULL)\fP, for the given \fBSCREEN\fP \fIsp\fP.
111 .\" ---------
112 .SS del_panel
113 \fBdel_panel(\fIpan\fB)\fR
114 removes the given panel \fIpan\fP from the  stack and deallocates the
115 \fBPANEL\fP structure (but not its associated window).
116 .\" ---------
117 .SS ground_panel
118 \fBground_panel(\fIsp\fB)\fR
119 acts like \fBpanel_above(NULL)\fP, for the given \fBSCREEN\fP \fIsp\fP.
120 .\" ---------
121 .SS hide_panel
122 \fBhide_panel(\fIpan\fB)\fR
123 removes the given panel \fIpan\fP from the panel stack
124 and thus hides it from view.
125 The \fBPANEL\fP structure is not lost, merely removed from the stack.
126 .\" ---------
127 .SS move_panel
128 \fBmove_panel(\fIpan\fB,\fIstarty\fB,\fIstartx\fB)\fR
129 moves the given panel \fIpan\fP's window so that its upper-left corner is at
130 \fIstarty\fP, \fIstartx\fP.
131 It does not change the position of the panel in the stack.
132 Be sure to use this function, not \fBmvwin\fP(3X), to move a panel window.
133 .\" ---------
134 .SS new_panel
135 \fBnew_panel(\fIwin\fB)\fR allocates a \fBPANEL\fR structure,
136 associates it with \fIwin\fP, places the panel on the top of the stack
137 (causes  it to  be  displayed above any other panel) and returns a
138 pointer to the new panel.
139 .\" ---------
140 .SS panel_above
141 \fBpanel_above(\fIpan\fB)\fR
142 returns a pointer to the panel above \fIpan\fP.
143 If the panel argument is
144 \fB(PANEL *)0\fP, it returns a pointer to the bottom panel in the stack.
145 .\" ---------
146 .SS panel_below
147 \fBpanel_below(\fIpan\fB)\fR
148 returns a pointer to the panel just below \fIpan\fP.
149 If the panel argument
150 is \fB(PANEL *)0\fP, it returns a pointer to the top panel in the stack.
151 .\" ---------
152 .SS panel_hidden
153 \fBpanel_hidden(\fIpan\fB)\fR
154 returns \fBFALSE\fP if the panel \fIpan\fP is in the panel stack,
155 \fBTRUE\fP if it is not.
156 If the panel is a null pointer, return \fBERR\fP.
157 .\" ---------
158 .SS panel_userptr
159 \fBpanel_userptr(\fIpan\fB)\fR
160 returns the user pointer for a given panel \fIpan\fP.
161 .\" ---------
162 .SS panel_window
163 \fBpanel_window(\fIpan\fB)\fR
164 returns a pointer to the window of the given panel \fIpan\fP.
165 .\" ---------
166 .SS replace_panel
167 \fBreplace_panel(\fIpan\fB,\fIwindow\fB)\fR
168 replaces the current window of panel \fIpan\fP with \fIwindow\fP
169 This is useful, for example if you want to resize a panel.
170 In \fBncurses\fP, you can call \fBreplace_panel\fP
171 to resize a panel using a window resized with \fBwresize\fP(3X).
172 It does not change the position of the panel in the stack.
173 .\" ---------
174 .SS set_panel_userptr
175 \fBset_panel_userptr(\fIpan\fB,\fIptr\fB)\fR
176 sets the panel's user pointer.
177 .\" ---------
178 .SS show_panel
179 \fBshow_panel(\fIpan\fB)\fR
180 makes a hidden panel visible by placing it on top of the panels in the
181 panel stack.
182 See \fBCOMPATIBILITY\fP below.
183 .\" ---------
184 .SS top_panel
185 \fBtop_panel(\fIpan\fB)\fR
186 puts the given visible panel \fIpan\fP on top of all panels in the stack.
187 See \fBCOMPATIBILITY\fP below.
188 .\" ---------
189 .SS update_panels
190 \fBupdate_panels()\fR
191 refreshes the \fIvirtual screen\fP to reflect the relations between the
192 panels in the stack, but does not call \fBdoupdate\fP(3X) to refresh the
193 \fIphysical screen\fP.
194 Use this function and not \fBwrefresh\fP(3X) or \fBwnoutrefresh\fP(3X).
195 .PP
196 \fBupdate_panels\fP may be called more than once before a call to
197 \fBdoupdate\fP, but \fBdoupdate\fP is the function responsible for updating
198 the \fIphysical screen\fP.
199 .SH DIAGNOSTICS
200 Each routine that returns a pointer returns \fBNULL\fP if an error
201 occurs.
202 Each routine that returns an int value returns \fBOK\fP if it
203 executes successfully and \fBERR\fP if not.
204 .PP
205 Except as noted, the \fIpan\fP and \fIwindow\fP parameters must be non-null.
206 If those are null, an error is returned.
207 .PP
208 The \fBmove_panel\fP function uses \fBmvwin\fP(3X),
209 and will return an error if \fBmvwin\fP returns an error.
210 .SH COMPATIBILITY
211 Reasonable care has been taken to  ensure  compatibility
212 with  the  native  panel facility introduced in System V (inspection of
213 the SVr4 manual pages suggests the programming interface is unchanged).
214 The \fBPANEL\fP data structures are merely  similar.
215 The  programmer
216 is cautioned not to directly use \fBPANEL\fP fields.
217 .P
218 The functions \fBshow_panel\fP and \fBtop_panel\fP are identical
219 in this implementation, and work equally well with displayed or hidden
220 panels.
221 In the native System V implementation, \fBshow_panel\fP is
222 intended for making a hidden panel visible (at the top of the stack)
223 and \fBtop_panel\fP is intended for making an already-visible panel
224 move to the top of the stack.
225 You are cautioned to use the correct
226 function to ensure compatibility with native panel libraries.
227 .SH NOTE
228 In your library list, libpanel.a should be before libncurses.a; that is,
229 you should say \*(``\-lpanel \-lncurses\*('', not the other way around
230 (which would give a link-error with static libraries).
231 .SH PORTABILITY
232 The panel facility was documented in SVr4.2 in
233 \fICharacter User Interface Programming (UNIX SVR4.2)\fP.
234 .PP
235 It is not part of X/Open Curses.
236 .PP
237 A few implementations exist:
238 .bP
239 Systems based on SVr4 source code,
240 e.g., Solaris, provide this library.
241 .bP
242 \fBncurses\fP (since version 0.6 in 1993)
243 and \fBPDCurses\fP (since version 2.2 in 1995)
244 provide a panel library whose common ancestor
245 was a public domain implementation by Warren Tucker
246 published in \fIu386mon\fP 2.20 (1990).
247 .IP
248 According to Tucker, the System\ V panel library
249 was first released in SVr3.2 (1988),
250 and his implementation helped with a port to SVr3.1 (1987).
251 .IP
252 Several developers have improved each of these;
253 they are no longer the same as Tucker's implementation.
254 .bP
255 NetBSD 8 (2018)
256 has a panel library begun by Valery Ushakov in 2015.
257 This is based on the AT&T documentation.
258 .SH FILES
259 panel.h
260 interface for the panels library
261 .P
262 libpanel.a
263 the panels library itself
264 .SH SEE ALSO
265 \fBcurses\fP(3X),
266 \fBcurs_variables\fP(3X),
267 .PP
268 This describes \fBncurses\fP
269 version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).
270 .SH AUTHOR
271 Originally written by Warren Tucker <wht@n4hgf.mt-park.ga.us>,
272 primarily to assist in porting \fIu386mon\fP to systems without a native
273 panels library.
274 .PP
275 Repackaged for ncurses by Zeyd ben-Halim.
276 .PP
277 Juergen Pfeifer and Thomas E. Dickey revised/improved the library.