Crate cursive [−] [src]
Cursive
Cursive is a TUI library built on top of ncurses-rs. It allows to easily build layouts for text-based applications.
Getting started
- Every application should start with a
Cursive
object. It is the main entry-point to the library. - A declarative phase then describes the structure of the UI by adding views and configuring their behaviours.
- Finally, the event loop is started by calling
Cursive::run(&mut self)
.
Example
extern crate cursive; use cursive::Cursive; use cursive::view::TextView; fn main() { let mut siv = Cursive::new(); siv.add_layer(TextView::new("Hello World!\nPress q to quit.")); siv.add_global_callback('q', |s| s.quit()); siv.run(); }
Modules
align |
Tools to control view alignment |
direction |
Direction-related structures. |
event |
User-input events and their effects. |
menu |
Module to build menus. |
theme |
Module to handle colors and themes in the UI. |
vec |
Points on the 2D character grid. |
view |
Defines various views to use when creating the layout. |
Macros
wrap_impl! |
Convenient macro to implement the ViewWrapper trait. |
Structs
Cursive |
Central part of the cursive library. |
Printer |
Convenient interface to draw on a subset of the screen. |
XY |
A generic structure with a value for each axis. |
Type Definitions
ScreenId |
Identifies a screen in the cursive ROOT. |