]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/panel.3x
ncurses 6.4 - patch 20240414
[ncurses.git] / man / panel.3x
1 .\"***************************************************************************
2 .\" Copyright 2018-2023,2024 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.63 2024/03/16 15:35:01 tom Exp $
31 .TH panel 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "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 \fIcurses\fP
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 property of
81 depth.
82 Panel functions allow the use of stacked windows and ensure that the
83 proper portions of each window and the \fIcurses\fP \fB\%stdscr\fP
84 window are hidden or displayed when panels are added,
85 moved,
86 modified,
87 or removed.
88 The set of currently visible panels is the stack of panels.
89 The
90 \fB\%stdscr\fP window is beneath all panels,
91 and is not considered part of the stack.
92 .PP
93 A window is associated with each panel.
94 The panel routines enable you to create,
95 move,
96 hide,
97 and show panels.
98 You can relocate a panel to any desired position in the stack.
99 .PP
100 Panel routines are a functional layer added to \fIcurses\fP,
101 make only high-level \fIcurses\fP calls,
102 and work anywhere \fIcurses\fP does.
103 .SH FUNCTIONS
104 .\" ---------
105 .SS bottom_panel
106 \fB\%bottom_panel(\fIpan\fB)\fR
107 puts panel \fIpan\fP at the bottom of all panels.
108 .\" ---------
109 .SS ceiling_panel
110 \fB\%ceiling_panel(\fIsp\fB)\fR
111 acts like \fB\%panel_below(NULL)\fP
112 for the given \fISCREEN\fP \fIsp\fP.
113 .\" ---------
114 .SS del_panel
115 \fB\%del_panel(\fIpan\fB)\fR
116 removes the given panel \fIpan\fP from the stack and deallocates the
117 \fI\%PANEL\fP structure (but not its associated window).
118 .\" ---------
119 .SS ground_panel
120 \fB\%ground_panel(\fIsp\fB)\fR
121 acts like \fB\%panel_above(NULL)\fP
122 for the given \fISCREEN\fP \fIsp\fP.
123 .\" ---------
124 .SS hide_panel
125 \fB\%hide_panel(\fIpan\fB)\fR
126 removes the given panel \fIpan\fP from the panel stack
127 and thus hides it from view.
128 The \fI\%PANEL\fP structure is not lost,
129 merely removed from the stack.
130 .\" ---------
131 .SS move_panel
132 \fB\%move_panel(\fIpan\fB, \fIstarty\fB, \fIstartx\fB)\fR
133 moves the given panel \fIpan\fP's window so that its upper-left corner
134 is at
135 \fIstarty\fP,
136 \fIstartx\fP.
137 It does not change the position of the panel in the stack.
138 Be sure to use this function,
139 not \fB\%mvwin\fP(3X),
140 to move a panel window.
141 .\" ---------
142 .SS new_panel
143 \fB\%new_panel(\fIwin\fB)\fR allocates a \fI\%PANEL\fR structure,
144 associates it with \fIwin\fP,
145 places the panel on the top of the stack
146 (causes it to be displayed above any other panel)
147 and returns a pointer to the new panel.
148 .\" ---------
149 .SS panel_above
150 \fB\%panel_above(\fIpan\fB)\fR
151 returns a pointer to the panel above \fIpan\fP.
152 If the panel argument is
153 \*(``\fB(PANEL *)0\fP\*('',
154 it returns a pointer to the bottom panel in the stack.
155 .\" ---------
156 .SS panel_below
157 \fB\%panel_below(\fIpan\fB)\fR
158 returns a pointer to the panel just below \fIpan\fP.
159 If the panel argument is
160 \*(``\fB(PANEL *)0\fP\*('',
161 it returns a pointer to the top panel in the stack.
162 .\" ---------
163 .SS panel_hidden
164 \fB\%panel_hidden(\fIpan\fB)\fR
165 returns \fBFALSE\fP if the panel \fIpan\fP is in the panel stack,
166 and \fBTRUE\fP if it is not.
167 If the panel is a null pointer,
168 it returns \fBERR\fP.
169 .\" ---------
170 .SS panel_userptr
171 \fB\%panel_userptr(\fIpan\fB)\fR
172 returns the user pointer for a given panel \fIpan\fP.
173 .\" ---------
174 .SS panel_window
175 \fB\%panel_window(\fIpan\fB)\fR
176 returns a pointer to the window of the given panel \fIpan\fP.
177 .\" ---------
178 .SS replace_panel
179 \fB\%replace_panel(\fIpan\fB, \fIwindow\fB)\fR
180 replaces the current window of panel \fIpan\fP with \fIwindow\fP
181 This is useful if,
182 for example,
183 you want to resize a panel.
184 In \fI\%ncurses\fP,
185 you can call \fB\%replace_panel\fP
186 to resize a panel using a window resized with \fB\%wresize\fP(3X).
187 It does not change the position of the panel in the stack.
188 .\" ---------
189 .SS set_panel_userptr
190 \fB\%set_panel_userptr(\fIpan\fB, \fIptr\fB)\fR
191 sets the panel's user pointer.
192 .\" ---------
193 .SS show_panel
194 \fB\%show_panel(\fIpan\fB)\fR
195 makes a hidden panel visible by placing it on top of the panels in the
196 panel stack.
197 See \*(``PORTABILITY\*('' below.
198 .\" ---------
199 .SS top_panel
200 \fB\%top_panel(\fIpan\fB)\fR
201 puts the given visible panel \fIpan\fP on top of all panels in the
202 stack.
203 See \*(``PORTABILITY\*('' below.
204 .\" ---------
205 .SS update_panels
206 \fB\%update_panels()\fR
207 refreshes the virtual screen to reflect the relations between the panels
208 in the stack,
209 but does not call \fB\%doupdate\fP(3X) to refresh the physical screen.
210 Use this function and not \fB\%wrefresh\fP(3X) or
211 \fB\%wnoutrefresh\fP(3X).
212 .PP
213 \fB\%update_panels\fP may be called more than once before a call to
214 \fB\%doupdate\fP,
215 but \fB\%doupdate\fP is the function responsible for updating
216 the physical screen.
217 .SH "RETURN VALUE"
218 Each routine that returns a pointer returns \fBNULL\fP if an error
219 occurs.
220 Each routine that returns an int value returns \fBOK\fP if it
221 executes successfully and \fBERR\fP if not.
222 .PP
223 Except as noted,
224 the \fIpan\fP and \fIwindow\fP parameters must be non-null.
225 If either is null,
226 an error is returned.
227 .PP
228 The \fB\%move_panel\fP function uses \fBmvwin\fP(3X),
229 and returns an error if \fB\%mvwin\fP returns an error.
230 .SH NOTES
231 The header file \fI\%panel.h\fP itself includes the header file
232 \fI\%curses.h\fP.
233 .SH PORTABILITY
234 Reasonable care has been taken to ensure compatibility
235 with the native panel facility introduced in System\ V;
236 inspection of the SVr4 manual pages suggests the programming interface
237 never changed.
238 The \fI\%PANEL\fP data structures are merely similar.
239 The programmer is cautioned not to directly use \fI\%PANEL\fP fields.
240 .PP
241 The functions \fB\%show_panel\fP and \fB\%top_panel\fP are identical
242 in this implementation,
243 and work equally well with displayed or hidden panels.
244 In the System\ V implementation,
245 \fB\%show_panel\fP is intended for making a hidden panel visible
246 (at the top of the stack)
247 and \fB\%top_panel\fP is intended for making an already-visible panel
248 move to the top of the stack.
249 You are cautioned to use the correct
250 function to ensure compatibility with System\ V panel libraries.
251 .SH HISTORY
252 A panel facility was documented in SVr4.2's
253 \fICharacter User Interface Programming\fP document.
254 .PP
255 It is not part of X/Open Curses.
256 .PP
257 A few implementations exist:
258 .bP
259 Systems based on SVr4 source code,
260 such as Solaris,
261 provide this library.
262 .bP
263 \fI\%ncurses\fP (since version 0.6 in 1993)
264 and \fIPDCurses\fP (since version 2.2 in 1995)
265 provide a panel library whose common ancestor
266 is a public domain implementation by Warren Tucker
267 published in \fIu386mon\fP 2.20 (1990).
268 .IP
269 According to Tucker,
270 the System\ V panel library was first released in SVr3.2 (1988),
271 and his implementation helped with a port to SVr3.1 (1987).
272 .IP
273 Several developers have improved each of these;
274 they are no longer the same as Tucker's implementation.
275 .bP
276 NetBSD 8 (2018)
277 has a panel library begun by Valery Ushakov in 2015,
278 based on the System\ V documentation.
279 .SH AUTHORS
280 Warren Tucker <wht@n4hgf.mt\-park.ga.us> originally wrote this
281 implementation,
282 primarily to assist in porting \fI\%u386mon\fP to systems without a
283 native panel library.
284 .PP
285 Zeyd ben-Halim repackaged it for \fI\%ncurses\fP.
286 .PP
287 Juergen Pfeifer and Thomas E. Dickey revised and improved the library.
288 .SH SEE ALSO
289 \fB\%curses\fP(3X),
290 \fB\%curs_variables\fP(3X)