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