Widgets implementados (13): - Block, Paragraph, List, Table - Gauge, LineGauge, Tabs, Sparkline - Scrollbar, BarChart, Canvas, Chart - Calendar (Monthly), Clear Modulos: - src/text.zig: Span, Line, Text, Alignment - src/symbols/: line, border, block, bar, braille, half_block, scrollbar, marker - src/widgets/: todos los widgets con tests Documentacion: - docs/ARCHITECTURE.md: arquitectura tecnica - docs/WIDGETS.md: guia completa de widgets - docs/API.md: referencia rapida - CLAUDE.md: actualizado con estado v1.0 Tests: 103+ tests en widgets, todos pasan 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
80 lines
1.9 KiB
Zig
80 lines
1.9 KiB
Zig
//! Scrollbar element characters.
|
|
//!
|
|
//! Provides character sets for drawing scrollbars with different styles.
|
|
|
|
const std = @import("std");
|
|
const line = @import("line.zig");
|
|
const block = @import("block.zig");
|
|
|
|
// ============================================================================
|
|
// Scrollbar Set
|
|
// ============================================================================
|
|
|
|
/// A set of characters for drawing a scrollbar.
|
|
/// ```
|
|
/// <--▮------->
|
|
/// ^ ^ ^ ^
|
|
/// │ │ │ └ end
|
|
/// │ │ └──── track
|
|
/// │ └──────── thumb
|
|
/// └─────────── begin
|
|
/// ```
|
|
pub const Set = struct {
|
|
track: []const u8,
|
|
thumb: []const u8,
|
|
begin: []const u8,
|
|
end: []const u8,
|
|
|
|
pub const default: Set = VERTICAL;
|
|
};
|
|
|
|
/// Vertical scrollbar with arrows.
|
|
/// ```
|
|
/// ↑
|
|
/// │
|
|
/// █
|
|
/// │
|
|
/// ↓
|
|
/// ```
|
|
pub const VERTICAL: Set = .{
|
|
.track = line.VERTICAL,
|
|
.thumb = block.FULL,
|
|
.begin = "↑",
|
|
.end = "↓",
|
|
};
|
|
|
|
/// Horizontal scrollbar with arrows.
|
|
/// ```
|
|
/// ←───█───→
|
|
/// ```
|
|
pub const HORIZONTAL: Set = .{
|
|
.track = line.HORIZONTAL,
|
|
.thumb = block.FULL,
|
|
.begin = "←",
|
|
.end = "→",
|
|
};
|
|
|
|
/// Vertical scrollbar with double line track.
|
|
pub const DOUBLE_VERTICAL: Set = .{
|
|
.track = line.DOUBLE_VERTICAL,
|
|
.thumb = block.FULL,
|
|
.begin = "▲",
|
|
.end = "▼",
|
|
};
|
|
|
|
/// Horizontal scrollbar with double line track.
|
|
pub const DOUBLE_HORIZONTAL: Set = .{
|
|
.track = line.DOUBLE_HORIZONTAL,
|
|
.thumb = block.FULL,
|
|
.begin = "◄",
|
|
.end = "►",
|
|
};
|
|
|
|
// ============================================================================
|
|
// Tests
|
|
// ============================================================================
|
|
|
|
test "scrollbar set default" {
|
|
try std.testing.expectEqualStrings(line.VERTICAL, Set.default.track);
|
|
try std.testing.expectEqualStrings(block.FULL, Set.default.thumb);
|
|
}
|