Struct Frame

Source
pub struct Frame { /* private fields */ }
Expand description

The Frame struct is the building block for all future widgets inside of Oxide. Objects of Frame abstract away the actual creation and drawing of areas of a terminal, because this process is the same for all widgets. Every widget should contain one Frame type to be used to render text to the screen

Implementations§

Source§

impl Frame

Source

pub fn new(cols: usize, rows: usize) -> Frame

Constructs a new Frame object with a width of cols and height of rows

Source

pub fn draw_into(&self, cells: &mut dyn CellAccessor)

Draw the buffer contained inside of the base object to a valid object that implements CellAccessor.

Source

pub fn resize(&mut self, new_size: Size)

Trait Implementations§

Source§

impl Alignable for Frame

Source§

fn halign( &mut self, parent: &dyn HasSize, halign: HorizontalAlign, margin: usize, )

Source§

fn valign(&mut self, parent: &dyn HasSize, valign: VerticalAlign, margin: usize)

Source§

fn align( &mut self, parent: &dyn HasSize, halign: HorizontalAlign, valign: VerticalAlign, margin: (usize, usize), )

Source§

impl CellAccessor for Frame

Source§

fn cellvec(&self) -> &Vec<Cell>

Source§

fn cellvec_mut(&mut self) -> &mut Vec<Cell>

Source§

fn clear(&mut self, blank: Cell)

Clears self, using the given Cell as a blank.
Source§

fn pos_to_index(&self, x: usize, y: usize) -> Option<usize>

Source§

fn get(&self, x: usize, y: usize) -> Option<&Cell>

Returns a reference to the Cell at the given coordinates, or None if the index is out of bounds. Read more
Source§

fn get_mut(&mut self, x: usize, y: usize) -> Option<&mut Cell>

Returns a mutable reference to the Cell at the given coordinates, or None if the index is out of bounds. Read more
Source§

impl HasPosition for Frame

Source§

fn origin(&self) -> Pos

Source§

fn set_origin(&mut self, new_origin: Pos)

Source§

impl HasSize for Frame

Source§

fn size(&self) -> Size

Auto Trait Implementations§

§

impl Freeze for Frame

§

impl RefUnwindSafe for Frame

§

impl Send for Frame

§

impl Sync for Frame

§

impl Unpin for Frame

§

impl UnwindSafe for Frame

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Painter for T
where T: CellAccessor,

Source§

fn printline_with_cell(&mut self, x: usize, y: usize, line: &str, cell: Cell)

Prints a string at the specified position. Read more
Source§

fn printline(&mut self, x: usize, y: usize, line: &str)

Prints a string at the specified position. Read more
Source§

fn halign_line( &self, line: &str, halign: HorizontalAlign, margin: usize, ) -> usize

Returns the proper x coord to align line in the specified halign alignment. Read more
Source§

fn valign_line(&self, line: &str, valign: VerticalAlign, margin: usize) -> usize

Returns the proper y coord to align line in the specified valign alignment. Read more
Source§

fn repeat_cell( &mut self, x: usize, y: usize, orientation: Orientation, count: usize, cell: Cell, )

Source§

fn draw_box(&mut self)

Source§

impl<T> Painter for T
where T: CellAccessor,

Source§

fn printline_with_cell(&mut self, x: usize, y: usize, line: &str, cell: Cell)

Prints a string at the specified position. Read more
Source§

fn printline(&mut self, x: usize, y: usize, line: &str)

Prints a string at the specified position. Read more
Source§

fn halign_line( &self, line: &str, halign: HorizontalAlign, margin: usize, ) -> usize

Returns the proper x coord to align line in the specified halign alignment. Read more
Source§

fn valign_line(&self, line: &str, valign: VerticalAlign, margin: usize) -> usize

Returns the proper y coord to align line in the specified valign alignment. Read more
Source§

fn repeat_cell( &mut self, x: usize, y: usize, orientation: Orientation, count: usize, cell: Cell, )

Source§

fn draw_box(&mut self)

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.