git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commit3e86d72fc7d21aecb0ae6646f98043e3c3be7197
parent8d48c406c1
authorLucas Galante <lsgalante12@gmail.com>
date2026-10-07 11:24
feat(spreadsheet): content_width, how wide the table is

A host sizes its pane by it: the designer's plate is as wide as the table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

 src/widget/container/spreadsheet.rs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/widget/container/spreadsheet.rs b/src/widget/container/spreadsheet.rs
index 025d9b3..d9bed9b 100644
--- a/src/widget/container/spreadsheet.rs
+++ b/src/widget/container/spreadsheet.rs
@@ -305,6 +305,13 @@ impl Spreadsheet {
         edges
     }
 
+    /// How wide the table is: its columns, each as wide as its content. A
+    /// host sizes the pane by it — the designer's plate is as wide as the
+    /// table, up to the room it has (since 2026-10-07).
+    pub fn content_width(&self) -> f32 {
+        self.col_edges().last().copied().unwrap_or(0.0)
+    }
+
     /// Horizontal counterpart of [`geom`]: present only when the column run is
     /// wider than the pane.
     fn hgeom(&self, rect: Rect) -> Option<HScrollGeom> {