1
0
Fork 0
forked from wry/wry

control-center: add idle pane

This commit is contained in:
Julian Orth 2026-03-07 13:50:26 +01:00
parent eb917648c1
commit ba044793dc
7 changed files with 101 additions and 18 deletions

View file

@ -1,6 +1,6 @@
use {
crate::{
control_center::cc_compositor::CompositorPane,
control_center::{cc_compositor::CompositorPane, cc_idle::IdlePane},
egui_adapter::egui_platform::{
EggError, EggWindow, EggWindowOwner,
icons::{ICON_CLOSE, ICON_DRAG_INDICATOR, ICON_INFO},
@ -31,6 +31,7 @@ use {
};
mod cc_compositor;
mod cc_idle;
mod cc_sidebar;
#[derive(Debug, Error)]
@ -65,6 +66,7 @@ pub struct ControlCenters {
bitflags! {
ControlCenterInterest: u32;
CCI_COMPOSITOR,
CCI_IDLE,
}
pub struct ControlCenter {
@ -106,6 +108,7 @@ struct PaneState {
enum PaneType {
Compositor(CompositorPane),
Idle(IdlePane),
}
struct CcBehavior<'a> {
@ -125,12 +128,14 @@ impl Pane {
fn title(&self, res: &mut String) {
match &self.ty {
PaneType::Compositor(v) => v.title(res),
PaneType::Idle(v) => v.title(res),
}
}
fn show(&mut self, _behavior: &mut CcBehavior<'_>, ui: &mut Ui) {
match &mut self.ty {
PaneType::Compositor(p) => p.show(ui),
PaneType::Idle(p) => p.show(ui),
}
}
}
@ -139,6 +144,7 @@ impl PaneType {
fn interest(&self) -> ControlCenterInterest {
match self {
PaneType::Compositor(_) => CCI_COMPOSITOR,
PaneType::Idle(_) => CCI_IDLE,
}
}
}