diff options
Diffstat (limited to 'ycurses/src/examples/example2.cpp')
| -rw-r--r-- | ycurses/src/examples/example2.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/ycurses/src/examples/example2.cpp b/ycurses/src/examples/example2.cpp new file mode 100644 index 0000000..c93d79c --- /dev/null +++ b/ycurses/src/examples/example2.cpp @@ -0,0 +1,52 @@ +#include "example2.h" + +int example2() +{ + curses cur; + cursor::set_invisible(); + + window win_root(root); + win_root.print(1, 1, "Press any key to continue..."); + + coordinate coord(2, 0);; + + window win1(10, 40, coord); + window win2(10, 40, coord.displace(3, 6)); + window win3(10, 40, coord.displace(3, 6)); + + win1.print(1, 1, "window 1"); + win2.print(1, 1, "window 2"); + win3.print(1, 1, "window 3"); + + /* Initialize pwindows. */ + pwindow pwindow1(win1); + pwindow pwindow2(win2); + pwindow pwindow3(win3); + + + /* Remove pwindow3, pwindow3 doesnt contain a valid pwindow any more! + * DONT USE THIS OBJECT AGAIN until re-init!!! + */ + pwindow3.remove(); + + /* Re-init a new pwindow, using the old variable. Now the object + * can be used again. + */ + pwindow3.reinit(win3); + cur.pause(); + + /* Remove the center pwindow. */ + pwindow2.remove(); + win3.print(2, 1, "pwindow 2 removed!"); + cur.pause(); + + win1.print(2, 1, "Some text!"); + cur.pause(); + + pwindow3.remove(); + win1.print(3, 1, "pwindow 3 removed!"); + cur.pause(); + + return 0; +} + |
