2 .\" Copyright (c) 1990, 1995 by Mortice Kern Systems Inc. All Rights Reserved Portions Copyright (c) 1999, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH OVERLAY 3XCURSES "Jun 5, 2002"
8 overlay, overwrite \- copy overlapped windows
12 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-I\fR /usr/xpg4/include \fB -L \fR /usr/xpg4/lib \e
13 \fB -R \fR /usr/xpg4/lib \fB -lcurses \fR [ \fIlibrary\fR... ]
15 \fBc89\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lcurses\fR [ \fIlibrary\fR... ]
19 \fBint\fR \fBoverlay\fR(\fBconst WINDOW *\fR\fIsrcwin\fR, \fBWINDOW *\fR\fIdstwin\fR);
24 \fBint\fR \fBoverwrite\fR(\fBconst WINDOW *\fR\fIsrcwin\fR, \fBWINDOW *\fR\fIdstwin\fR);
34 Is a pointer to the source window to be copied.
43 Is a pointer to the destination window to be overlayed or overwritten.
49 The \fBoverwrite()\fR and \fBoverlay()\fR functions overlay \fIsrcwin\fR on top
50 of \fIdestwin\fR. The \fIsrcwin\fR and \fIdstwin\fR arguments do not have to be
51 the same size; only text where the two windows overlap is copied.
54 The \fBoverwrite()\fR function copies characters as though a sequence of
55 \fBwin_wch\fR(3XCURSES) and \fBwadd_wch\fR(3XCURSES) were performed with the
56 destination window's attributes and background attributes cleared.
59 The \fBoverlay()\fR function does the same thing, except that, whenever a
60 character to be copied is the background character of the source window,
61 \fBoverlay()\fR does not copy the character but merely moves the destination
62 cursor the width of the source background character.
65 If any portion of the overlaying window border is not the first column of a
66 multi-column character, then all the column positions will be replaced with the
67 background character and rendition before the overlay is done. If the default
68 background character is a multi-column character when this occurs, then these
73 Upon successful completion, these functions return \fBOK\fR. Otherwise, they
78 No errors are defined.
81 \fBExample 1 \fRImplement a pop-up dialog
84 The following example demonstrates the use of \fBoverwrite()\fR to implement a
92 * Pop-up a window on top of curscr. If row and/or col
93 * are -1 then that dimension will be centered within
94 * curscr. Return 0 for success or -1 if malloc(\|) failed.
95 * Pass back the working window and the saved window for the
96 * pop-up. The saved window should not be modified.
99 popup(work, save, nrows, ncols, row, col)
100 WINDOW **work, **save;
101 int nrows, ncols, row, col;
104 getmaxyx(curscr, mr, mc);
105 /* Windows are limited to the size of curscr. */
110 /* Center dimensions. */
115 /* The window must fit entirely in curscr. */
120 *work = newwin(nrows, ncols, row, col);
123 if ((*save = dupwin(*work)) == NULL) {
127 overwrite(curscr, *save);
131 * Restore the region covered by a pop-up window.
132 * Delete the working window and the saved window.
133 * This function is the complement to popup(\|). Return
134 * 0 for success or -1 for an error.
140 (void) wnoutrefresh(save);
146 * Compute the size of a dialog box that would fit around
150 dialsize(str, nrows, ncols)
155 for (rows = 1, cols = col = 0; *str != '\e0'; ++str) {
171 * Write a string into a dialog box.
179 (void) wmove(w, 1, 1);
180 for (row = 1; *s != '\e0'; ++s) {
181 (void) waddch(w, *((unsigned char*) s));
192 int nrows, ncols, row, col;
193 /* Figure out size of window. */
194 dialsize(str, &nrows, &ncols);
195 /* Create a centered working window with extra */
196 /* room for a border. */
197 (void) popup(&work, &save, nrows+2, ncols+2, -1, -1);
198 /* Write text into the working window. */
200 /* Pause. Remember that wgetch(\|) will do a wrefresh(\|) */
203 /* Restore curscr and free windows. */
204 (void) popdown(work, save);
205 /* Redraw curscr to remove window from physical screen. */
214 See \fBattributes\fR(5) for descriptions of the following attributes:
222 ATTRIBUTE TYPE ATTRIBUTE VALUE
224 Interface Stability Standard
232 \fBcopywin\fR(3XCURSES), \fBlibcurses\fR(3XCURSES), \fBwadd_wch\fR(3XCURSES),
233 \fBwin_wch\fR(3XCURSES), \fBattributes\fR(5), \fBstandards\fR(5)