1panel(3X) panel(3X)
2
3
4
6 panel - panel stack extension for curses
7
9 #include <panel.h>
10
11 cc [flags] sourcefiles -lpanel -lncurses
12
13 PANEL *new_panel(WINDOW *win);
14
15 int bottom_panel(PANEL *pan);
16 int top_panel(PANEL *pan);
17 int show_panel(PANEL *pan);
18 void update_panels(void);
19 int hide_panel(PANEL *pan);
20
21 WINDOW *panel_window(const PANEL *pan);
22 int replace_panel(PANEL *pan, WINDOW *window);
23 int move_panel(PANEL *pan, int starty, int startx);
24 int panel_hidden(const PANEL *pan);
25
26 PANEL *panel_above(const PANEL *pan);
27 PANEL *panel_below(const PANEL *pan);
28
29 int set_panel_userptr(PANEL *pan, const void *ptr);
30 const void *panel_userptr(const PANEL *pan);
31
32 int del_panel(PANEL *pan);
33
34 /* ncurses-extensions */
35 PANEL *ground_panel(SCREEN *sp);
36 PANEL *ceiling_panel(SCREEN *sp);
37
39 Panels are curses(3X) windows with the added feature of depth. Panel
40 functions allow the use of stacked windows and ensure the proper por‐
41 tions of each window and the curses stdscr window are hidden or dis‐
42 played when panels are added, moved, modified or removed. The set of
43 currently visible panels is the stack of panels. The stdscr window is
44 beneath all panels, and is not considered part of the stack.
45
46 A window is associated with every panel. The panel routines enable you
47 to create, move, hide, and show panels, as well as position a panel at
48 any desired location in the stack.
49
50 Panel routines are a functional layer added to curses(3X), make only
51 high-level curses calls, and work anywhere terminfo curses does.
52
54 bottom_panel
55 bottom_panel(pan) puts panel pan at the bottom of all panels.
56
57 ceiling_panel
58 ceiling_panel(sp) acts like panel_below(NULL), for the given SCREEN sp.
59
60 del_panel
61 del_panel(pan) removes the given panel pan from the stack and deallo‐
62 cates the PANEL structure (but not its associated window).
63
64 ground_panel
65 ground_panel(sp) acts like panel_above(NULL), for the given SCREEN sp.
66
67 hide_panel
68 hide_panel(pan) removes the given panel pan from the panel stack and
69 thus hides it from view. The PANEL structure is not lost, merely re‐
70 moved from the stack.
71
72 move_panel
73 move_panel(pan,starty,startx) moves the given panel pan's window so
74 that its upper-left corner is at starty, startx. It does not change
75 the position of the panel in the stack. Be sure to use this function,
76 not mvwin(3X), to move a panel window.
77
78 new_panel
79 new_panel(win) allocates a PANEL structure, associates it with win,
80 places the panel on the top of the stack (causes it to be displayed
81 above any other panel) and returns a pointer to the new panel.
82
83 panel_above
84 panel_above(pan) returns a pointer to the panel above pan. If the
85 panel argument is (PANEL *)0, it returns a pointer to the bottom panel
86 in the stack.
87
88 panel_below
89 panel_below(pan) returns a pointer to the panel just below pan. If the
90 panel argument is (PANEL *)0, it returns a pointer to the top panel in
91 the stack.
92
93 panel_hidden
94 panel_hidden(pan) returns TRUE if the panel pan is in the panel stack,
95 FALSE if it is not. If the panel is a null pointer, return ERR.
96
97 panel_userptr
98 panel_userptr(pan) returns the user pointer for a given panel pan.
99
100 panel_window
101 panel_window(pan) returns a pointer to the window of the given panel
102 pan.
103
104 replace_panel
105 replace_panel(pan,window) replaces the current window of panel pan with
106 window This is useful, for example if you want to resize a panel. In
107 ncurses, you can call replace_panel to resize a panel using a window
108 resized with wresize(3X). It does not change the position of the panel
109 in the stack.
110
111 set_panel_userptr
112 set_panel_userptr(pan,ptr) sets the panel's user pointer.
113
114 show_panel
115 show_panel(pan) makes a hidden panel visible by placing it on top of
116 the panels in the panel stack. See COMPATIBILITY below.
117
118 top_panel
119 top_panel(pan) puts the given visible panel pan on top of all panels in
120 the stack. See COMPATIBILITY below.
121
122 update_panels
123 update_panels() refreshes the virtual screen to reflect the relations
124 between the panels in the stack, but does not call doupdate(3X) to re‐
125 fresh the physical screen. Use this function and not wrefresh(3X) or
126 wnoutrefresh(3X).
127
128 update_panels may be called more than once before a call to doupdate,
129 but doupdate is the function responsible for updating the physical
130 screen.
131
133 Each routine that returns a pointer returns NULL if an error occurs.
134 Each routine that returns an int value returns OK if it executes suc‐
135 cessfully and ERR if not.
136
137 Except as noted, the pan and window parameters must be non-null. If
138 those are null, an error is returned.
139
140 The move_panel function uses mvwin(3X), and will return an error if
141 mvwin returns an error.
142
144 Reasonable care has been taken to ensure compatibility with the na‐
145 tive panel facility introduced in System V (inspection of the SVr4
146 manual pages suggests the programming interface is unchanged). The
147 PANEL data structures are merely similar. The programmer is cau‐
148 tioned not to directly use PANEL fields.
149
150 The functions show_panel and top_panel are identical in this implemen‐
151 tation, and work equally well with displayed or hidden panels. In the
152 native System V implementation, show_panel is intended for making a
153 hidden panel visible (at the top of the stack) and top_panel is in‐
154 tended for making an already-visible panel move to the top of the
155 stack. You are cautioned to use the correct function to ensure compat‐
156 ibility with native panel libraries.
157
159 In your library list, libpanel.a should be before libncurses.a; that
160 is, you should say “-lpanel -lncurses”, not the other way around (which
161 would give a link-error with static libraries).
162
164 The panel facility was documented in SVr4.2 in Character User Interface
165 Programming (UNIX SVR4.2).
166
167 It is not part of X/Open Curses.
168
169 A few implementations exist:
170
171 • Systems based on SVr4 source code, e.g., Solaris, provide this li‐
172 brary.
173
174 • ncurses (since version 0.6 in 1993) and PDCurses (since version 2.2
175 in 1995) provide a panel library whose common ancestor was a public
176 domain implementation by Warren Tucker published in u386mon 2.20
177 (1990).
178
179 According to Tucker, the SystemV panel library was first released
180 in SVr3.2 (1988), and his implementation helped with a port to
181 SVr3.1 (1987).
182
183 Several developers have improved each of these; they are no longer
184 the same as Tucker's implementation.
185
186 • NetBSD 8 (2018) has a panel library begun by Valery Ushakov in
187 2015. This is based on the AT&T documentation.
188
190 panel.h interface for the panels library
191
192 libpanel.a the panels library itself
193
195 curses(3X), curs_variables(3X),
196
197 This describes ncurses version 6.4 (patch 20230114).
198
200 Originally written by Warren Tucker <wht@n4hgf.mt-park.ga.us>, primar‐
201 ily to assist in porting u386mon to systems without a native panels li‐
202 brary.
203
204 Repackaged for ncurses by Zeyd ben-Halim.
205
206 Juergen Pfeifer and Thomas E. Dickey revised/improved the library.
207
208
209
210 panel(3X)