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

commitfed3d6769ef738a25cd2839eb976bb5a57bd6c8e
parenta2734de0a6
authorLucas Galante <[email protected]>
date2026-07-01 12:54
Use engine-rendered rounded backgrounds and solid borders for ScrollingList and TreeList to correctly apply corner_radius configuration key

 src/widget/container/scroll_box.rs     | 13 +------------
 src/widget/container/scrolling_list.rs | 21 +++++++++++++++++++++
 src/widget/container/treelist.rs       | 25 +++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 12 deletions(-)

diff --git a/src/widget/container/scroll_box.rs b/src/widget/container/scroll_box.rs
index 7ddcef4..8aa57b6 100644
--- a/src/widget/container/scroll_box.rs
+++ b/src/widget/container/scroll_box.rs
@@ -112,18 +112,7 @@ impl Element for ScrollBox {
         // Background
         quads.push((self.base.x, self.base.y, self.base.w, self.base.h, crate::color::list_bg_color()));
 
-        // Border lines
-        let box_border_color = if focus::is_focused(self) {
-            [0.30, 0.50, 0.32, 1.0] // Focused green
-        } else if self.base.hovered {
-            [0.25, 0.25, 0.35, 1.0] // Hovered
-        } else {
-            [0.18, 0.18, 0.24, 1.0] // Default
-        };
-        quads.push((self.base.x, self.base.y, self.base.w, 1.0, box_border_color)); // Top
-        quads.push((self.base.x, self.base.y + self.base.h - 1.0, self.base.w, 1.0, box_border_color)); // Bottom
-        quads.push((self.base.x, self.base.y, 1.0, self.base.h, box_border_color)); // Left
-        quads.push((self.base.x + self.base.w - 1.0, self.base.y, 1.0, self.base.h, box_border_color)); // Right
+
 
         // Scrollbar
         if self.content_h > self.viewport_h {
diff --git a/src/widget/container/scrolling_list.rs b/src/widget/container/scrolling_list.rs
index 9e1be06..45778b9 100644
--- a/src/widget/container/scrolling_list.rs
+++ b/src/widget/container/scrolling_list.rs
@@ -60,9 +60,30 @@ impl Element for ScrollingList {
         self.scroll_box.color()
     }
 
+    fn rounded_corners(&self) -> (bool, bool, bool, bool) {
+        (true, true, true, true)
+    }
+
     fn corner_radius(&self) -> f32 {
         crate::layout::list_corner_radius()
     }
+
+    fn solid_border(&self) -> Option<([f32; 4], f32)> {
+        let is_focused = focus::is_focused(self) || focus::is_focused(&self.scroll_box);
+        let is_hovered = self.hovered() || self.scroll_box.base.hovered;
+        if self.scroll_box.show_border {
+            let box_border_color = if is_focused {
+                [0.30, 0.50, 0.32, 1.0]
+            } else if is_hovered {
+                [0.25, 0.25, 0.35, 1.0]
+            } else {
+                [0.18, 0.18, 0.24, 1.0]
+            };
+            Some((box_border_color, 1.0))
+        } else {
+            None
+        }
+    }
     fn as_ptr(&self) -> *mut (dyn Element + 'static) {
         self as *const Self as *mut Self as *mut (dyn Element + 'static)
     }
diff --git a/src/widget/container/treelist.rs b/src/widget/container/treelist.rs
index 0539e89..c3baede 100644
--- a/src/widget/container/treelist.rs
+++ b/src/widget/container/treelist.rs
@@ -207,6 +207,31 @@ impl Element for TreeList {
         [0.0, 0.0, 0.0, 0.0]
     }
 
+    fn rounded_corners(&self) -> (bool, bool, bool, bool) {
+        (true, true, true, true)
+    }
+
+    fn corner_radius(&self) -> f32 {
+        crate::layout::tree_corner_radius()
+    }
+
+    fn solid_border(&self) -> Option<([f32; 4], f32)> {
+        let is_focused = focus::is_focused(self) || focus::is_focused(&self.scroll_box);
+        let is_hovered = self.hovered() || self.hovered_row_idx.is_some() || self.scroll_box.base.hovered;
+        if self.scroll_box.show_border {
+            let box_border_color = if is_focused {
+                [0.30, 0.50, 0.32, 1.0]
+            } else if is_hovered {
+                [0.25, 0.25, 0.35, 1.0]
+            } else {
+                [0.18, 0.18, 0.24, 1.0]
+            };
+            Some((box_border_color, 1.0))
+        } else {
+            None
+        }
+    }
+
     fn focus(&mut self) {
         focus::set_focused(self);
     }