1curs_window(3CURSES) Curses Library Functions curs_window(3CURSES)
2
3
4
6 curs_window, newwin, delwin, mvwin, subwin, derwin, mvderwin, dupwin,
7 wsyncup, syncok, wcursyncup, wsyncdown - create curses windows
8
10 cc [ flag ... ] file ... -lcurses [ library ... ]
11 #include <curses.h>
12
13 WINDOW *newwin(int nlines, int ncols, int begin_y, int begin_x);
14
15
16 int delwin(WINDOW *win);
17
18
19 int mvwin(WINDOW *win, int y, int x);
20
21
22 WINDOW *subwin(WINDOW *orig, int nlines, int ncols,
23 int begin_y, int begin_x);
24
25
26 WINDOW *derwin(WINDOW *orig, int nlines, int ncols,
27 int begin_y, int begin_x);
28
29
30 int mvderwin(WINDOW *win, int par_y, int par_x);
31
32
33 WINDOW *dupwin(WINDOW *win);
34
35
36 void wsyncup(WINDOW *win);
37
38
39 int syncok(WINDOW *win, bool bf);
40
41
42 void wcursyncup(WINDOW *win);
43
44
45 void wsyncdown(WINDOW *win);
46
47
49 The newwin() routine creates and returns a pointer to a new window with
50 the given number of lines, nlines, and columns, ncols. The upper left-
51 hand corner of the window is at line begin_y, column begin_x. If either
52 nlines or ncols is zero, they default to LINES — begin_y and COLS —
53 begin_x. A new full-screen window is created by calling
54 newwin(0,0,0,0).
55
56
57 The delwin() routine deletes the named window, freeing all memory asso‐
58 ciated with it. Subwindows must be deleted before the main window can
59 be deleted.
60
61
62 The mvwin() routine moves the window so that the upper left-hand corner
63 is at position (x, y). If the move would cause the window to be off the
64 screen, it is an error and the window is not moved. Moving subwindows
65 is allowed, but should be avoided.
66
67
68 The subwin() routine creates and returns a pointer to a new window with
69 the given number of lines, nlines, and columns, ncols. The window is at
70 position (begin_y, begin_x) on the screen. (This position is relative
71 to the screen, and not to the window orig.) The window is made in the
72 middle of the window orig, so that changes made to one window will
73 affect both windows. The subwindow shares memory with the window orig.
74 When using this routine, it is necessary to call touchwin() or touch‐
75 line() on orig before calling wrefresh() on the subwindow.
76
77
78 The derwin() routine is the same as subwin(), except that begin_y and
79 begin_x are relative to the origin of the window orig rather than the
80 screen. There is no difference between the subwindows and the derived
81 windows.
82
83
84 The mvderwin() routine moves a derived window (or subwindow) inside its
85 parent window. The screen-relative parameters of the window are not
86 changed. This routine is used to display different parts of the parent
87 window at the same physical position on the screen.
88
89
90 The dupwin() routine creates an exact duplicate of the window win.
91
92
93 Each curses window maintains two data structures: the character image
94 structure and the status structure. The character image structure is
95 shared among all windows in the window hierarchy (that is, the window
96 with all subwindows). The status structure, which contains information
97 about individual line changes in the window, is private to each window.
98 The routine wrefresh() uses the status data structure when performing
99 screen updating. Since status structures are not shared, changes made
100 to one window in the hierarchy may not be properly reflected on the
101 screen.
102
103
104 The routine wsyncup() causes the changes in the status structure of a
105 window to be reflected in the status structures of its ancestors. If
106 syncok() is called with second argument TRUE then wsyncup() is called
107 automatically whenever there is a change in the window.
108
109
110 The routine wcursyncup() updates the current cursor position of all the
111 ancestors of the window to reflect the current cursor position of the
112 window.
113
114
115 The routine wsyncdown() updates the status structure of the window to
116 reflect the changes in the status structures of its ancestors. Applica‐
117 tions seldom call this routine because it is called automatically by
118 wrefresh().
119
121 Routines that return an integer return the integer ERR upon failure and
122 an integer value other than ERR upon successful completion.
123
124
125 delwin() returns the integer ERR upon failure and OK upon successful
126 completion.
127
128
129 Routines that return pointers return NULL on error.
130
132 See attributes(5) for descriptions of the following attributes:
133
134
135
136
137 ┌─────────────────────────────┬─────────────────────────────┐
138 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
139 ├─────────────────────────────┼─────────────────────────────┤
140 │MT-Level │Unsafe │
141 └─────────────────────────────┴─────────────────────────────┘
142
144 curs_refresh(3CURSES), curs_touch(3CURSES), curses(3CURSES),
145 attributes(5)
146
148 The header <curses.h> automatically includes the headers <stdio.h> and
149 <unctrl.h>.
150
151
152 If many small changes are made to the window, the wsyncup() option
153 could degrade performance.
154
155
156 Note that syncok() may be a macro.
157
158
159
160SunOS 5.11 31 Dec 1996 curs_window(3CURSES)