/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1995-1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* LINTLIBRARY */
/*
* newwin.c
*
* XCurses Library
*
* Copyright 1990, 1995 by Mortice Kern Systems. All rights reserved.
*
*/
#ifdef M_RCSID
#ifndef lint
static char rcsID[] =
"$Header: /team/ps/sun_xcurses/archive/local_changes/xcurses/src/lib/"
"cbates Exp $";
#endif
#endif
#include <private.h>
#include <stdlib.h>
/*
* Create and return a pointer to a new window or pad.
*
* For a window, provide the dimensions and location of the upper
* left hand corner of the window. If either dimension is zero (0)
* then the default sizes will be LINES-begy and COLS-begx.
*
* For a pad, provide the dimensions and -1 for begy and begx.
* If either dimension is zero (0) then the default sizes will be
* LINES and COLS.
*
* If parent is not null, then create a sub-window of the parent
* window.
*/
WINDOW *
{
WINDOW *w;
int isPad;
/* Check for default dimensions. */
if (nlines == 0) {
if (0 <= begy)
}
if (ncols == 0) {
if (0 <= begx)
}
} else {
/*
* Make sure window dimensions remain within parent's
* window so that the new subwindow is a proper subset
* of the parent.
*/
goto error_1;
/*
* If either dimension is zero (0), use the max size
* for the dimension from the parent window less the
* subwindow's starting location.
*/
if (nlines == 0)
if (ncols == 0)
}
if (!isPad) {
/* Check that a window fits on the screen. */
if (0 <= begy) {
goto error_1;
}
}
if (0 <= begx) {
goto error_1;
}
}
}
if (w == NULL)
goto error_1;
sizeof (*w->_first));
goto error_2;
goto error_2;
/* Window rendition. */
sizeof (*w->_base));
goto error_2;
for (y = 0; y < nlines; y++) {
if (y)
for (x = 0; x < ncols; ++x) {
}
}
} else {
/*
* The new window's origin (0,0) maps to (begy, begx) in the
* parent's window. In effect, subwin() is a method by which
* a portion of a parent's window can be addressed using a
* (0,0) origin.
*/
for (y = 0; y < nlines; ++y)
}
/* Software scroll region. */
w->_top = 0;
w->_scroll = 0;
/* Window initially blocks for input. */
w->_vmin = 1;
w->_vtime = 0;
w->_flags = W_USE_TIMEOUT;
/* Determine window properties. */
if (isPad) {
/* This window is a PAD */
/* Child of a normal window */
/*
* Map to upper left portion of
* display by default (???)
*/
}
/* Writing to last column should trigger auto-margin wrap. */
w->_flags |= W_END_LINE;
if (begx == 0) {
w->_flags |= W_FULL_LINE;
w->_flags |= W_FULL_WINDOW;
}
/* Will writing to bottom-right triggers scroll? */
w->_flags |= W_SCROLL_WINDOW;
}
/* Initial screen clear for full screen windows only. */
if (w->_flags & W_FULL_WINDOW) {
w->_flags |= W_CLEAR_WINDOW;
/* Reset dirty region markers. */
} else {
if (!parent) {
/* Do not erase sub windows */
(void) werase(w);
}
}
return (w);
(void) delwin(w);
return (NULL);
}
int
{
if (w == NULL)
return (OK);
}
free(w);
return (OK);
}
WINDOW *
{
WINDOW *w;
return (NULL);
/* Absolute screen address. */
return (w);
}
WINDOW *
{
WINDOW *w;
return (w);
}
WINDOW *
{
WINDOW *w;
return (NULL);
return (w);
}