zcatgui/src/zcatgui.zig
reugenio 6ac3856ae2 feat: zcatgui v0.5.0 - Complete widget library + research docs
Widgets implemented (13 total):
- Label: Static text with alignment
- Button: With importance levels (primary/normal/danger)
- TextInput: Single-line text entry with cursor
- Checkbox: Boolean toggle
- Select: Dropdown selection
- List: Scrollable selectable list
- Focus: Focus manager with tab navigation
- Table: Editable table with dirty tracking, keyboard nav
- Split: HSplit/VSplit draggable panels
- Panel: Container with title bar, collapsible
- Modal: Dialogs (alert, confirm, inputDialog)
- AutoComplete: ComboBox with prefix/contains/fuzzy matching

Core improvements:
- InputState now tracks keyboard state (keys_down, key_events)
- Full keyboard navigation for Table widget

Research documentation:
- WIDGET_COMPARISON.md: zcatgui vs DVUI vs Gio vs zcatui
- SIMIFACTU_ADVANCEDTABLE.md: Analysis of 10K LOC table component
- LEGO_PANELS_SYSTEM.md: Modular panel composition architecture

Examples:
- widgets_demo.zig: All basic widgets showcase
- table_demo.zig: Table, Split, Panel demonstration

All tests passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 11:00:49 +01:00

113 lines
4 KiB
Zig

//! zcatgui - Immediate Mode GUI Library for Zig
//!
//! A software-rendered, cross-platform GUI library with macro recording support.
//!
//! ## Features
//! - Immediate mode paradigm (no callbacks, explicit state)
//! - Software rendering (works everywhere, including SSH)
//! - Macro system for recording/replaying user actions
//! - SDL2 backend for cross-platform support
//!
//! ## Quick Start
//! ```zig
//! const zcatgui = @import("zcatgui");
//!
//! pub fn main() !void {
//! var app = try zcatgui.App.init(allocator, "My App", 800, 600);
//! defer app.deinit();
//!
//! while (app.running) {
//! app.beginFrame();
//!
//! if (app.button("Click me!")) {
//! // Handle click
//! }
//!
//! app.endFrame();
//! }
//! }
//! ```
const std = @import("std");
// =============================================================================
// Core modules
// =============================================================================
pub const Context = @import("core/context.zig").Context;
pub const Layout = @import("core/layout.zig");
pub const Style = @import("core/style.zig");
pub const Input = @import("core/input.zig");
pub const Command = @import("core/command.zig");
// =============================================================================
// Macro system
// =============================================================================
pub const macro = @import("macro/macro.zig");
pub const MacroRecorder = macro.MacroRecorder;
pub const MacroPlayer = macro.MacroPlayer;
pub const KeyEvent = macro.KeyEvent;
// =============================================================================
// Rendering
// =============================================================================
pub const render = struct {
pub const Framebuffer = @import("render/framebuffer.zig").Framebuffer;
pub const SoftwareRenderer = @import("render/software.zig").SoftwareRenderer;
pub const Font = @import("render/font.zig").Font;
};
// =============================================================================
// Backend
// =============================================================================
pub const backend = struct {
pub const Backend = @import("backend/backend.zig").Backend;
pub const Sdl2Backend = @import("backend/sdl2.zig").Sdl2Backend;
};
// =============================================================================
// Widgets
// =============================================================================
pub const widgets = @import("widgets/widgets.zig");
// Re-export common widget types
pub const label = widgets.label.label;
pub const labelEx = widgets.label.labelEx;
pub const labelColored = widgets.label.labelColored;
pub const labelCentered = widgets.label.labelCentered;
pub const button = widgets.button.button;
pub const buttonEx = widgets.button.buttonEx;
pub const buttonPrimary = widgets.button.buttonPrimary;
pub const buttonDanger = widgets.button.buttonDanger;
pub const textInput = widgets.text_input.textInput;
pub const textInputEx = widgets.text_input.textInputEx;
pub const TextInputState = widgets.TextInputState;
pub const checkbox = widgets.checkbox.checkbox;
pub const checkboxEx = widgets.checkbox.checkboxEx;
pub const select = widgets.select.select;
pub const selectEx = widgets.select.selectEx;
pub const SelectState = widgets.SelectState;
pub const list = widgets.list.list;
pub const listEx = widgets.list.listEx;
pub const ListState = widgets.ListState;
pub const FocusManager = widgets.FocusManager;
pub const FocusRing = widgets.FocusRing;
// =============================================================================
// Re-exports for convenience
// =============================================================================
pub const Color = Style.Color;
pub const Rect = Layout.Rect;
pub const Constraint = Layout.Constraint;
// =============================================================================
// Tests
// =============================================================================
test {
std.testing.refAllDecls(@This());
}