Accessibility System: - Role enum for all widget types (button, checkbox, slider, tree, table, menu, dialog, etc.) - State packed struct (disabled, focused, selected, checked, expanded, pressed, invalid, readonly, required, busy) - Info struct with label, description, value, position, level, controls, labelled_by - Manager for tracking widget accessibility info - announce() method for screen reader announcements - Live region support (polite, assertive) - Helper constructors for common patterns Testing Framework: - TestRunner for simulating user interactions: - Mouse: click, doubleClick, drag, scroll, moveMouse - Keyboard: pressKey, typeText, shortcut - Time: tick, waitFrames, advanceTime - SnapshotTester for visual regression testing: - capture() to save framebuffer - compare() to diff against baseline - update() to update baseline - Assertions module: - assertVisible, assertContains, assertIntersects - assertColorEqual, assertColorNear - assertInRange Widget count: 35 widgets Test count: 274 tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
190 lines
7.3 KiB
Zig
190 lines
7.3 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");
|
|
pub const clipboard = @import("core/clipboard.zig");
|
|
pub const dragdrop = @import("core/dragdrop.zig");
|
|
pub const DragDropManager = dragdrop.DragDropManager;
|
|
pub const DragData = dragdrop.DragData;
|
|
pub const DropZone = dragdrop.DropZone;
|
|
pub const DropResult = dragdrop.DropResult;
|
|
pub const shortcuts = @import("core/shortcuts.zig");
|
|
pub const ShortcutManager = shortcuts.ShortcutManager;
|
|
pub const Shortcut = shortcuts.Shortcut;
|
|
pub const focus_group = @import("core/focus_group.zig");
|
|
pub const FocusGroup = focus_group.FocusGroup;
|
|
pub const FocusGroupManager = focus_group.FocusGroupManager;
|
|
pub const accessibility = @import("core/accessibility.zig");
|
|
pub const A11yRole = accessibility.Role;
|
|
pub const A11yState = accessibility.State;
|
|
pub const A11yInfo = accessibility.Info;
|
|
pub const A11yManager = accessibility.Manager;
|
|
|
|
// =============================================================================
|
|
// 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;
|
|
pub const ttf = @import("render/ttf.zig");
|
|
pub const TtfFont = ttf.TtfFont;
|
|
pub const FontRef = ttf.FontRef;
|
|
pub const animation = @import("render/animation.zig");
|
|
pub const effects = @import("render/effects.zig");
|
|
pub const antialiasing = @import("render/antialiasing.zig");
|
|
};
|
|
|
|
// Animation re-exports
|
|
pub const Animation = render.animation.Animation;
|
|
pub const AnimationManager = render.animation.AnimationManager;
|
|
pub const Easing = render.animation.Easing;
|
|
pub const lerp = render.animation.lerp;
|
|
pub const lerpInt = render.animation.lerpInt;
|
|
|
|
// Effects re-exports
|
|
pub const Shadow = render.effects.Shadow;
|
|
pub const Gradient = render.effects.Gradient;
|
|
pub const GradientDirection = render.effects.GradientDirection;
|
|
pub const applyShadow = render.effects.applyShadow;
|
|
pub const applyGradient = render.effects.applyGradient;
|
|
pub const applyBlur = render.effects.applyBlur;
|
|
pub const interpolateColor = render.effects.interpolateColor;
|
|
pub const applyOpacity = render.effects.applyOpacity;
|
|
pub const highlight = render.effects.highlight;
|
|
pub const lowlight = render.effects.lowlight;
|
|
|
|
// Anti-aliasing re-exports
|
|
pub const AAQuality = render.antialiasing.Quality;
|
|
pub const drawLineAA = render.antialiasing.drawLineAA;
|
|
pub const drawCircleAA = render.antialiasing.drawCircleAA;
|
|
pub const drawRoundedRectAA = render.antialiasing.drawRoundedRectAA;
|
|
pub const drawEllipseAA = render.antialiasing.drawEllipseAA;
|
|
pub const drawPolygonAA = render.antialiasing.drawPolygonAA;
|
|
|
|
// =============================================================================
|
|
// Backend
|
|
// =============================================================================
|
|
pub const backend = struct {
|
|
pub const Backend = @import("backend/backend.zig").Backend;
|
|
pub const Sdl2Backend = @import("backend/sdl2.zig").Sdl2Backend;
|
|
};
|
|
|
|
// =============================================================================
|
|
// Utils (Performance utilities)
|
|
// =============================================================================
|
|
pub const utils = @import("utils/utils.zig");
|
|
pub const FrameArena = utils.FrameArena;
|
|
pub const ScopedArena = utils.ScopedArena;
|
|
pub const ObjectPool = utils.ObjectPool;
|
|
pub const CommandPool = utils.CommandPool;
|
|
pub const RingBuffer = utils.RingBuffer;
|
|
|
|
// Benchmarking
|
|
pub const Benchmark = utils.Benchmark;
|
|
pub const Timer = utils.Timer;
|
|
pub const FrameTimer = utils.FrameTimer;
|
|
pub const AllocationTracker = utils.AllocationTracker;
|
|
|
|
// =============================================================================
|
|
// Widgets
|
|
// =============================================================================
|
|
pub const widgets = @import("widgets/widgets.zig");
|
|
|
|
// =============================================================================
|
|
// Panels (Lego Panels architecture)
|
|
// =============================================================================
|
|
pub const panels = @import("panels/panels.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;
|
|
|
|
// Theme system
|
|
pub const Theme = Style.Theme;
|
|
pub const ThemeManager = Style.ThemeManager;
|
|
pub const getThemeManager = Style.getThemeManager;
|
|
pub const currentTheme = Style.currentTheme;
|
|
|
|
// =============================================================================
|
|
// Tests
|
|
// =============================================================================
|
|
test {
|
|
std.testing.refAllDecls(@This());
|
|
}
|