1 .\"***************************************************************************
2 .\" Copyright 2018-2022,2023 Thomas E. Dickey *
3 .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
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: *
13 .\" The above copyright notice and this permission notice shall be included *
14 .\" in all copies or substantial portions of the Software. *
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. *
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 *
28 .\"***************************************************************************
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"
49 panel stack extension for curses
54 \fBPANEL *new_panel(WINDOW *\fIwin\fP);
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);
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);
67 \fBPANEL *panel_above(const PANEL *\fIpan\fP);
68 \fBPANEL *panel_below(const PANEL *\fIpan\fP);
70 \fBint set_panel_userptr(PANEL *\fIpan\fP, const void *\fIptr\fP);
71 \fBconst void *panel_userptr(const PANEL *\fIpan\fP);
73 \fBint del_panel(PANEL *\fIpan\fP);
75 \fI/* ncurses extensions */\fP
76 \fBPANEL *ground_panel(SCREEN *\fIsp\fP);
77 \fBPANEL *ceiling_panel(SCREEN *\fIsp\fP);
80 Panels are \fBcurses\fP(3X) windows with the added feature of
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.
87 \fBstdscr\fP window is beneath all panels, and is not considered part
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.
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.
100 \fBbottom_panel(\fIpan\fB)\fR
101 puts panel \fIpan\fP at the bottom of all panels.
104 \fBceiling_panel(\fIsp\fB)\fR
105 acts like \fBpanel_below(NULL)\fP, for the given \fBSCREEN\fP \fIsp\fP.
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).
113 \fBground_panel(\fIsp\fB)\fR
114 acts like \fBpanel_above(NULL)\fP, for the given \fBSCREEN\fP \fIsp\fP.
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.
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.
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.
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.
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.
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.
154 \fBpanel_userptr(\fIpan\fB)\fR
155 returns the user pointer for a given panel \fIpan\fP.
158 \fBpanel_window(\fIpan\fB)\fR
159 returns a pointer to the window of the given panel \fIpan\fP.
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.
169 .SS set_panel_userptr
170 \fBset_panel_userptr(\fIpan\fB,\fIptr\fB)\fR
171 sets the panel's user pointer.
174 \fBshow_panel(\fIpan\fB)\fR
175 makes a hidden panel visible by placing it on top of the panels in the
177 See \fBCOMPATIBILITY\fP below.
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.
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).
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.
195 Each routine that returns a pointer returns \fBNULL\fP if an error
197 Each routine that returns an int value returns \fBOK\fP if it
198 executes successfully and \fBERR\fP if not.
200 Except as noted, the \fIpan\fP and \fIwindow\fP parameters must be non-null.
201 If those are null, an error is returned.
203 The \fBmove_panel\fP function uses \fBmvwin\fP(3X),
204 and will return an error if \fBmvwin\fP returns an error.
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.
211 is cautioned not to directly use \fBPANEL\fP fields.
213 The functions \fBshow_panel\fP and \fBtop_panel\fP are identical
214 in this implementation, and work equally well with displayed or hidden
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.
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).
227 The panel facility was documented in SVr4.2 in
228 \fICharacter User Interface Programming (UNIX SVR4.2)\fP.
230 It is not part of X/Open Curses.
232 A few implementations exist:
234 Systems based on SVr4 source code,
235 e.g., Solaris, provide this library.
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).
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).
247 Several developers have improved each of these;
248 they are no longer the same as Tucker's implementation.
251 has a panel library begun by Valery Ushakov in 2015.
252 This is based on the AT&T documentation.
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
258 Repackaged for ncurses by Zeyd ben-Halim.
260 Juergen Pfeifer and Thomas E. Dickey revised/improved the library.
263 \fB\%curs_variables\fP(3X)