tuigui 0.23.0

An easy-to-use, highly extensible, and speedy TUI library.
Documentation
use crate::preludes::widget_creation::*;

#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
/// Fill the entire canvas with specific content
/// (think of the bucket tool from something like GIMP or Photoshop)
pub struct FillArea {
    pub content: Option<Content>,
    widget_data: WidgetData,
}

impl FillArea {
    pub fn new(content: Option<Content>) -> Self {
        Self {
            content,
            widget_data: WidgetData::new(),
        }
    }
}

impl Widget for FillArea {
    fn draw(&mut self, canvas: &mut Canvas, _state_frame: Option<&EventStateFrame>) {
        for row in 0..canvas.transform.size.rows {
            for col in 0..canvas.transform.size.cols {
                canvas.set(Position::new(col as i16, row as i16), self.content.clone());
            }
        }
    }

    fn widget_info(&self) -> WidgetInfo {
        WidgetInfo {
            size_info: WidgetSizeInfo::Dynamic {
                min: None,
                max: None,
            },
        }
    }

    fn widget_data(&mut self) -> &mut WidgetData {
        return &mut self.widget_data;
    }
}