Add support for modal usage of ncurses windows

Fixes #25.

I think I've got the logic working here and I've tested it to the extent I can by hand. If there's a test suite or something similar I should run, please let me know.

Thanks.