use crate::base::RectF;
use crate::kernel::PainterTrait;
use crate::shapes::ShapeTrait;
#[allow(clippy::module_name_repetitions)]
#[derive(Debug)]
pub struct TextShape {
text: String,
container_rect: RectF,
path_is_dirty: bool,
}
impl TextShape {
#[must_use]
pub const fn new(text: String, container_rect: RectF) -> Self {
Self {
text,
container_rect,
path_is_dirty: true,
}
}
#[must_use]
pub fn text(&self) -> &str {
&self.text
}
pub fn set_text(&mut self, text: String) {
if self.text != text {
self.text = text;
self.path_is_dirty = true;
}
}
#[must_use]
pub const fn container_rect(&self) -> &RectF {
&self.container_rect
}
pub fn set_container_rect(&mut self, container_rect: RectF) {
if self.container_rect != container_rect {
self.container_rect = container_rect;
self.path_is_dirty = true;
}
}
}
impl ShapeTrait for TextShape {
fn bounding_rect(&self) -> RectF {
todo!()
}
fn repaint(&mut self, _painter: &mut dyn PainterTrait) {}
}