Added doc for event module

This commit is contained in:
Alexandre Bury 2016-07-14 23:25:32 -07:00
parent 2ed8552e4b
commit 1010c825ae
2 changed files with 30 additions and 1 deletions

View File

@ -1,4 +1,17 @@
//! User-input events and their effects. //! User-input events and their effects.
//!
//! * Every user input the application receives is converted to an
//! [`Event`](./enum.Event.html).
//! * Each event is then given to the root, and descends the view tree down to
//! the view currently in focus, through the
//! [`on_event`](../view/trait.View.html#method.on_event) method.
//! * If the view consumes the event, it may return a callback to be
//! executed.
//! * Otherwise, it ignores the event, and the view parent can in turn
//! choose to consume it or not.
//! * If no view consumes the event, the
//! [global callback](../struct.Cursive.html#method.add_global_callback)
//! table is checked.
use std::rc::Rc; use std::rc::Rc;

View File

@ -13,7 +13,23 @@
//! * Finally, the event loop is started by calling //! * Finally, the event loop is started by calling
//! [`Cursive::run(&mut self)`](struct.Cursive.html#method.run). //! [`Cursive::run(&mut self)`](struct.Cursive.html#method.run).
//! //!
//! ## Example //! ## Views
//!
//! Views are the main components of a cursive interface.
//! The [`view`](./view/index.html) module contains many views to use in your
//! application; if you don't find what you need, you may also implement the
//! [`View`](view/trait.View.html) trait and build your own.
//!
//! ## Callbacks
//!
//! Cursive is a *reactive* UI: it *reacts* to events generated by user input.
//!
//! During the declarative phase, callbacks are set to trigger on specific
//! events. These functions usually take a `&mut Cursive` argument, allowing
//! them to modify the view tree at will.
//!
//! ## Examples
//!
//! ```no_run //! ```no_run
//! extern crate cursive; //! extern crate cursive;
//! //!