2017-11-17 19:27:24 +00:00
|
|
|
# Cursive Examples
|
|
|
|
|
|
|
|
Here are example programs using Cursive to help you getting familiar with the
|
|
|
|
various aspects of the library.
|
|
|
|
|
|
|
|
To run an example, use `cargo run --example EXAMPLE_NAME`.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`hello_world`](hello_world.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
Simplest example possible, it will show you the starting point of a basic
|
|
|
|
Cursive application.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`dialog`](dialog.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This example wraps the text in a `Dialog` view, showing the basic idea of view
|
|
|
|
composition.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`lorem`](lorem.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This example loads a large text file to show scrolling behaviour. It also
|
|
|
|
includes greek and japanese characters to show non-ascii support.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`edit`](edit.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
Here we have an `EditView` to get input from the user, and use that input in
|
|
|
|
the next view. It shows how to identify a view with an ID and refer to it
|
|
|
|
later.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`mutation`](mutation.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This example modifies the content of an existing view.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`linear`](linear.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This example uses a `LinearView` to put multiple views side-by-side.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`menubar`](menubar.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
Here we learn how to create a menubar at the top of the screen, and populate
|
|
|
|
it with static and dynamic entried.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`logs`](logs.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This example defines a custom view to display asynchronous input from a
|
|
|
|
channel.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`key_codes`](key_codes.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This example uses a custom view to print any input received. Can be used as a
|
|
|
|
debugging tool to see what input the application is receiving.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`select`](select.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This example uses a `SelectView` to have the user pick a city from a long list.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`list_view`](list_view.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This shows a use of a `ListView`, used to build simple forms.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`text_area`](text_area.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This example uses a `TextArea`, where the user can input a block of text.
|
|
|
|
|
2018-01-18 18:32:08 +00:00
|
|
|
## [`markup`](markup.rs)
|
|
|
|
|
|
|
|
This example prints a text with markup decorations.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`theme`](theme.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This loads a theme file at runtime to change default colors.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`theme_manual`](theme_manual.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
Instead of loading a theme file, this manually sets various theme settings.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`terminal_default`](terminal_default.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This example shows the effect of the `Color::TerminalDefault` setting.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`colors`](colors.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This example draws a colorful square to show off true color support.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`refcell_view`](refcell_view.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
Here we show how to access multiple views concurently through their IDs.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`progress`](progress.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This shows how to send information from an asynchronous task (like a download
|
|
|
|
or slow computation) to update a progress bar.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`radio`](radio.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This shows how to use `RadioGroup` and `RadioButton`.
|
|
|
|
|
2017-11-17 22:28:18 +00:00
|
|
|
## [`slider`](slider.rs)
|
2017-11-17 19:27:24 +00:00
|
|
|
|
|
|
|
This is a demonstration of the `SliderView`.
|
2018-01-18 18:32:08 +00:00
|
|
|
|
|
|
|
## [`mines`](mines) (**Work in progress**)
|
|
|
|
|
|
|
|
A larger example showing an implementation of minesweeper.
|