1
0
Fork 0
forked from wry/wry

control-center: add color management pane

This commit is contained in:
Julian Orth 2026-02-23 20:35:21 +01:00
parent ba044793dc
commit 6f103eac88
4 changed files with 54 additions and 3 deletions

View file

@ -0,0 +1,36 @@
use {
crate::{
control_center::{ControlCenterInner, bool, grid, read_only_bool},
state::State,
},
egui::Ui,
std::rc::Rc,
};
pub struct ColorManagementPane {
state: Rc<State>,
}
impl ControlCenterInner {
pub fn create_color_management_pane(self: &Rc<Self>) -> ColorManagementPane {
ColorManagementPane {
state: self.state.clone(),
}
}
}
impl ColorManagementPane {
pub fn title(&self, res: &mut String) {
res.push_str("Color Management");
}
pub fn show(&mut self, ui: &mut Ui) {
let s = &self.state;
grid(ui, "settings", |ui| {
bool(ui, "Enabled", s.color_management_enabled.get(), |b| {
s.set_color_management_enabled(b);
});
read_only_bool(ui, "Available", s.color_management_available());
});
}
}

View file

@ -10,6 +10,7 @@ use {
enum PaneName {
Compositor,
Idle,
ColorManagement,
}
impl PaneName {
@ -17,6 +18,7 @@ impl PaneName {
match self {
PaneName::Compositor => "Compositor",
PaneName::Idle => "Idle",
PaneName::ColorManagement => "Color Management",
}
}
}
@ -45,6 +47,9 @@ impl ControlCenterInner {
PaneType::Compositor(self.create_compositor_pane())
}
PaneName::Idle => PaneType::Idle(self.create_idle_pane()),
PaneName::ColorManagement => {
PaneType::ColorManagement(self.create_color_management_pane())
}
};
self.open(tree, ty);
ui.ctx().request_repaint();