mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Add/fix some doc
This commit is contained in:
parent
3460f8123d
commit
44899bdcd6
@ -96,11 +96,11 @@ impl View for BufferView {
|
||||
let (discard,offset) = if self.buffer.len() > printer.size.y as usize {
|
||||
(self.buffer.len() - printer.size.y as usize, 0)
|
||||
} else {
|
||||
(0, printer.size.y - self.buffer.len() as u32)
|
||||
(0, printer.size.y - self.buffer.len())
|
||||
};
|
||||
|
||||
for (i, line) in self.ring().skip(discard).enumerate() {
|
||||
printer.print((0,offset + i as u32), line);
|
||||
printer.print((0,offset + i), line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,6 +156,7 @@ impl Cursive {
|
||||
self.screen_mut().add_layer(view);
|
||||
}
|
||||
|
||||
/// Convenient method to remove a layer from the current screen.
|
||||
pub fn pop_layer(&mut self) {
|
||||
self.screen_mut().pop_layer();
|
||||
}
|
||||
|
@ -61,6 +61,14 @@ impl Printer {
|
||||
|
||||
/// Returns a wrapper around this printer,
|
||||
/// that will apply the given style on prints.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// printer.with_style(color::HIGHLIGHT, |printer| {
|
||||
/// printer.print((0,0), "This text is highlighted!");
|
||||
/// });
|
||||
/// ```
|
||||
pub fn with_style<'a, F>(&'a self, style: color::ThemeColor, f: F)
|
||||
where F: Fn(&Printer)
|
||||
{
|
||||
@ -75,7 +83,7 @@ impl Printer {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// printer.print_box((0,0), (6,4), '+', '-', '|');
|
||||
/// printer.print_box((0,0), (6,4));
|
||||
/// ```
|
||||
pub fn print_box<T: ToVec2>(&self, start: T, size: T) {
|
||||
let start_v = start.to_vec2();
|
||||
|
@ -72,6 +72,7 @@ impl Dialog {
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the padding in the dialog (around content and buttons).
|
||||
pub fn padding<T: ToVec4>(mut self, padding: T) -> Self {
|
||||
self.padding = padding.to_vec4();
|
||||
|
||||
|
@ -3,8 +3,7 @@ use vec::Vec2;
|
||||
|
||||
/// Simple wrapper view that asks for all the space it can get.
|
||||
pub struct FullView<T: View> {
|
||||
/// Wrapped view.
|
||||
pub view: T,
|
||||
view: T,
|
||||
}
|
||||
|
||||
impl <T: View> FullView<T> {
|
||||
|
@ -3,11 +3,15 @@ use printer::Printer;
|
||||
use vec::Vec2;
|
||||
use color;
|
||||
|
||||
/// Wrapper view that adds a shadow.
|
||||
///
|
||||
/// It reserves a 1 pixel border on each side.
|
||||
pub struct ShadowView<T: View> {
|
||||
pub view: T,
|
||||
view: T,
|
||||
}
|
||||
|
||||
impl <T: View> ShadowView<T> {
|
||||
/// Wraps the given view.
|
||||
pub fn new(view: T) -> Self {
|
||||
ShadowView {
|
||||
view: view,
|
||||
|
Loading…
Reference in New Issue
Block a user