GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
Added option to hide ScrollBox background and disabled it in TreeList to expose tree_background_color
src/widget/container/scroll_box.rs | 6 +++++-
src/widget/container/treelist.rs | 4 +++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/widget/container/scroll_box.rs b/src/widget/container/scroll_box.rs
index 77d92f5..c9d6b1c 100644
--- a/src/widget/container/scroll_box.rs
+++ b/src/widget/container/scroll_box.rs
@@ -10,6 +10,7 @@ pub struct ScrollBox {
viewport_offset_y: f32,
viewport_offset_h: f32,
pub show_border: bool,
+ pub show_background: bool,
pub parent: Option<*mut (dyn Element + 'static)>,
pub children: Vec<*mut (dyn Element + 'static)>,
}
@@ -25,6 +26,7 @@ impl ScrollBox {
viewport_offset_y: 0.0,
viewport_offset_h: 0.0,
show_border: true,
+ show_background: true,
parent: None,
children: Vec::new(),
}
@@ -110,7 +112,9 @@ impl Element for ScrollBox {
let mut quads = Vec::new();
// Background
- quads.push((self.base.x, self.base.y, self.base.w, self.base.h, crate::color::list_bg_color()));
+ if self.show_background {
+ quads.push((self.base.x, self.base.y, self.base.w, self.base.h, crate::color::list_bg_color()));
+ }
diff --git a/src/widget/container/treelist.rs b/src/widget/container/treelist.rs
index 11123b7..b52836b 100644
--- a/src/widget/container/treelist.rs
+++ b/src/widget/container/treelist.rs
@@ -183,9 +183,11 @@ pub struct TreeList {
impl TreeList {
pub fn new() -> Self {
+ let mut scroll_box = ScrollBox::new();
+ scroll_box.show_background = false;
Self {
base: Widget::new(),
- scroll_box: ScrollBox::new(),
+ scroll_box,
search_box: TextBox::new(String::new()).with_placeholder("Search..."),
flat_keys: Vec::new(),
annotations: Vec::new(),