#ncurses #TUI

ncursesw-win

An extension wrapper around the ncursesw TUI library (ncurses)

11 unstable releases (3 breaking)

✓ Uses Rust 2018 edition

0.4.0 Dec 9, 2019
0.3.1 Nov 7, 2019
0.2.1 Oct 25, 2019
0.1.5 Oct 14, 2019
0.1.4 Jul 13, 2019

#85 in Command-line interface

Download history 10/week @ 2019-10-05 25/week @ 2019-10-12 32/week @ 2019-10-19 87/week @ 2019-10-26 57/week @ 2019-11-02 8/week @ 2019-11-09 22/week @ 2019-11-16 20/week @ 2019-11-23 20/week @ 2019-11-30 74/week @ 2019-12-07 2/week @ 2019-12-14 1/week @ 2019-12-21 11/week @ 2019-12-28 10/week @ 2020-01-04 102/week @ 2020-01-11

127 downloads per month

MIT license

340KB
4K SLoC

ncursesw-win Build Status Crates.io

This is a wrapper crate around the ncursesw crate, it's purpose is too abstracts away the raw pointers that NCurses uses and function in a more safe way, however a knowledge of how NCurses works is advised to use the true power of this library.

Please see the README.md for ncursesw for more details.

Inclusion

[dependencies]
ncursesw-win = "0.4"

Or to use the latest git version

[dependencies]
ncursesw-win = { git = "https://github.com/narfit66/ncursesw-win-rs" }

Building

The compiled library will be built in the target directory.

cargo build

How to Use

extern crate ncurseswwin;

use ncurseswwin::*;

To use attributes and color pairs

use ncurseswwin::normal::*; // for 'ansi' color pairs and attributes...
use ncurseswwin::extend::*; // or for 'extended' color pairs and attributes.

To use menus

use ncurseswwin::menu::*;

Instead of calling initscr() and endwin() to initialise and teardown the NCurses library (these can still be called as the ncursesw crate is public) use the ncursesw_entry(). This initialises and tears down NCurses and provided the ability to catch panics in a controlled maner by passing them back to the client code as the error type NCurseswWinError::Panic { message }.

To create a window use Window::new() which will teardown correctly when going out of scope and provides all NCurses functionality associatiated with a NCurses window. Likewise a pad is created using Pad::new() and a panel using Panel::new().

All NCurses methods associated with a Window, Pad or RipoffWindow use either their original ncurses name or where specificlly passed the pointer _win_st the 'w' has been removed, for example the ncurses 'C' function wget_wch(*WINDOW) has become the method self.get_wch().

The NCurses ripoff and mouse features are encapsulated, please see example code for how to use these features.

Examples

Examples are built by cargo build --examples. To run them, use cargo run --example <EXAMPLE>.

Current examples are Safe Initialisation/Calling Of NCurses (ncursesw_entry-test), Ansi Border Drawing (border-test), Unicode Border Drawing (border_set-test), Unicode Box Drawing (box_drawing-test), Mouse Events (mouse-test), Ripoff Lines (ripoff-test), Non-Blocking Get (getch_nonblocking-test) and Menu (menu-test).

Documentation

Please use cargo doc --open for this crate for the time being!.

License

Licensed under the MIT license, see LICENSE

Dependencies

~1.9–3.5MB
~69K SLoC