use crate::condition::Condition;
use crate::style::AnyStyleRef;
use crate::CellRef;
use get_size2::GetSize;
#[derive(Clone, Debug, GetSize)]
pub struct StyleMap {
condition: Condition,
applied_style: AnyStyleRef,
base_cell: Option<CellRef>,
}
impl StyleMap {
pub fn new_empty() -> Self {
Self {
condition: Default::default(),
applied_style: AnyStyleRef::from(""),
base_cell: None,
}
}
pub fn new(
condition: Condition,
applied_style: AnyStyleRef,
base_cell: Option<CellRef>,
) -> Self {
Self {
condition,
applied_style,
base_cell,
}
}
pub fn condition(&self) -> &Condition {
&self.condition
}
pub fn set_condition(&mut self, cond: Condition) {
self.condition = cond;
}
pub fn applied_style(&self) -> &AnyStyleRef {
&self.applied_style
}
pub fn set_applied_style(&mut self, style: AnyStyleRef) {
self.applied_style = style;
}
pub fn base_cell(&self) -> Option<&CellRef> {
self.base_cell.as_ref()
}
pub fn set_base_cell(&mut self, cellref: Option<CellRef>) {
self.base_cell = cellref;
}
}