Struct PancursesRenderer

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

Pancurses Renderer implementation for iced

Implementations§

Source§

impl PancursesRenderer

Source

pub fn flush(&mut self)

Clears the output of the renderer

Source

pub fn handle(&self) -> Option<Vec<Event>>

Polls event from the pancurses window

Examples found in repository?
examples/scroll.rs (line 26)
5fn main() {
6    let mut state = State::new();
7    let mut renderer = PancursesRenderer::default();
8    let root: Column<(), PancursesRenderer> = Column::new()
9        .spacing(1)
10        .push(Text::new("Hello scrolling !"))
11        .push(
12            Scrollable::new(&mut state).push(
13                Column::new()
14                    .spacing(1)
15                    .push(Text::new("Scroll !"))
16                    .push(Row::new().height(Length::Units(5)))
17                    .push(Text::new("Scroll !"))
18                    .push(Text::new("Scroll !")),
19            ),
20        );
21    let cache = Cache::default();
22    let ui = iced_native::UserInterface::build(root, cache, &mut renderer);
23    loop {
24        let primitives = ui.draw(&mut renderer);
25        renderer.draw(primitives);
26        let _event = renderer.handle();
27    }
28}
Source

pub fn draw(&mut self, primitive: Primitive)

Draws a given primitive onto the window

Examples found in repository?
examples/scroll.rs (line 25)
5fn main() {
6    let mut state = State::new();
7    let mut renderer = PancursesRenderer::default();
8    let root: Column<(), PancursesRenderer> = Column::new()
9        .spacing(1)
10        .push(Text::new("Hello scrolling !"))
11        .push(
12            Scrollable::new(&mut state).push(
13                Column::new()
14                    .spacing(1)
15                    .push(Text::new("Scroll !"))
16                    .push(Row::new().height(Length::Units(5)))
17                    .push(Text::new("Scroll !"))
18                    .push(Text::new("Scroll !")),
19            ),
20        );
21    let cache = Cache::default();
22    let ui = iced_native::UserInterface::build(root, cache, &mut renderer);
23    loop {
24        let primitives = ui.draw(&mut renderer);
25        renderer.draw(primitives);
26        let _event = renderer.handle();
27    }
28}
Source

pub fn size(&self) -> (u16, u16)

Gets the current size of the terminal root window

Trait Implementations§

Source§

impl Default for PancursesRenderer

Source§

fn default() -> Self

Default config for a Pancurses renderer

Source§

impl Renderer for PancursesRenderer

Source§

fn draw( &mut self, bounds: Rectangle, _cursor_position: Point, _is_pressed: bool, _background: Option<Background>, _border_radius: u16, content: Self::Output, ) -> Self::Output

Draws a Button.
Source§

impl Renderer for PancursesRenderer

Source§

fn default_size(&self) -> u32

Returns the default size of a Checkbox.
Source§

fn draw( &mut self, bounds: Rectangle, is_checked: bool, _is_mouse_over: bool, label: Primitive, ) -> Primitive

Source§

impl Renderer for PancursesRenderer

Source§

type Output = Primitive

The type of output of the Renderer. Read more
Source§

fn layout<'a, Message>(&mut self, element: &Element<'a, Message, Self>) -> Node

Lays out the elements of a user interface. Read more
Source§

impl Renderer for PancursesRenderer

Source§

fn draw<Message>( &mut self, content: &[Element<'_, Message, Self>], layout: Layout<'_>, cursor_position: Point, ) -> Self::Output

Draws a Column. Read more
Source§

impl Renderer for PancursesRenderer

Source§

fn dimensions(&self, _path: &str) -> (u32, u32)

Returns the dimensions of an Image located on the given path.
Source§

fn draw(&mut self, _path: &str, layout: Layout<'_>) -> Primitive

Draws an Image.
Source§

impl Renderer for PancursesRenderer

Source§

fn default_size(&self) -> u32

Returns the default size of a Radio button.
Source§

fn draw( &mut self, bounds: Rectangle, is_selected: bool, _is_mouse_over: bool, label: Primitive, ) -> Primitive

Draws a Radio button. Read more
Source§

impl Renderer for PancursesRenderer

Source§

fn is_mouse_over_scrollbar( &self, _bounds: Rectangle, _content_bounds: Rectangle, _cursor_position: Point, ) -> bool

Returns whether the mouse is over the scrollbar given the bounds of the Scrollable and its contents.
Source§

fn draw( &mut self, _state: &State, bounds: Rectangle, _content_bounds: Rectangle, _is_mouse_over: bool, _is_mouse_over_scrollbar: bool, offset: u32, content: Primitive, ) -> Primitive

Source§

impl Renderer for PancursesRenderer

Source§

fn height(&self) -> u32

Returns the height of the Slider.
Source§

fn draw( &mut self, bounds: Rectangle, _cursor_position: Point, range: RangeInclusive<f32>, value: f32, _is_dragging: bool, ) -> Primitive

Draws a Slider. Read more
Source§

impl Renderer for PancursesRenderer

Source§

fn draw<Message>( &mut self, children: &[Element<'_, Message, Self>], layout: Layout<'_>, cursor_position: Point, ) -> Self::Output

Draws a Row. Read more
Source§

impl Renderer for PancursesRenderer

Source§

fn default_size(&self) -> u16

Returns the default size of the Text.
Source§

fn measure( &self, content: &str, _size: u16, _font: Font, bounds: Size, ) -> (f32, f32)

Measures the Text in the given bounds and returns the minimum boundaries that can fit the contents.
Source§

fn draw( &mut self, bounds: Rectangle, content: &str, _size: u16, _font: Font, color: Option<Color>, horizontal_alignment: HorizontalAlignment, _vertical_alignment: VerticalAlignment, ) -> Self::Output

Draws a Text fragment. Read more
Source§

impl Renderer for PancursesRenderer

Source§

fn default_size(&self) -> u16

Returns the default size of the text of the TextInput.
Source§

fn draw( &mut self, bounds: Rectangle, src_text_bounds: Rectangle, _cursor_position: Point, _size: u16, placeholder: &str, value: &Value, _state: &State, ) -> Primitive

Auto Trait Implementations§

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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V