Files
oak-gpui/crates/gpui3/src/active.rs
T
2023-10-17 22:16:48 +02:00

26 lines
671 B
Rust

use crate::{SharedString, StyleRefinement};
pub trait Active {
fn set_active_style(&mut self, group_name: Option<SharedString>, style: StyleRefinement);
fn active(mut self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self
where
Self: Sized,
{
self.set_active_style(None, f(StyleRefinement::default()));
self
}
fn group_active(
mut self,
group_name: impl Into<SharedString>,
f: impl FnOnce(StyleRefinement) -> StyleRefinement,
) -> Self
where
Self: Sized,
{
self.set_active_style(Some(group_name.into()), f(StyleRefinement::default()));
self
}
}