Component

Struct Component 

Source
pub struct Component { /* private fields */ }

Implementations§

Source§

impl Component

Source

pub fn new( name: String, border_width: u16, widget: Box<dyn ComponentWidget>, ) -> Self

Source

pub fn get_border_width(&self) -> u16

Source

pub fn set_focus(&mut self, focus: Focus)

Source

pub fn get_widget(&self) -> &dyn ComponentWidget

Source

pub fn get_widget_mut(&mut self) -> &mut dyn ComponentWidget

Source

pub fn set_fixed_width(&mut self, fixed_width: Option<u16>)

Source

pub fn fixed_width(self, fixed_width: Option<u16>) -> Self

Source

pub fn set_fixed_height(&mut self, fixed_height: Option<u16>)

Source

pub fn fixed_height(self, fixed_height: Option<u16>) -> Self

Trait Implementations§

Source§

impl ComponentBase for Component

Source§

fn handle_mouse(&mut self, x: u16, y: u16, kind: Option<MouseEventKind>)

Source§

fn handle_key(&mut self, e: KeyEvent) -> Option<Border>

Source§

fn handle_update(&mut self)

Source§

fn invalidate(&mut self)

Indicates that all sub-components need to be redrawn
Source§

fn resize(&mut self, width: u16, height: u16) -> Result<(), ResizeError>

Resizes this component to fit in the new size, returning true if this succeeded, resizing any child components as well, and invalidating this component and all of its children too
Source§

fn get_width(&self) -> u16

Source§

fn get_height(&self) -> u16

Source§

fn is_fixed_width(&self) -> bool

Source§

fn is_fixed_height(&self) -> bool

Source§

fn render(&mut self, area: Rect, buf: &mut Buffer)

Renders the component to the area specified on the buffer, marking the component as clean when done
Source§

fn get_focus(&self) -> Focus

Returns if any child component have focus or partial focus
Source§

fn get_name(&self) -> String

Source§

fn get_border(&self, x: u16, y: u16) -> Option<Border>

Returns which border the x,y position is on, or none if not on a border
Source§

impl From<Component> for ContainerChild

Source§

fn from(c: Component) -> Self

Converts to this type from the input type.

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.