docs.rs failed to build hyperchad_renderer_fltk-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
hyperchad_renderer_fltk-0.1.0
HyperChad FLTK Renderer
Cross-platform native GUI renderer for HyperChad using the FLTK (Fast Light Toolkit) framework.
Overview
The HyperChad FLTK Renderer provides:
- Lightweight Native GUI: Fast, lightweight native desktop applications
- Cross-platform: Works on Windows, macOS, and Linux with native look and feel
- Low Resource Usage: Minimal memory and CPU footprint
- Retained Mode GUI: Traditional widget-based GUI architecture
- Layout Engine: Complete flexbox and positioning layout system
- Image Support: Async image loading with caching and format support
- Event System: Navigation events with async waiting support
- Viewport Management: Scrolling and viewport-aware rendering
Supported Elements
Fully Supported
- Containers:
div,aside,header,footer,main,section,form,span,details,summary - Lists:
ul(unordered list),ol(ordered list),li(list item) - Tables:
table,thead,th,tbody,tr,td - Text:
h1,h2,h3,h4,h5,h6(headings), raw text - Images:
img(with async loading, HTTP support, and local file support) - Links:
a(anchor with navigation support) - Buttons:
button(rendered as containers) - Dropdowns:
selectwithoptionchildren (rendered as FLTK Choice widget)
Not Rendered
- Form Inputs:
input(text, password, checkbox, radio, etc.) - Canvas:
canvas(element exists but no rendering implementation)
Features
Native GUI Capabilities
- FLTK Widgets: Rendering of HyperChad elements using FLTK widgets
- Native Styling: Platform-native appearance and behavior
- Window Management: Single-window support with resize handling
- Planned: Menu systems, dialog boxes, and multi-window support
Layout and Styling
- Flexbox Layout: Complete CSS flexbox implementation
- Positioning: Support for layout positioning
- Spacing: Margins, padding, and gap support
- Sizing: Width, height, min/max constraints
- Typography: Font families, sizes, and text styling
- Colors: Background colors, text colors, and theming
Interactive Elements
- Containers: Divs, sections, headers, footers, and other semantic elements
- Clickable Elements: Anchors with navigation
- Scrollable Areas: Horizontal and vertical scrolling with overflow support
- Event Handling: Navigation events
- Dropdowns: Select elements with option children
- Planned: Form inputs (text, checkbox, radio)
Image and Media
- Image Loading: Async HTTP image loading with caching
- Image Formats: Support for PNG, JPEG, GIF, and other formats
- Image Scaling: Automatic scaling and aspect ratio preservation
- Asset Management: Local and remote asset loading
Installation
Add this to your Cargo.toml:
[]
= { = "../hyperchad/renderer/fltk" }
# With debug features
= {
path = "../hyperchad/renderer/fltk",
= ["debug"]
}
System Dependencies
Ubuntu/Debian:
macOS:
# FLTK is included in the build
# No additional dependencies needed
Windows:
# FLTK is statically linked
# No additional dependencies needed
Usage
Basic Desktop Application
use FltkRenderer;
use container;
use ;
use Value;
use unbounded;
async
Button Layout Application
use container;
let button_view = container! ;
renderer.render.await?;
Note: Form inputs (text, password, checkbox) are not yet implemented. The input element exists but is not currently rendered by the FLTK renderer. button elements are rendered, but click action dispatch is not implemented by this renderer.
Image Gallery
use container;
let gallery_view = container! ;
renderer.render.await?;
Scrollable Content
use container;
let scrollable_view = container! ;
renderer.render.await?;
Event Handling
// Handle navigation events from anchor interactions
spawn;
Navigation Between Views
use container;
// Main menu view
let menu_view = container! ;
// Render and handle navigation
renderer.render.await?;
// Wait for navigation event
if let Some = renderer.wait_for_navigation.await
Layout System
Flexbox Support
- Direction: row, column, row-reverse, column-reverse
- Justify Content: start, center, end, space-between, space-around
- Align Items: start, center, end, stretch
- Flex Properties: flex-grow, flex-shrink, flex-basis
- Gap: Space between flex items
Positioning
- Static: Normal document flow
- Relative: Positioned relative to normal position
- Absolute: Positioned relative to parent container
- Fixed: Positioned relative to window
Sizing
- Fixed Sizes: Pixel values for width and height
- Percentage: Relative to parent container
- Constraints: min-width, max-width, min-height, max-height
- Flex: Flexible sizing based on available space
Image Loading
Supported Formats
- PNG: Portable Network Graphics
- JPEG: Joint Photographic Experts Group
- GIF: Graphics Interchange Format
- BMP: Windows Bitmap
- TIFF: Tagged Image File Format
Loading Features
- Async Loading: Non-blocking image loading
- HTTP Support: Load images from URLs
- Caching: Automatic image caching
- Scaling: Automatic scaling to fit containers
- Error Handling: Graceful handling of load failures
Feature Flags
debug: Enable debug rendering and logging (default: enabled)format: Enable formatter support for templates (default: enabled)unsafe: Enable unsafe optimizations (default: enabled)
Performance Characteristics
Advantages
- Low Memory: Minimal memory footprint
- Fast Startup: Quick application startup time
- Native Performance: Native widget performance
- Small Binary: Compact executable size
Considerations
- Retained Mode: Widgets persist between updates
- Layout Calculation: Efficient layout algorithms
- Image Caching: Smart caching to reduce memory usage
- Event Handling: Efficient event propagation
Dependencies
Core Dependencies
- fltk: Fast Light Toolkit GUI library (with ninja build support)
- hyperchad_renderer: Core renderer traits and utilities (with canvas and viewport-retained features)
- hyperchad_transformer: Template transformation and layout engine (with html and layout features)
- hyperchad_actions: Action system and logic (with logic feature)
- moosicbox_app_native_image: Native image asset handling
Runtime Dependencies
- image: Image processing and format support
- switchy_async: Async runtime and task utilities (with sync and tokio features)
- switchy_http: HTTP client for remote image loading (reqwest backend)
- flume: Multi-producer, multi-consumer channels
- bytes: Byte buffer utilities
Integration
This renderer is designed for:
- Desktop Applications: Traditional desktop GUI applications
- Utility Tools: System utilities and development tools
- Embedded Systems: Applications for embedded devices
- Legacy Systems: Integration with existing FLTK applications
- Cross-platform Tools: Applications targeting multiple desktop platforms
Limitations
Not Yet Implemented
- Form Inputs: Text inputs, checkboxes, radio buttons are not rendered
- Multi-Window Support: Currently limited to single window applications
- Native Menus: Menu bars and context menus not implemented
- Dialog Boxes: File choosers and message boxes not integrated
Design Constraints
- Theming: Basic theming capabilities compared to web renderers
- Animations: No animation support
- Advanced CSS: Some advanced CSS features not supported
- Web Technologies: No HTML/CSS/JavaScript integration
- Buttons: Rendered as containers rather than native FLTK buttons