mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Update to Rust 2018
Run `cargo fix --edition` and update Cargo.toml
This commit is contained in:
parent
88d2fb1f46
commit
e51be07e5d
@ -10,6 +10,7 @@ name = "cursive"
|
|||||||
readme = "Readme.md"
|
readme = "Readme.md"
|
||||||
repository = "https://github.com/gyscos/Cursive"
|
repository = "https://github.com/gyscos/Cursive"
|
||||||
version = "0.10.1-alpha.0"
|
version = "0.10.1-alpha.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[badges.travis-ci]
|
[badges.travis-ci]
|
||||||
repository = "gyscos/Cursive"
|
repository = "gyscos/Cursive"
|
||||||
|
@ -13,10 +13,10 @@ use self::bear_lib_terminal::terminal::{
|
|||||||
};
|
};
|
||||||
use self::bear_lib_terminal::Color as BltColor;
|
use self::bear_lib_terminal::Color as BltColor;
|
||||||
|
|
||||||
use backend;
|
use crate::backend;
|
||||||
use event::{Event, Key, MouseButton, MouseEvent};
|
use crate::event::{Event, Key, MouseButton, MouseEvent};
|
||||||
use theme::{BaseColor, Color, ColorPair, Effect};
|
use crate::theme::{BaseColor, Color, ColorPair, Effect};
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
|
|
||||||
enum ColorRole {
|
enum ColorRole {
|
||||||
Foreground,
|
Foreground,
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use event::{Event, Key};
|
use crate::event::{Event, Key};
|
||||||
use theme::{BaseColor, Color, ColorPair};
|
use crate::theme::{BaseColor, Color, ColorPair};
|
||||||
|
|
||||||
#[cfg(feature = "ncurses-backend")]
|
#[cfg(feature = "ncurses-backend")]
|
||||||
pub mod n;
|
pub mod n;
|
||||||
|
@ -10,11 +10,11 @@ use std::io::Write;
|
|||||||
|
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
use backend;
|
use crate::backend;
|
||||||
use event::{Event, Key, MouseButton, MouseEvent};
|
use crate::event::{Event, Key, MouseButton, MouseEvent};
|
||||||
use theme::{Color, ColorPair, Effect};
|
use crate::theme::{Color, ColorPair, Effect};
|
||||||
use utf8;
|
use crate::utf8;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
|
|
||||||
use self::super::split_i32;
|
use self::super::split_i32;
|
||||||
use self::ncurses::mmask_t;
|
use self::ncurses::mmask_t;
|
||||||
|
@ -5,10 +5,10 @@ use std::cell::{Cell, RefCell};
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io::{stdout, Write};
|
use std::io::{stdout, Write};
|
||||||
|
|
||||||
use backend;
|
use crate::backend;
|
||||||
use event::{Event, Key, MouseButton, MouseEvent};
|
use crate::event::{Event, Key, MouseButton, MouseEvent};
|
||||||
use theme::{Color, ColorPair, Effect};
|
use crate::theme::{Color, ColorPair, Effect};
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
|
|
||||||
use self::pancurses::mmask_t;
|
use self::pancurses::mmask_t;
|
||||||
use super::split_i32;
|
use super::split_i32;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
//! Dummy backend
|
//! Dummy backend
|
||||||
|
|
||||||
use backend;
|
use crate::backend;
|
||||||
use event::Event;
|
use crate::event::Event;
|
||||||
use theme;
|
use crate::theme;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
|
|
||||||
/// Dummy backend that does nothing and immediately exits.
|
/// Dummy backend that does nothing and immediately exits.
|
||||||
///
|
///
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
//! using some common libraries. Each of those included backends needs a
|
//! using some common libraries. Each of those included backends needs a
|
||||||
//! corresonding feature to be enabled.
|
//! corresonding feature to be enabled.
|
||||||
|
|
||||||
use event::Event;
|
use crate::event::Event;
|
||||||
use theme;
|
use crate::theme;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
mod resize;
|
mod resize;
|
||||||
|
@ -16,10 +16,10 @@ use self::termion::screen::AlternateScreen;
|
|||||||
use self::termion::style as tstyle;
|
use self::termion::style as tstyle;
|
||||||
use crossbeam_channel::{self, Receiver};
|
use crossbeam_channel::{self, Receiver};
|
||||||
|
|
||||||
use backend;
|
use crate::backend;
|
||||||
use event::{Event, Key, MouseButton, MouseEvent};
|
use crate::event::{Event, Key, MouseButton, MouseEvent};
|
||||||
use theme;
|
use crate::theme;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
|
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
@ -5,14 +5,14 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use crossbeam_channel::{self, Receiver, Sender};
|
use crossbeam_channel::{self, Receiver, Sender};
|
||||||
|
|
||||||
use backend;
|
use crate::backend;
|
||||||
use direction;
|
use crate::direction;
|
||||||
use event::{Callback, Event, EventResult};
|
use crate::event::{Callback, Event, EventResult};
|
||||||
use printer::Printer;
|
use crate::printer::Printer;
|
||||||
use theme;
|
use crate::theme;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{self, Finder, IntoBoxedView, Position, View};
|
use crate::view::{self, Finder, IntoBoxedView, Position, View};
|
||||||
use views::{self, LayerPosition};
|
use crate::views::{self, LayerPosition};
|
||||||
|
|
||||||
static DEBUG_VIEW_ID: &'static str = "_cursive_debug_view";
|
static DEBUG_VIEW_ID: &'static str = "_cursive_debug_view";
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ pub type CbSink = Sender<Box<CbFunc>>;
|
|||||||
/// working and `FnBox` is unstable.
|
/// working and `FnBox` is unstable.
|
||||||
pub trait CbFunc: Send {
|
pub trait CbFunc: Send {
|
||||||
/// Calls the function.
|
/// Calls the function.
|
||||||
fn call_box(self: Box<Self>, &mut Cursive);
|
fn call_box(self: Box<Self>, _: &mut Cursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F: FnOnce(&mut Cursive) -> () + Send> CbFunc for F {
|
impl<F: FnOnce(&mut Cursive) -> () + Send> CbFunc for F {
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
//! `Tab` key would usually cycle focus in the "front" direction, while
|
//! `Tab` key would usually cycle focus in the "front" direction, while
|
||||||
//! using the arrow keys would use absolute directions instead.
|
//! using the arrow keys would use absolute directions instead.
|
||||||
|
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use XY;
|
use crate::XY;
|
||||||
|
|
||||||
/// Describes a vertical or horizontal orientation for a view.
|
/// Describes a vertical or horizontal orientation for a view.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
|
@ -17,8 +17,8 @@ use std::any::Any;
|
|||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use Cursive;
|
use crate::Cursive;
|
||||||
|
|
||||||
/// Callback is a function that can be triggered by an event.
|
/// Callback is a function that can be triggered by an event.
|
||||||
/// It has a mutable access to the cursive root.
|
/// It has a mutable access to the cursive root.
|
||||||
|
10
src/lib.rs
10
src/lib.rs
@ -129,8 +129,8 @@ mod utf8;
|
|||||||
|
|
||||||
pub mod backend;
|
pub mod backend;
|
||||||
|
|
||||||
pub use cursive::{CbFunc, CbSink, Cursive, ScreenId};
|
pub use crate::cursive::{CbFunc, CbSink, Cursive, ScreenId};
|
||||||
pub use printer::Printer;
|
pub use crate::printer::Printer;
|
||||||
pub use vec::Vec2;
|
pub use crate::vec::Vec2;
|
||||||
pub use with::With;
|
pub use crate::with::With;
|
||||||
pub use xy::XY;
|
pub use crate::xy::XY;
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
//!
|
//!
|
||||||
//! [menubar]: ../struct.Cursive.html#method.menubar
|
//! [menubar]: ../struct.Cursive.html#method.menubar
|
||||||
|
|
||||||
use event::Callback;
|
use crate::event::Callback;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use Cursive;
|
use crate::Cursive;
|
||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
/// Root of a menu tree.
|
/// Root of a menu tree.
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
//! Provide higher-level abstraction to draw things on backends.
|
//! Provide higher-level abstraction to draw things on backends.
|
||||||
|
|
||||||
use backend::Backend;
|
use crate::backend::Backend;
|
||||||
use direction::Orientation;
|
use crate::direction::Orientation;
|
||||||
use enumset::EnumSet;
|
use enumset::EnumSet;
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use theme::{BorderStyle, ColorStyle, Effect, PaletteColor, Style, Theme};
|
use crate::theme::{BorderStyle, ColorStyle, Effect, PaletteColor, Style, Theme};
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use utils::lines::simple::{prefix, suffix};
|
use crate::utils::lines::simple::{prefix, suffix};
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use with::With;
|
use crate::with::With;
|
||||||
|
|
||||||
/// Convenient interface to draw on a subset of the screen.
|
/// Convenient interface to draw on a subset of the screen.
|
||||||
///
|
///
|
||||||
@ -86,7 +86,7 @@ impl<'a, 'b> Printer<'a, 'b> {
|
|||||||
|
|
||||||
/// Prints some styled text at the given position.
|
/// Prints some styled text at the given position.
|
||||||
pub fn print_styled<S>(
|
pub fn print_styled<S>(
|
||||||
&self, start: S, text: ::utils::span::SpannedStr<'_, Style>,
|
&self, start: S, text: crate::utils::span::SpannedStr<'_, Style>,
|
||||||
) where
|
) where
|
||||||
S: Into<Vec2>,
|
S: Into<Vec2>,
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Rectangles on the 2D character grid.
|
//! Rectangles on the 2D character grid.
|
||||||
use std::ops::Add;
|
use std::ops::Add;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
|
|
||||||
/// A non-empty rectangle on the 2D grid.
|
/// A non-empty rectangle on the 2D grid.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
@ -102,7 +102,7 @@ impl Palette {
|
|||||||
///
|
///
|
||||||
/// This will update either the basic palette or the custom values.
|
/// This will update either the basic palette or the custom values.
|
||||||
pub fn set_color(&mut self, key: &str, color: Color) {
|
pub fn set_color(&mut self, key: &str, color: Color) {
|
||||||
use theme::PaletteColor::*;
|
use crate::theme::PaletteColor::*;
|
||||||
|
|
||||||
match key {
|
match key {
|
||||||
"background" => self.basic[Background] = color,
|
"background" => self.basic[Background] = color,
|
||||||
@ -146,8 +146,8 @@ impl Palette {
|
|||||||
impl Default for Palette {
|
impl Default for Palette {
|
||||||
fn default() -> Palette {
|
fn default() -> Palette {
|
||||||
use self::PaletteColor::*;
|
use self::PaletteColor::*;
|
||||||
use theme::BaseColor::*;
|
use crate::theme::BaseColor::*;
|
||||||
use theme::Color::*;
|
use crate::theme::Color::*;
|
||||||
|
|
||||||
Palette {
|
Palette {
|
||||||
basic: enum_map!{
|
basic: enum_map!{
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#[doc(no_inline)]
|
#[doc(no_inline)]
|
||||||
pub use view::{Boxable, Finder, Identifiable, Scrollable, View};
|
pub use crate::view::{Boxable, Finder, Identifiable, Scrollable, View};
|
||||||
|
|
||||||
#[doc(no_inline)]
|
#[doc(no_inline)]
|
||||||
pub use With;
|
pub use crate::With;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::Row;
|
use super::Row;
|
||||||
use utils::lines::spans;
|
use crate::utils::lines::spans;
|
||||||
use utils::span::{IndexedSpan, SpannedText};
|
use crate::utils::span::{IndexedSpan, SpannedText};
|
||||||
|
|
||||||
/// Generates rows of text in constrained width.
|
/// Generates rows of text in constrained width.
|
||||||
///
|
///
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
/// Represents a row of text within a `String`.
|
/// Represents a row of text within a `String`.
|
||||||
///
|
///
|
||||||
|
@ -2,7 +2,7 @@ use super::chunk::Chunk;
|
|||||||
use super::segment::Segment;
|
use super::segment::Segment;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use utils::span::SpannedText;
|
use crate::utils::span::SpannedText;
|
||||||
use xi_unicode::LineBreakLeafIter;
|
use xi_unicode::LineBreakLeafIter;
|
||||||
|
|
||||||
/// Iterator that returns non-breakable chunks of text.
|
/// Iterator that returns non-breakable chunks of text.
|
||||||
|
@ -8,7 +8,7 @@ use std::iter::Peekable;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use utils::span::SpannedText;
|
use crate::utils::span::SpannedText;
|
||||||
|
|
||||||
/// Generates rows of text in constrainted width.
|
/// Generates rows of text in constrainted width.
|
||||||
///
|
///
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::Segment;
|
use super::Segment;
|
||||||
use utils::span::{IndexedCow, Span, SpannedStr};
|
use crate::utils::span::{IndexedCow, Span, SpannedStr};
|
||||||
|
|
||||||
/// A list of segments representing a row of text
|
/// A list of segments representing a row of text
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use utils::span::{IndexedCow, Span, SpannedStr, SpannedText};
|
use crate::utils::span::{IndexedCow, Span, SpannedStr, SpannedText};
|
||||||
|
|
||||||
/// Refers to a part of a span
|
/// Refers to a part of a span
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::LinesIterator;
|
use super::LinesIterator;
|
||||||
use theme::{Effect, Style};
|
use crate::theme::{Effect, Style};
|
||||||
use utils::markup::StyledString;
|
use crate::utils::markup::StyledString;
|
||||||
use utils::span::Span;
|
use crate::utils::span::Span;
|
||||||
|
|
||||||
fn input() -> StyledString {
|
fn input() -> StyledString {
|
||||||
let mut text = StyledString::plain("I ");
|
let mut text = StyledString::plain("I ");
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
extern crate pulldown_cmark;
|
extern crate pulldown_cmark;
|
||||||
|
|
||||||
use self::pulldown_cmark::{Event, Tag};
|
use self::pulldown_cmark::{Event, Tag};
|
||||||
use theme::{Effect, Style};
|
use crate::theme::{Effect, Style};
|
||||||
use utils::markup::{StyledIndexedSpan, StyledString};
|
use crate::utils::markup::{StyledIndexedSpan, StyledString};
|
||||||
use utils::span::IndexedCow;
|
use crate::utils::span::IndexedCow;
|
||||||
|
|
||||||
/// Parses the given string as markdown text.
|
/// Parses the given string as markdown text.
|
||||||
pub fn parse<S>(input: S) -> StyledString
|
pub fn parse<S>(input: S) -> StyledString
|
||||||
@ -132,7 +132,7 @@ pub fn parse_spans<'a>(input: &'a str) -> Vec<StyledIndexedSpan> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use utils::span::Span;
|
use crate::utils::span::Span;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse() {
|
fn test_parse() {
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#[cfg(feature = "markdown")]
|
#[cfg(feature = "markdown")]
|
||||||
pub mod markdown;
|
pub mod markdown;
|
||||||
|
|
||||||
use theme::Style;
|
use crate::theme::Style;
|
||||||
use utils::span::{IndexedSpan, Span, SpannedString};
|
use crate::utils::span::{IndexedSpan, Span, SpannedString};
|
||||||
|
|
||||||
/// A parsed string with markup style.
|
/// A parsed string with markup style.
|
||||||
///
|
///
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std::io::{self, Read};
|
use std::io::{self, Read};
|
||||||
use utils::Counter;
|
use crate::utils::Counter;
|
||||||
|
|
||||||
/// Wrapper around a `Read` that reports the progress made.
|
/// Wrapper around a `Read` that reports the progress made.
|
||||||
///
|
///
|
||||||
|
@ -5,8 +5,8 @@ use std::ops::{Add, Div, Mul, Sub};
|
|||||||
|
|
||||||
use num::traits::Zero;
|
use num::traits::Zero;
|
||||||
|
|
||||||
use div;
|
use crate::div;
|
||||||
use XY;
|
use crate::XY;
|
||||||
|
|
||||||
/// Simple 2D size, in cells.
|
/// Simple 2D size, in cells.
|
||||||
///
|
///
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use view::View;
|
use crate::view::View;
|
||||||
|
|
||||||
/// A view that can be downcasted to its concrete type.
|
/// A view that can be downcasted to its concrete type.
|
||||||
///
|
///
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{SizeConstraint, View};
|
use crate::view::{SizeConstraint, View};
|
||||||
use views::BoxView;
|
use crate::views::BoxView;
|
||||||
|
|
||||||
/// Makes a view wrappable in a [`BoxView`].
|
/// Makes a view wrappable in a [`BoxView`].
|
||||||
///
|
///
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use view::{View, ViewPath, ViewWrapper};
|
use crate::view::{View, ViewPath, ViewWrapper};
|
||||||
use views::{IdView, ViewRef};
|
use crate::views::{IdView, ViewRef};
|
||||||
|
|
||||||
/// Provides `call_on<V: View>` to views.
|
/// Provides `call_on<V: View>` to views.
|
||||||
///
|
///
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use view::View;
|
use crate::view::View;
|
||||||
use views::IdView;
|
use crate::views::IdView;
|
||||||
|
|
||||||
/// Makes a view wrappable in an [`IdView`].
|
/// Makes a view wrappable in an [`IdView`].
|
||||||
///
|
///
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use view::View;
|
use crate::view::View;
|
||||||
|
|
||||||
/// Represents a type that can be made into a `Box<View>`.
|
/// Represents a type that can be made into a `Box<View>`.
|
||||||
pub trait IntoBoxedView {
|
pub trait IntoBoxedView {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std::ops::{Add, Div, Mul, Sub};
|
use std::ops::{Add, Div, Mul, Sub};
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
|
|
||||||
/// Four values representing each direction.
|
/// Four values representing each direction.
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use XY;
|
use crate::XY;
|
||||||
|
|
||||||
/// Location of the view on screen
|
/// Location of the view on screen
|
||||||
pub type Position = XY<Offset>;
|
pub type Position = XY<Offset>;
|
||||||
@ -85,7 +85,7 @@ impl Offset {
|
|||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use super::Position;
|
use super::Position;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_center() {
|
fn test_center() {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use div::div_up;
|
use crate::div::div_up;
|
||||||
use std::cmp::{max, min};
|
use std::cmp::{max, min};
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
|
|
||||||
/// Provide scrolling functionalities to a view.
|
/// Provide scrolling functionalities to a view.
|
||||||
///
|
///
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use view::View;
|
use crate::view::View;
|
||||||
use views::ScrollView;
|
use crate::views::ScrollView;
|
||||||
|
|
||||||
/// Makes a view wrappable in a [`ScrollView`].
|
/// Makes a view wrappable in a [`ScrollView`].
|
||||||
///
|
///
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use XY;
|
use crate::XY;
|
||||||
|
|
||||||
/// Cache around a one-dimensional layout result.
|
/// Cache around a one-dimensional layout result.
|
||||||
///
|
///
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use direction::Direction;
|
use crate::direction::Direction;
|
||||||
use event::{AnyCb, Event, EventResult};
|
use crate::event::{AnyCb, Event, EventResult};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{AnyView, Selector};
|
use crate::view::{AnyView, Selector};
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
|
|
||||||
/// Main trait defining a view behaviour.
|
/// Main trait defining a view behaviour.
|
||||||
///
|
///
|
||||||
@ -23,7 +23,7 @@ pub trait View: Any + AnyView {
|
|||||||
///
|
///
|
||||||
/// At this point, the given size is final and cannot be negociated.
|
/// At this point, the given size is final and cannot be negociated.
|
||||||
/// It is guaranteed to be the size available for the call to `draw()`.
|
/// It is guaranteed to be the size available for the call to `draw()`.
|
||||||
fn layout(&mut self, Vec2) {}
|
fn layout(&mut self, _: Vec2) {}
|
||||||
|
|
||||||
/// Should return `true` if the view content changed since the last call
|
/// Should return `true` if the view content changed since the last call
|
||||||
/// to `layout()`.
|
/// to `layout()`.
|
||||||
@ -67,7 +67,7 @@ pub trait View: Any + AnyView {
|
|||||||
/// to be run.
|
/// to be run.
|
||||||
///
|
///
|
||||||
/// The default implementation just ignores any event.
|
/// The default implementation just ignores any event.
|
||||||
fn on_event(&mut self, Event) -> EventResult {
|
fn on_event(&mut self, _: Event) -> EventResult {
|
||||||
EventResult::Ignored
|
EventResult::Ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ pub trait View: Any + AnyView {
|
|||||||
/// Returns `Ok(())` if the view was found and selected.
|
/// Returns `Ok(())` if the view was found and selected.
|
||||||
///
|
///
|
||||||
/// Default implementation simply returns `Err(())`.
|
/// Default implementation simply returns `Err(())`.
|
||||||
fn focus_view(&mut self, &Selector) -> Result<(), ()> {
|
fn focus_view(&mut self, _: &Selector) -> Result<(), ()> {
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use direction::Direction;
|
use crate::direction::Direction;
|
||||||
use event::{AnyCb, Event, EventResult};
|
use crate::event::{AnyCb, Event, EventResult};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{Selector, View};
|
use crate::view::{Selector, View};
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
|
|
||||||
/// Generic wrapper around a view.
|
/// Generic wrapper around a view.
|
||||||
///
|
///
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{SizeConstraint, View, ViewWrapper};
|
use crate::view::{SizeConstraint, View, ViewWrapper};
|
||||||
use With;
|
use crate::With;
|
||||||
use XY;
|
use crate::XY;
|
||||||
|
|
||||||
/// Wrapper around another view, with a controlled size.
|
/// Wrapper around another view, with a controlled size.
|
||||||
///
|
///
|
||||||
@ -250,9 +250,9 @@ impl<T: View> ViewWrapper for BoxView<T> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{Boxable, View};
|
use crate::view::{Boxable, View};
|
||||||
use views::DummyView;
|
use crate::views::DummyView;
|
||||||
|
|
||||||
// No need to test `draw()` method as it's directly forwarded.
|
// No need to test `draw()` method as it's directly forwarded.
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_inner() {
|
fn test_get_inner() {
|
||||||
use views::TextView;
|
use crate::views::TextView;
|
||||||
|
|
||||||
let parent = TextView::new("abc").full_screen();
|
let parent = TextView::new("abc").full_screen();
|
||||||
let child = parent.get_inner();
|
let child = parent.get_inner();
|
||||||
@ -324,7 +324,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_inner_mut() {
|
fn test_get_inner_mut() {
|
||||||
use views::TextView;
|
use crate::views::TextView;
|
||||||
|
|
||||||
let mut parent = TextView::new("").full_screen();
|
let mut parent = TextView::new("").full_screen();
|
||||||
let new_value = "new";
|
let new_value = "new";
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
use align::HAlign;
|
use crate::align::HAlign;
|
||||||
use direction::Direction;
|
use crate::direction::Direction;
|
||||||
use event::*;
|
use crate::event::*;
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::View;
|
use crate::view::View;
|
||||||
use {Cursive, Printer, With};
|
use crate::{Cursive, Printer, With};
|
||||||
|
|
||||||
/// Simple text label with a callback when <Enter> is pressed.
|
/// Simple text label with a callback when <Enter> is pressed.
|
||||||
///
|
///
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use direction::Direction;
|
use crate::direction::Direction;
|
||||||
use event::{AnyCb, Event, EventResult};
|
use crate::event::{AnyCb, Event, EventResult};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{Selector, View};
|
use crate::view::{Selector, View};
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
/// A blank view that forwards calls to closures.
|
/// A blank view that forwards calls to closures.
|
||||||
///
|
///
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
use direction::Direction;
|
use crate::direction::Direction;
|
||||||
use event::{Event, EventResult, Key, MouseButton, MouseEvent};
|
use crate::event::{Event, EventResult, Key, MouseButton, MouseEvent};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::View;
|
use crate::view::View;
|
||||||
use Cursive;
|
use crate::Cursive;
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
/// Checkable box.
|
/// Checkable box.
|
||||||
pub struct Checkbox {
|
pub struct Checkbox {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use direction::Direction;
|
use crate::direction::Direction;
|
||||||
use event::{Event, EventResult, Key};
|
use crate::event::{Event, EventResult, Key};
|
||||||
use view::{View, ViewWrapper};
|
use crate::view::{View, ViewWrapper};
|
||||||
|
|
||||||
/// Adds circular focus to a wrapped view.
|
/// Adds circular focus to a wrapped view.
|
||||||
///
|
///
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use logger;
|
use crate::logger;
|
||||||
use theme;
|
use crate::theme;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::View;
|
use crate::view::View;
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
|
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
use align::*;
|
use crate::align::*;
|
||||||
use direction::{Absolute, Direction, Relative};
|
use crate::direction::{Absolute, Direction, Relative};
|
||||||
use event::{AnyCb, Event, EventResult, Key};
|
use crate::event::{AnyCb, Event, EventResult, Key};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{Margins, Selector, View};
|
use crate::view::{Margins, Selector, View};
|
||||||
use views::{Button, DummyView, SizedView, TextView, ViewBox};
|
use crate::views::{Button, DummyView, SizedView, TextView, ViewBox};
|
||||||
use Cursive;
|
use crate::Cursive;
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
/// Identifies currently focused element in [`Dialog`].
|
/// Identifies currently focused element in [`Dialog`].
|
||||||
///
|
///
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use view::View;
|
use crate::view::View;
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
|
|
||||||
/// Dummy view.
|
/// Dummy view.
|
||||||
///
|
///
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
use direction::Direction;
|
use crate::direction::Direction;
|
||||||
use event::{Callback, Event, EventResult, Key, MouseEvent};
|
use crate::event::{Callback, Event, EventResult, Key, MouseEvent};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use theme::{ColorStyle, Effect};
|
use crate::theme::{ColorStyle, Effect};
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
use unicode_width::{UnicodeWidthChar, UnicodeWidthStr};
|
use unicode_width::{UnicodeWidthChar, UnicodeWidthStr};
|
||||||
use utils::lines::simple::{simple_prefix, simple_suffix};
|
use crate::utils::lines::simple::{simple_prefix, simple_suffix};
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::View;
|
use crate::view::View;
|
||||||
use {Cursive, Printer, With};
|
use crate::{Cursive, Printer, With};
|
||||||
|
|
||||||
/// Closure type for callbacks when the content is modified.
|
/// Closure type for callbacks when the content is modified.
|
||||||
///
|
///
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use event::{Event, EventResult};
|
use crate::event::{Event, EventResult};
|
||||||
use view::{View, ViewWrapper};
|
use crate::view::{View, ViewWrapper};
|
||||||
use {Printer, With};
|
use crate::{Printer, With};
|
||||||
|
|
||||||
/// Wrapper around another view that can be enabled/disabled at will.
|
/// Wrapper around another view that can be enabled/disabled at will.
|
||||||
///
|
///
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{Selector, View, ViewWrapper};
|
use crate::view::{Selector, View, ViewWrapper};
|
||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use std::any::Any;
|
|||||||
use std::cell::{RefCell, RefMut};
|
use std::cell::{RefCell, RefMut};
|
||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use view::{Selector, View, ViewWrapper};
|
use crate::view::{Selector, View, ViewWrapper};
|
||||||
|
|
||||||
/// Wrapper around a view to provide interior mutability.
|
/// Wrapper around a view to provide interior mutability.
|
||||||
pub struct IdView<V: View> {
|
pub struct IdView<V: View> {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use view::{View, ViewWrapper};
|
use crate::view::{View, ViewWrapper};
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
|
|
||||||
/// Wrapper view that fills the background.
|
/// Wrapper view that fills the background.
|
||||||
///
|
///
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
use direction;
|
use crate::direction;
|
||||||
use event::{AnyCb, Event, EventResult, Key};
|
use crate::event::{AnyCb, Event, EventResult, Key};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{Selector, SizeCache, View};
|
use crate::view::{Selector, SizeCache, View};
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
use With;
|
use crate::With;
|
||||||
use XY;
|
use crate::XY;
|
||||||
|
|
||||||
/// Arranges its children linearly according to its orientation.
|
/// Arranges its children linearly according to its orientation.
|
||||||
pub struct LinearLayout {
|
pub struct LinearLayout {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
use direction;
|
use crate::direction;
|
||||||
use event::{AnyCb, Callback, Event, EventResult, Key};
|
use crate::event::{AnyCb, Callback, Event, EventResult, Key};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{Selector, View};
|
use crate::view::{Selector, View};
|
||||||
use Cursive;
|
use crate::Cursive;
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
/// Represents a child from a [`ListView`].
|
/// Represents a child from a [`ListView`].
|
||||||
///
|
///
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
use align::Align;
|
use crate::align::Align;
|
||||||
use event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
|
use crate::event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
|
||||||
use menu::{MenuItem, MenuTree};
|
use crate::menu::{MenuItem, MenuTree};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{Position, ScrollBase, View};
|
use crate::view::{Position, ScrollBase, View};
|
||||||
use views::OnEventView;
|
use crate::views::OnEventView;
|
||||||
use Cursive;
|
use crate::Cursive;
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
/// Popup that shows a list of items.
|
/// Popup that shows a list of items.
|
||||||
pub struct MenuPopup {
|
pub struct MenuPopup {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
use direction;
|
use crate::direction;
|
||||||
use event::*;
|
use crate::event::*;
|
||||||
use menu::{MenuItem, MenuTree};
|
use crate::menu::{MenuItem, MenuTree};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{Position, View};
|
use crate::view::{Position, View};
|
||||||
use views::{MenuPopup, OnEventView};
|
use crate::views::{MenuPopup, OnEventView};
|
||||||
use Cursive;
|
use crate::Cursive;
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
|
|
||||||
/// Current state of the menubar
|
/// Current state of the menubar
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use event::{Callback, Event, EventResult, EventTrigger};
|
use crate::event::{Callback, Event, EventResult, EventTrigger};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use view::{View, ViewWrapper};
|
use crate::view::{View, ViewWrapper};
|
||||||
use Cursive;
|
use crate::Cursive;
|
||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
/// A wrapper view that can react to events.
|
/// A wrapper view that can react to events.
|
||||||
///
|
///
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use event::{Event, EventResult};
|
use crate::event::{Event, EventResult};
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{Margins, View, ViewWrapper};
|
use crate::view::{Margins, View, ViewWrapper};
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
|
|
||||||
/// Adds padding to another view.
|
/// Adds padding to another view.
|
||||||
///
|
///
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
use align::*;
|
use crate::align::*;
|
||||||
use event::{Event, EventResult};
|
use crate::event::{Event, EventResult};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{View, ViewWrapper};
|
use crate::view::{View, ViewWrapper};
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
/// Draws a border around a wrapped view.
|
/// Draws a border around a wrapped view.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use align::HAlign;
|
use crate::align::HAlign;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use theme::{ColorStyle, ColorType, Effect};
|
use crate::theme::{ColorStyle, ColorType, Effect};
|
||||||
use utils::Counter;
|
use crate::utils::Counter;
|
||||||
use view::View;
|
use crate::view::View;
|
||||||
use {Printer, With};
|
use crate::{Printer, With};
|
||||||
|
|
||||||
// pub type CbPromise = Option<Box<Fn(&mut Cursive) + Send>>;
|
// pub type CbPromise = Option<Box<Fn(&mut Cursive) + Send>>;
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
use direction::Direction;
|
use crate::direction::Direction;
|
||||||
use event::{Event, EventResult, Key, MouseButton, MouseEvent};
|
use crate::event::{Event, EventResult, Key, MouseButton, MouseEvent};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::View;
|
use crate::view::View;
|
||||||
use Cursive;
|
use crate::Cursive;
|
||||||
use {Printer, With};
|
use crate::{Printer, With};
|
||||||
|
|
||||||
struct SharedState<T> {
|
struct SharedState<T> {
|
||||||
selection: usize,
|
selection: usize,
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
|
|
||||||
use direction::{Direction, Orientation};
|
use crate::direction::{Direction, Orientation};
|
||||||
use event::{AnyCb, Event, EventResult, Key, MouseButton, MouseEvent};
|
use crate::event::{AnyCb, Event, EventResult, Key, MouseButton, MouseEvent};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use view::{ScrollStrategy, Selector, SizeCache, View};
|
use crate::view::{ScrollStrategy, Selector, SizeCache, View};
|
||||||
use {Printer, Vec2, With, XY};
|
use crate::{Printer, Vec2, With, XY};
|
||||||
|
|
||||||
/// Wraps a view in a scrollable area.
|
/// Wraps a view in a scrollable area.
|
||||||
pub struct ScrollView<V> {
|
pub struct ScrollView<V> {
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
use align::{Align, HAlign, VAlign};
|
use crate::align::{Align, HAlign, VAlign};
|
||||||
use direction::Direction;
|
use crate::direction::Direction;
|
||||||
use event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
|
use crate::event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
|
||||||
use menu::MenuTree;
|
use crate::menu::MenuTree;
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use utils::markup::StyledString;
|
use crate::utils::markup::StyledString;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{Position, View};
|
use crate::view::{Position, View};
|
||||||
use views::MenuPopup;
|
use crate::views::MenuPopup;
|
||||||
use Cursive;
|
use crate::Cursive;
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
/// View to select an item among a list.
|
/// View to select an item among a list.
|
||||||
///
|
///
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use event::{Event, EventResult};
|
use crate::event::{Event, EventResult};
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{View, ViewWrapper};
|
use crate::view::{View, ViewWrapper};
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
|
|
||||||
/// Wrapper view that adds a shadow.
|
/// Wrapper view that adds a shadow.
|
||||||
///
|
///
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::View;
|
use crate::view::View;
|
||||||
use view::ViewWrapper;
|
use crate::view::ViewWrapper;
|
||||||
|
|
||||||
/// Wrapper around a view that remembers its size.
|
/// Wrapper around a view that remembers its size.
|
||||||
pub struct SizedView<T> {
|
pub struct SizedView<T> {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use direction::{Direction, Orientation};
|
use crate::direction::{Direction, Orientation};
|
||||||
use event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
|
use crate::event::{Callback, Event, EventResult, Key, MouseButton, MouseEvent};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::View;
|
use crate::view::View;
|
||||||
use With;
|
use crate::With;
|
||||||
use {Cursive, Printer};
|
use crate::{Cursive, Printer};
|
||||||
|
|
||||||
/// A horizontal or vertical slider.
|
/// A horizontal or vertical slider.
|
||||||
pub struct SliderView {
|
pub struct SliderView {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
use direction::Direction;
|
use crate::direction::Direction;
|
||||||
use event::{AnyCb, Event, EventResult};
|
use crate::event::{AnyCb, Event, EventResult};
|
||||||
use std::cell;
|
use std::cell;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use theme::ColorStyle;
|
use crate::theme::ColorStyle;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{IntoBoxedView, Offset, Position, Selector, View, ViewWrapper};
|
use crate::view::{IntoBoxedView, Offset, Position, Selector, View, ViewWrapper};
|
||||||
use views::{CircularFocus, Layer, ShadowView, ViewBox};
|
use crate::views::{CircularFocus, Layer, ShadowView, ViewBox};
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
use With;
|
use crate::With;
|
||||||
|
|
||||||
/// Simple stack of views.
|
/// Simple stack of views.
|
||||||
/// Only the top-most view is active and can receive input.
|
/// Only the top-most view is active and can receive input.
|
||||||
@ -673,7 +673,7 @@ impl View for StackView {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use views::TextView;
|
use crate::views::TextView;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pop_add() {
|
fn pop_add() {
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
use direction::Direction;
|
use crate::direction::Direction;
|
||||||
use event::{Event, EventResult, Key, MouseButton, MouseEvent};
|
use crate::event::{Event, EventResult, Key, MouseButton, MouseEvent};
|
||||||
use rect::Rect;
|
use crate::rect::Rect;
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use theme::{ColorStyle, Effect};
|
use crate::theme::{ColorStyle, Effect};
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
use utils::lines::simple::{prefix, simple_prefix, LinesIterator, Row};
|
use crate::utils::lines::simple::{prefix, simple_prefix, LinesIterator, Row};
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{ScrollBase, SizeCache, View};
|
use crate::view::{ScrollBase, SizeCache, View};
|
||||||
use {Printer, With, XY};
|
use crate::{Printer, With, XY};
|
||||||
|
|
||||||
/// Multi-lines text editor.
|
/// Multi-lines text editor.
|
||||||
///
|
///
|
||||||
|
@ -5,12 +5,12 @@ use std::sync::{Mutex, MutexGuard};
|
|||||||
use owning_ref::{ArcRef, OwningHandle};
|
use owning_ref::{ArcRef, OwningHandle};
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
use align::*;
|
use crate::align::*;
|
||||||
use theme::Effect;
|
use crate::theme::Effect;
|
||||||
use utils::lines::spans::{LinesIterator, Row};
|
use crate::utils::lines::spans::{LinesIterator, Row};
|
||||||
use utils::markup::StyledString;
|
use crate::utils::markup::StyledString;
|
||||||
use view::{SizeCache, View};
|
use crate::view::{SizeCache, View};
|
||||||
use {Printer, Vec2, With, XY};
|
use crate::{Printer, Vec2, With, XY};
|
||||||
|
|
||||||
/// Provides access to the content of a [`TextView`].
|
/// Provides access to the content of a [`TextView`].
|
||||||
///
|
///
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use vec::Vec2;
|
use crate::vec::Vec2;
|
||||||
use view::{View, ViewWrapper};
|
use crate::view::{View, ViewWrapper};
|
||||||
use views::IdView;
|
use crate::views::IdView;
|
||||||
use Printer;
|
use crate::Printer;
|
||||||
|
|
||||||
/// Wrapper around a view that remembers its position.
|
/// Wrapper around a view that remembers its position.
|
||||||
pub struct TrackedView<T: View> {
|
pub struct TrackedView<T: View> {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use view::{IntoBoxedView, View, ViewWrapper};
|
use crate::view::{IntoBoxedView, View, ViewWrapper};
|
||||||
|
|
||||||
/// A boxed `View`.
|
/// A boxed `View`.
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user