table.rs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. use super::{do_fit, ArrangementCalculator};
  2. use crate::{
  3. layout::{cache::NodeState, LayoutNodeAccess, SizePolicy},
  4. math::{PixelBox, PixelPoint, PixelSize},
  5. };
  6. use std::ops::Add;
  7. #[derive(Clone, Debug)]
  8. pub struct TableArrangement;
  9. impl TableArrangement {
  10. fn max_coord(&self, node: &LayoutNodeAccess) -> Option<(usize, usize)> {
  11. let Some(tc) = &node.table_cells else {
  12. return None;
  13. };
  14. let mut max_row = None;
  15. let mut max_col = None;
  16. for cell in tc.iter() {
  17. max_col = max_col.max(Some(cell.0 .0));
  18. max_row = max_row.max(Some(cell.0 .1));
  19. }
  20. max_row.zip(max_col)
  21. }
  22. }
  23. impl ArrangementCalculator for TableArrangement {
  24. fn arrange_step(
  25. &self,
  26. node: LayoutNodeAccess,
  27. child_policies: Vec<(SizePolicy, SizePolicy)>,
  28. ) -> (SizePolicy, SizePolicy) {
  29. // pull row/column information from child node properties
  30. todo!()
  31. }
  32. fn layout_step(&self, node: LayoutNodeAccess, inside: PixelBox) {}
  33. }