1 /* $Id: ptest.c,v 1.24 2008/07/13 16:08:17 wmcbrine Exp $ */
7 PANEL
*p1
, *p2
, *p3
, *p4
, *p5
;
14 "test ", "TEST ", "(**) ", "*()* ", "<--> ", "LAST "
29 for (y
= 0; y
< LINES
- 1; y
++)
30 for (x
= 0; x
< COLS
; x
++)
31 printw("%d", (y
+ x
) % 10);
34 void wait_a_while(long msec
)
50 void saywhat(const char *text
)
52 mvprintw(LINES
- 1, 0, "%-20.20s", text
);
55 /* mkpanel - alloc a win and panel and associate them */
57 PANEL
*mkpanel(int rows
, int cols
, int tly
, int tlx
)
59 WINDOW
*win
= newwin(rows
, cols
, tly
, tlx
);
60 PANEL
*pan
= (PANEL
*)0;
73 void rmpanel(PANEL
*pan
)
75 WINDOW
*win
= pan
->win
;
81 void fill_panel(PANEL
*pan
)
83 WINDOW
*win
= pan
->win
;
84 char num
= *((char *)pan
->user
+ 1);
88 mvwprintw(win
, 1, 1, "-pan%c-", num
);
89 getmaxyx(win
, maxy
, maxx
);
91 for (y
= 2; y
< maxy
- 1; y
++)
92 for (x
= 1; x
< maxx
- 1; x
++)
93 mvwaddch(win
, y
, x
, num
);
96 int main(int argc
, char **argv
)
100 if (argc
> 1 && atol(argv
[1]))
101 nap_msec
= atol(argv
[1]);
104 Xinitscr(argc
, argv
);
110 for (y
= 0; y
< 5; y
++)
112 p1
= mkpanel(10, 10, 0, 0);
113 set_panel_userptr(p1
, "p1");
115 p2
= mkpanel(14, 14, 5, 5);
116 set_panel_userptr(p2
, "p2");
118 p3
= mkpanel(6, 8, 12, 12);
119 set_panel_userptr(p3
, "p3");
121 p4
= mkpanel(10, 10, 10, 30);
122 w4
= panel_window(p4
);
123 set_panel_userptr(p4
, "p4");
125 p5
= mkpanel(10, 10, 13, 37);
126 w5
= panel_window(p5
);
127 set_panel_userptr(p5
, "p5");
137 wait_a_while(nap_msec
);
139 saywhat("h3 s1 s2 s4 s5;");
140 move_panel(p1
, 0, 0);
147 wait_a_while(nap_msec
);
152 wait_a_while(nap_msec
);
157 wait_a_while(nap_msec
);
160 move_panel(p2
, 10, 10);
162 wait_a_while(nap_msec
);
167 wait_a_while(nap_msec
);
170 move_panel(p3
, 5, 5);
172 wait_a_while(nap_msec
);
177 wait_a_while(nap_msec
);
182 wait_a_while(nap_msec
);
187 wait_a_while(nap_msec
);
192 wait_a_while(nap_msec
);
197 wait_a_while(nap_msec
);
202 wait_a_while(nap_msec
);
207 wait_a_while(nap_msec
);
212 wait_a_while(nap_msec
);
214 for (itmp
= 0; itmp
< 6; itmp
++)
217 mvwaddstr(w4
, 3, 1, mod
[itmp
]);
218 move_panel(p4
, 4, itmp
* 10);
219 mvwaddstr(w5
, 4, 1, mod
[itmp
]);
221 wait_a_while(nap_msec
);
224 mvwaddstr(w4
, 4, 1, mod
[itmp
]);
225 move_panel(p5
, 7, itmp
* 10 + 6);
226 mvwaddstr(w5
, 3, 1, mod
[itmp
]);
228 wait_a_while(nap_msec
);
232 move_panel(p4
, 4, itmp
* 10);
234 wait_a_while(nap_msec
);
239 wait_a_while(nap_msec
);
244 wait_a_while(nap_msec
);
249 wait_a_while(nap_msec
);
254 wait_a_while(nap_msec
);
259 wait_a_while(nap_msec
);
264 wait_a_while(nap_msec
);
269 wait_a_while(nap_msec
);
274 wait_a_while(nap_msec
);