Add calendar, refactor more

This commit is contained in:
Kenny Levinsen
2023-01-16 00:25:34 +01:00
parent 3a40bb18c5
commit 7593cd48a4
15 changed files with 689 additions and 286 deletions
+6 -7
View File
@@ -9,8 +9,9 @@ use crate::{
};
pub trait BarWidgetImpl {
fn get_dirty(&self) -> bool;
fn set_dirty(&mut self, dirty: bool);
fn get_dirty(&self) -> bool {
false
}
fn name(&self) -> &'static str;
fn value(&self) -> f32;
fn color(&self) -> Color;
@@ -27,7 +28,9 @@ impl BarWidget {
pub fn new(inner_widget: Box<dyn BarWidgetImpl>, font: &'static str, size: f32) -> BarWidget {
BarWidget {
geometry: Default::default(),
inner_widget, font, size,
inner_widget,
font,
size,
}
}
}
@@ -41,10 +44,6 @@ impl Widget for BarWidget {
self.inner_widget.get_dirty()
}
fn set_dirty(&mut self, dirty: bool) {
self.inner_widget.set_dirty(dirty)
}
fn draw(&mut self, fonts: &mut FontMap, view: &mut BufferView) -> Geometry {
let font = fonts.get_font(self.font, self.size);
let fg = Color::new(1., 1., 1., 1.);