added widget grouping and group module

This commit is contained in:
Csaba
2024-11-08 00:40:13 +01:00
parent f446a6a45f
commit d188222be7
14 changed files with 436 additions and 376 deletions
+20 -18
View File
@@ -80,7 +80,7 @@ impl Storage {
}
impl BarWidget for Storage {
fn render(&mut self, ctx: &Context, ui: &mut Ui, _config: RenderConfig) {
fn render(&mut self, ctx: &Context, ui: &mut Ui, mut config: RenderConfig) {
if self.enable {
let font_id = ctx
.style()
@@ -108,25 +108,27 @@ impl BarWidget for Storage {
TextFormat::simple(font_id.clone(), ctx.style().visuals.text_color()),
);
if ui
.add(
Label::new(layout_job)
.selectable(false)
.sense(Sense::click()),
)
.clicked()
{
if let Err(error) = Command::new("cmd.exe")
.args([
"/C",
"explorer.exe",
output.split(' ').collect::<Vec<&str>>()[0],
])
.spawn()
config.grouping.apply_on_widget(ui, |ui| {
if ui
.add(
Label::new(layout_job)
.selectable(false)
.sense(Sense::click()),
)
.clicked()
{
eprintln!("{}", error)
if let Err(error) = Command::new("cmd.exe")
.args([
"/C",
"explorer.exe",
output.split(' ').collect::<Vec<&str>>()[0],
])
.spawn()
{
eprintln!("{}", error)
}
}
}
});
ui.add_space(WIDGET_SPACING);
}