[][src]Trait tuikit::canvas::Canvas

pub trait Canvas {
    fn size(&self) -> Result<(usize, usize)>;
fn clear(&mut self) -> Result<()>;
fn put_cell(&mut self, row: usize, col: usize, cell: Cell) -> Result<usize>;
fn set_cursor(&mut self, row: usize, col: usize) -> Result<()>;
fn show_cursor(&mut self, show: bool) -> Result<()>; fn put_char_with_attr(
        &mut self,
        row: usize,
        col: usize,
        ch: char,
        attr: Attr
    ) -> Result<usize> { ... }
fn print_with_attr(
        &mut self,
        row: usize,
        col: usize,
        content: &str,
        attr: Attr
    ) -> Result<usize> { ... }
fn print(&mut self, row: usize, col: usize, content: &str) -> Result<usize> { ... } }

Required methods

fn size(&self) -> Result<(usize, usize)>

Get the canvas size (width, height)

fn clear(&mut self) -> Result<()>

clear the canvas

fn put_cell(&mut self, row: usize, col: usize, cell: Cell) -> Result<usize>

change a cell of position (row, col) to cell if (row, col) is out of boundary, Ok is returned, but no operation is taken return the width of the character/cell

fn set_cursor(&mut self, row: usize, col: usize) -> Result<()>

move cursor position (row, col) and show cursor

fn show_cursor(&mut self, show: bool) -> Result<()>

show/hide cursor, set show to false to hide the cursor

Loading content...

Provided methods

fn put_char_with_attr(
    &mut self,
    row: usize,
    col: usize,
    ch: char,
    attr: Attr
) -> Result<usize>

just like put_cell, except it accept (char & attr) return the width of the character/cell

fn print_with_attr(
    &mut self,
    row: usize,
    col: usize,
    content: &str,
    attr: Attr
) -> Result<usize>

print content starting with position (row, col) with attr

  • canvas should NOT wrap to y+1 if the content is too long
  • canvas should handle wide characters return the printed width of the content

fn print(&mut self, row: usize, col: usize, content: &str) -> Result<usize>

print content starting with position (row, col) with default attribute

Loading content...

Implementors

impl Canvas for Screen[src]

fn size(&self) -> Result<(usize, usize)>[src]

Get the canvas size (width, height)

fn clear(&mut self) -> Result<()>[src]

clear the screen buffer

fn put_cell(&mut self, row: usize, col: usize, cell: Cell) -> Result<usize>[src]

change a cell of position (row, col) to cell

fn set_cursor(&mut self, row: usize, col: usize) -> Result<()>[src]

move cursor position (row, col) and show cursor

fn show_cursor(&mut self, show: bool) -> Result<()>[src]

show/hide cursor, set show to false to hide the cursor

impl<'a> Canvas for BoundedCanvas<'a>[src]

impl<'a, UserEvent: Send + 'static> Canvas for TermCanvas<'a, UserEvent>[src]

Loading content...