Rename module vec2 -> vec

Margins may be moved to vec::Vec4 some day
This commit is contained in:
Alexandre Bury 2015-05-18 11:51:30 -07:00
parent b8b7638667
commit 1fcca9b3a9
10 changed files with 23 additions and 9 deletions

View File

@ -25,7 +25,7 @@ extern crate ncurses;
pub mod event; pub mod event;
pub mod view; pub mod view;
pub mod printer; pub mod printer;
pub mod vec2; pub mod vec;
mod div; mod div;
mod margins; mod margins;
@ -36,7 +36,7 @@ use std::any::Any;
use std::rc::Rc; use std::rc::Rc;
use std::collections::HashMap; use std::collections::HashMap;
use vec2::Vec2; use vec::Vec2;
use view::View; use view::View;
use printer::Printer; use printer::Printer;
use view::{StackView,ViewPath}; use view::{StackView,ViewPath};

View File

@ -1,3 +1,5 @@
use vec::Vec2;
/// Fixed margins around a rectangular view. /// Fixed margins around a rectangular view.
pub struct Margins { pub struct Margins {
/// Left margin /// Left margin
@ -20,4 +22,16 @@ impl Margins {
bottom: bottom, bottom: bottom,
} }
} }
pub fn horizontal(&self) -> u32 {
self.left + self.right
}
pub fn vertical(&self) -> u32 {
self.top + self.bottom
}
pub fn combined(&self) -> Vec2 {
Vec2::new(self.horizontal(), self.vertical())
}
} }

View File

@ -1,7 +1,7 @@
//! Makes drawing on ncurses windows easier. //! Makes drawing on ncurses windows easier.
use ncurses; use ncurses;
use vec2::{Vec2,ToVec2}; use vec::{Vec2,ToVec2};
/// Wrapper around a subset of a ncurses window. /// Wrapper around a subset of a ncurses window.
pub struct Printer { pub struct Printer {

View File

@ -1,5 +1,5 @@
use event::EventResult; use event::EventResult;
use vec2::{Vec2,ToVec2}; use vec::{Vec2,ToVec2};
use super::{View,SizeRequest}; use super::{View,SizeRequest};
use printer::Printer; use printer::Printer;

View File

@ -1,6 +1,6 @@
use ::Cursive; use ::Cursive;
use view::{View,ViewPath,SizeRequest,DimensionRequest}; use view::{View,ViewPath,SizeRequest,DimensionRequest};
use vec2::{Vec2}; use vec::{Vec2};
use printer::Printer; use printer::Printer;
enum Focus { enum Focus {

View File

@ -3,7 +3,7 @@ use std::rc::Rc;
use ::Cursive; use ::Cursive;
use event::{EventResult,Callback}; use event::{EventResult,Callback};
use vec2::{Vec2}; use vec::{Vec2};
use super::{View,SizeRequest,ViewPath}; use super::{View,SizeRequest,ViewPath};
use printer::Printer; use printer::Printer;

View File

@ -17,7 +17,7 @@ pub use self::text_view::TextView;
pub use self::dialog::Dialog; pub use self::dialog::Dialog;
use event::EventResult; use event::EventResult;
use vec2::Vec2; use vec::Vec2;
use printer::Printer; use printer::Printer;
/// Describe constraints on a view layout in one dimension. /// Describe constraints on a view layout in one dimension.

View File

@ -1,6 +1,6 @@
use std::cmp::max; use std::cmp::max;
use vec2::Vec2; use vec::Vec2;
use view::{View,SizeRequest,DimensionRequest}; use view::{View,SizeRequest,DimensionRequest};
use event::EventResult; use event::EventResult;
use printer::Printer; use printer::Printer;

View File

@ -1,6 +1,6 @@
use std::cmp; use std::cmp;
use vec2::Vec2; use vec::Vec2;
use view::{View,DimensionRequest,SizeRequest}; use view::{View,DimensionRequest,SizeRequest};
use div::*; use div::*;
use printer::Printer; use printer::Printer;