From 206a997628d78041cfc326b86e23590aac30d6ad Mon Sep 17 00:00:00 2001 From: "R.Eugenio" Date: Tue, 23 Dec 2025 13:00:20 +0100 Subject: [PATCH] fix(virtual_list): Usar Style.Color y Command.rect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - VirtualListConfig.Colors ahora usa Style.Color en vez de u32 - Reemplazar Command.fill() por Command.rect() (fill no existe) - Corregir tipo bg_color en drawRows 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/widgets/virtual_list/types.zig | 19 ++++++++++--------- src/widgets/virtual_list/virtual_list.zig | 16 ++++++++-------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/widgets/virtual_list/types.zig b/src/widgets/virtual_list/types.zig index ba57cc5..9f959ff 100644 --- a/src/widgets/virtual_list/types.zig +++ b/src/widgets/virtual_list/types.zig @@ -4,6 +4,7 @@ //! fuente de datos (WHO, DOC, etc.) const std = @import("std"); +const Style = @import("../../core/style.zig"); /// Dirección de ordenación pub const SortDirection = enum { @@ -125,15 +126,15 @@ pub const VirtualListConfig = struct { colors: ?Colors = null, pub const Colors = struct { - background: u32 = 0xFFFFFFFF, - header_background: u32 = 0xFFE0E0E0, - row_normal: u32 = 0xFFFFFFFF, - row_alternate: u32 = 0xFFF8F8F8, - row_selected: u32 = 0xFF0078D4, - row_selected_unfocus: u32 = 0xFFD0D0D0, - text: u32 = 0xFF000000, - text_selected: u32 = 0xFFFFFFFF, - border: u32 = 0xFFCCCCCC, + background: Style.Color = Style.Color.rgb(255, 255, 255), + header_background: Style.Color = Style.Color.rgb(224, 224, 224), + row_normal: Style.Color = Style.Color.rgb(255, 255, 255), + row_alternate: Style.Color = Style.Color.rgb(248, 248, 248), + row_selected: Style.Color = Style.Color.rgb(0, 120, 212), + row_selected_unfocus: Style.Color = Style.Color.rgb(208, 208, 208), + text: Style.Color = Style.Color.rgb(0, 0, 0), + text_selected: Style.Color = Style.Color.rgb(255, 255, 255), + border: Style.Color = Style.Color.rgb(204, 204, 204), }; }; diff --git a/src/widgets/virtual_list/virtual_list.zig b/src/widgets/virtual_list/virtual_list.zig index 199c36e..7320056 100644 --- a/src/widgets/virtual_list/virtual_list.zig +++ b/src/widgets/virtual_list/virtual_list.zig @@ -245,7 +245,7 @@ fn drawHeader( const header_h = config.row_height; // Header background - ctx.pushCommand(Command.fill( + ctx.pushCommand(Command.rect( bounds.x, bounds.y, bounds.w, @@ -291,11 +291,11 @@ fn drawHeader( // Column separator x += @as(i32, @intCast(col.width)); - ctx.pushCommand(Command.fill(x - 1, bounds.y, 1, header_h, colors.border)); + ctx.pushCommand(Command.rect(x - 1, bounds.y, 1, header_h, colors.border)); } // Bottom border - ctx.pushCommand(Command.fill( + ctx.pushCommand(Command.rect( bounds.x, bounds.y + @as(i32, @intCast(header_h)) - 1, bounds.w, @@ -332,7 +332,7 @@ fn drawRows( const is_selected = list_state.selected_id != null and row.id == list_state.selected_id.?; const is_alternate = global_idx % 2 == 1; - const bg_color: u32 = if (is_selected) + const bg_color: Style.Color = if (is_selected) if (list_state.has_focus) colors.row_selected else colors.row_selected_unfocus else if (is_alternate) colors.row_alternate @@ -340,7 +340,7 @@ fn drawRows( colors.row_normal; // Row background - ctx.pushCommand(Command.fill( + ctx.pushCommand(Command.rect( content_bounds.x, row_y, content_bounds.w, @@ -380,7 +380,7 @@ fn drawFooter( list_state: *VirtualListState, ) void { // Background - ctx.pushCommand(Command.fill( + ctx.pushCommand(Command.rect( bounds.x, bounds.y, bounds.w, @@ -435,7 +435,7 @@ fn drawScrollbar( // Scrollbar track const track_x = bounds.x + @as(i32, @intCast(bounds.w - scrollbar_w)); const track_y = bounds.y + @as(i32, @intCast(header_h)); - ctx.pushCommand(Command.fill(track_x, track_y, scrollbar_w, content_h, colors.row_alternate)); + ctx.pushCommand(Command.rect(track_x, track_y, scrollbar_w, content_h, colors.row_alternate)); // Thumb size and position const visible_ratio = @as(f32, @floatFromInt(visible_rows)) / @as(f32, @floatFromInt(total_rows)); @@ -446,7 +446,7 @@ fn drawScrollbar( const thumb_y = track_y + @as(i32, @intFromFloat(scroll_ratio * @as(f32, @floatFromInt(content_h - thumb_h)))); // Draw thumb - ctx.pushCommand(Command.fill(track_x + 2, thumb_y, scrollbar_w - 4, thumb_h, colors.border)); + ctx.pushCommand(Command.rect(track_x + 2, thumb_y, scrollbar_w - 4, thumb_h, colors.border)); } // =============================================================================