diff options
author | metamuffin <yvchraiqi@protonmail.com> | 2022-08-17 08:38:33 +0200 |
---|---|---|
committer | metamuffin <yvchraiqi@protonmail.com> | 2022-08-17 08:38:33 +0200 |
commit | 5e6509163df53788799bb7aa97d07a90bf416eb7 (patch) | |
tree | 902f37c8ffcd7b94a60a230f51418c7b6fb84bc9 /karlgui/src/views/calendar.rs | |
parent | aca12bc6d0194364d9e36c455fbcd2390e00d8be (diff) | |
download | karlender-5e6509163df53788799bb7aa97d07a90bf416eb7.tar karlender-5e6509163df53788799bb7aa97d07a90bf416eb7.tar.bz2 karlender-5e6509163df53788799bb7aa97d07a90bf416eb7.tar.zst |
refactor
Diffstat (limited to 'karlgui/src/views/calendar.rs')
-rw-r--r-- | karlgui/src/views/calendar.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/karlgui/src/views/calendar.rs b/karlgui/src/views/calendar.rs new file mode 100644 index 0000000..b216504 --- /dev/null +++ b/karlgui/src/views/calendar.rs @@ -0,0 +1,34 @@ +use crate::{helper::weekday_to_str, Globals}; +use egui::Ui; +use egui_extras::TableBuilder; + +#[derive(Default)] +pub struct Calendar; + +impl Calendar { + pub fn ui(&mut self, ui: &mut Ui, _g: &mut Globals) { + TableBuilder::new(ui) + .column(egui_extras::Size::exact(50.0)) + .columns(egui_extras::Size::remainder(), 7) + .header(25.0, |mut ui| { + ui.col(|_| {}); + for d in 0..7 { + ui.col(|ui| { + ui.heading(weekday_to_str(d)); + }); + } + }) + .body(|ui| { + ui.rows(50.0, 24, |h, mut ui| { + ui.col(|ui| { + ui.heading(&format!("{h:02}:00")); + }); + for d in 0..7 { + ui.col(|ui| { + ui.label(&format!("day {d} at {h}:00")); + }); + } + }) + }) + } +} |