| 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.68 2024/12/28 21:26:21 tom Exp $ |
| 31 |
.TH panel 3NCURSES 2024-12-28 "ncurses 6.6" "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 |
manage overlapping \fIcurses\fP windows |
| 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 \fBncurses\fP(3NCURSES) 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(3NCURSES), |
| 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(3NCURSES). |
| 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(3NCURSES) to refresh the physical screen. |
| 210 |
Use this function and not \fB\%wrefresh\fP(3NCURSES) or |
| 211 |
\fB\%wnoutrefresh\fP(3NCURSES). |
| 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 |
| 219 |
.I NULL |
| 220 |
if an error occurs. |
| 221 |
Each routine that returns an int value returns \fBOK\fP if it |
| 222 |
executes successfully and \fBERR\fP if not. |
| 223 |
.PP |
| 224 |
Except as noted, |
| 225 |
the \fIpan\fP and \fIwindow\fP parameters must be non-null. |
| 226 |
If either is null, |
| 227 |
an error is returned. |
| 228 |
.PP |
| 229 |
The \fB\%move_panel\fP function uses \fBmvwin\fP(3NCURSES), |
| 230 |
and returns |
| 231 |
.B ERR |
| 232 |
if \fB\%mvwin\fP returns |
| 233 |
.BR ERR "." |
| 234 |
.SH NOTES |
| 235 |
The header file \fI\%panel.h\fP itself includes the header file |
| 236 |
\fI\%curses.h\fP. |
| 237 |
.SH PORTABILITY |
| 238 |
Reasonable care has been taken to ensure compatibility |
| 239 |
with the native panel facility introduced in System\ V; |
| 240 |
inspection of the SVr4 manual pages suggests the programming interface |
| 241 |
never changed. |
| 242 |
The \fI\%PANEL\fP data structures are merely similar. |
| 243 |
The programmer is cautioned not to directly use \fI\%PANEL\fP fields. |
| 244 |
.PP |
| 245 |
The functions \fB\%show_panel\fP and \fB\%top_panel\fP are identical |
| 246 |
in this implementation, |
| 247 |
and work equally well with displayed or hidden panels. |
| 248 |
In the System\ V implementation, |
| 249 |
\fB\%show_panel\fP is intended for making a hidden panel visible |
| 250 |
(at the top of the stack) |
| 251 |
and \fB\%top_panel\fP is intended for making an already-visible panel |
| 252 |
move to the top of the stack. |
| 253 |
You are cautioned to use the correct |
| 254 |
function to ensure compatibility with System\ V panel libraries. |
| 255 |
.SH HISTORY |
| 256 |
A panel facility was documented in SVr4.2's |
| 257 |
\fICharacter User Interface Programming\fP document. |
| 258 |
.PP |
| 259 |
It is not part of X/Open Curses. |
| 260 |
.PP |
| 261 |
A few implementations exist: |
| 262 |
.bP |
| 263 |
Systems based on SVr4 source code, |
| 264 |
such as Solaris, |
| 265 |
provide this library. |
| 266 |
.bP |
| 267 |
.I \%ncurses |
| 268 |
(since version 0.6 in 1993) |
| 269 |
and |
| 270 |
.I \%PDCurses |
| 271 |
(since version 2.2 in 1995) |
| 272 |
provide a |
| 273 |
.I panel |
| 274 |
library whose common ancestor |
| 275 |
is a public domain implementation by Warren Tucker |
| 276 |
published in \fIu386mon\fP 2.20 (1990). |
| 277 |
.IP |
| 278 |
According to Tucker, |
| 279 |
the System\ V panel library was first released in SVr3.2 (1988), |
| 280 |
and his implementation helped with a port to SVr3.1 (1987). |
| 281 |
.IP |
| 282 |
Several developers have improved each of these; |
| 283 |
they are no longer the same as Tucker's implementation. |
| 284 |
.bP |
| 285 |
NetBSD 8 (2018) |
| 286 |
has a panel library begun by Valery Ushakov in 2015, |
| 287 |
based on the System\ V documentation. |
| 288 |
.SH AUTHORS |
| 289 |
Warren Tucker <[email protected]\-park.ga.us> originally wrote this |
| 290 |
implementation, |
| 291 |
primarily to assist in porting \fI\%u386mon\fP to systems without a |
| 292 |
native panel library. |
| 293 |
.PP |
| 294 |
Zeyd ben-Halim repackaged it for \fI\%ncurses\fP. |
| 295 |
.PP |
| 296 |
Juergen Pfeifer and Thomas E. Dickey revised and improved the library. |
| 297 |
.SH SEE ALSO |
| 298 |
\fB\%ncurses\fP(3NCURSES), |
| 299 |
\fB\%curses_variables\fP(3NCURSES) |