summaryrefslogtreecommitdiff
path: root/lib/libcurses/curs_window.3
blob: 9bd3facd818ae74fd987d9cf89a48f4684e9cbad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
.TH curs_window 3X ""
.SH NAME
\fBnewwin\fR, \fBdelwin\fR, \fBmvwin\fR,
\fBsubwin\fR, \fBderwin\fR, \fBmvderwin\fR, \fBdupwin\fR,
\fBwsyncup\fR, \fBsyncok\fR, \fBwcursyncup\fR, \fBwsyncdown\fR -
create \fBcurses\fR windows
.SH SYNOPSIS
\fB#include <curses.h>\fR

\fBWINDOW *newwin(int nlines, int ncols, int begin_y,\fR
      \fBintbegin_x);\fR
.br
\fBint delwin(WINDOW *win);\fR
.br
\fBint mvwin(WINDOW *win, int y, int x);\fR
.br
\fBWINDOW *subwin(WINDOW *orig, int nlines, int ncols,
      int begin_y, int begin_x);\fR
.br
\fBWINDOW *derwin(WINDOW *orig, int nlines, int ncols,
      int begin_y, int begin_x);\fR
.br
\fBint mvderwin(WINDOW *win, int par_y, int par_x);\fR
.br
\fBWINDOW *dupwin(WINDOW *win);\fR
.br
\fBvoid wsyncup(WINDOW *win);\fR
.br
\fBint syncok(WINDOW *win, bool bf);\fR
.br
\fBvoid wcursyncup(WINDOW *win);\fR
.br
\fBvoid wsyncdown(WINDOW *win);\fR
.br
.SH DESCRIPTION
Calling \fBnewwin\fR creates and returns a pointer to a new window with the
given number of lines and columns.  The upper left-hand corner of the window is
at line \fIbegin\fR_\fIy\fR, column \fIbegin\fR_\fIx\fR.  If either
\fInlines\fR or \fIncols\fR is zero, they default to \fBLINES -\fR
\fIbegin\fR_\fIy\fR and \fBCOLS -\fR \fIbegin\fR_\fIx\fR.  A new full-screen
window is created by calling \fBnewwin(0,0,0,0)\fR.

Calling \fBdelwin\fR deletes the named window, freeing all memory
associated with it (it does not actually erase the window's screen
image).  Subwindows must be deleted before the main window can be
deleted.

Calling \fBmvwin\fR moves the window so that the upper left-hand
corner is at position (\fIx\fR, \fIy\fR).  If the move would cause the
window to be off the screen, it is an error and the window is not
moved.  Moving subwindows is allowed, but should be avoided.

Calling \fBsubwin\fR creates and returns a pointer to a new window
with the given number of lines, \fInlines\fR, and columns,
\fIncols\fR.  The window is at position (\fIbegin\fR_\fIy\fR,
\fIbegin\fR_\fIx\fR) on the screen.  (This position is relative to the
screen, and not to the window \fIorig\fR.)  The window is made in the
middle of the window \fIorig\fR, so that changes made to one window
will affect both windows.  The subwindow shares memory with the window
\fIorig\fR.  When using this routine, it is necessary to call
\fBtouchwin\fR or \fBtouchline\fR on \fIorig\fR before calling
\fBwrefresh\fR on the subwindow.

Calling \fBderwin\fR is the same as calling \fBsubwin,\fR except that
\fIbegin\fR_\fIy\fR and \fIbegin\fR_\fIx\fR are relative to the origin
of the window \fIorig\fR rather than the screen.  There is no
difference between the subwindows and the derived windows.

Calling \fBmvderwin\fR moves a derived window (or subwindow)
inside its parent window.  The screen-relative parameters of the
window are not changed.  This routine is used to display different
parts of the parent window at the same physical position on the
screen.

Calling \fBdupwin\fR creates an exact duplicate of the window \fIwin\fR.

Calling \fBwsyncup\fR touches all locations in ancestors of \fIwin\fR that are
changed in \fIwin\fR.  If \fBsyncok\fR is called with second argument
\fBTRUE\fR then \fBwsyncup\fR is called automatically whenever there is a
change in the window.

The \fBwsyncdown\fR routine touches each location in \fIwin\fR that has been
touched in any of its ancestor windows.  This routine is called by
\fBwrefresh\fR, so it should almost never be necessary to call it manually.

The routine \fBwcursyncup\fR updates the current cursor position of all the
ancestors of the window to reflect the current cursor position of the
window.
.SH RETURN VALUE
Routines that return an integer return the integer \fBERR\fR upon failure and
\fBOK\fR (SVr4 only specifies "an integer value other than \fBERR\fR") upon
successful completion.

\fBdelwin\fR returns the integer \fBERR\fR upon failure and \fBOK\fR
upon successful completion.

Routines that return pointers return \fBNULL\fR on error.
.SH NOTES
If many small changes are made to the window, the \fBwsyncup\fR option could
degrade performance.

Note that \fBsyncok\fR may be a macro.
.SH BUGS
The subwindow functions (\fIsubwin\fR, \fIderwin\fR, \fImvderwin\fR,
\fBwsyncup\fR, \fBwsyncdown\fR, \fBwcursyncup\fR, \fBsyncok\fR) are flaky,
incompletely implemented, and not well tested.

The System V curses documentation is very unclear about what \fBwsyncup\fR
and \fBwsyncdown\fR actually do.  It seems to imply that they are only 
supposed to touch exactly those lines that are affected by ancestor changes.
The language here, and the behavior of the \fBcurses\fR implementation,
is patterned on the XPG4 curses standard.  The weaker XPG4 spec may result
in slower updates.
.SH PORTABILITY
The XSI Curses standard, Issue 4 describes these functions.
.SH SEE ALSO
\fBcurses\fR(3X), \fBcurs_refresh\fR(3X), \fBcurs_touch\fR(3X)
.\"#
.\"# The following sets edit modes for GNU EMACS
.\"# Local Variables:
.\"# mode:nroff
.\"# fill-column:79
.\"# End: