adding RenderConfig, and some test frames on widgets

This commit is contained in:
Csaba
2024-11-06 23:49:55 +01:00
parent 36e3eaad36
commit e8f5952abb
11 changed files with 104 additions and 36 deletions
+18 -1
View File
@@ -1,5 +1,6 @@
use crate::battery::Battery;
use crate::battery::BatteryConfig;
use crate::config::KomobarConfig;
use crate::cpu::Cpu;
use crate::cpu::CpuConfig;
use crate::date::Date;
@@ -21,9 +22,25 @@ use eframe::egui::Ui;
use schemars::JsonSchema;
use serde::Deserialize;
use serde::Serialize;
use std::sync::Arc;
pub trait BarWidget {
fn render(&mut self, ctx: &Context, ui: &mut Ui);
fn render(&mut self, ctx: &Context, ui: &mut Ui, config: RenderConfig);
}
#[derive(Clone)]
pub struct RenderConfig {
group: i32,
}
impl RenderConfig {
pub fn from(config: Arc<KomobarConfig>) -> Self {
Self { group: 1 }
}
//fn clone(&self) -> Self {
// Self { group: self.group }
//}
}
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]