Files
lightgui_rust/crates/xframe-demo/examples/XStackBar.rs
T
Muse 76fad722d9 Add 15 XFrame monitor widgets (registry 547 -> 562)
New Archetype::Monitor (MonitorWidget, kind-dispatched draw) for
XHistoryGraph, XCoreGrid, XNetGraph, XTempHistory, XUsageBar,
XStackBar, XVerticalBar, XTachometer, XArcGauge, XDonutGauge,
XProcessList, XLoadBadge, XMonitorButton, XMonitorGrid, XSysBox.

- data/registry.json + data/palette.json: 15 entries, registry kept
  in sorted order (the C extractor requires it); palette Misc/X
  group re-sorted, other sections untouched, registry_index
  refreshed (XGraph 545->548, XSpreadsheet 546->555).
- crates/xframe-widgets/src/monitor.rs: stdlib-only live checks
  (/proc scan, systemctl is-active, TcpStream::connect_timeout),
  poll()/update() with a 2s staleness guard, deterministic demo
  seeding; unit tests incl. headless Canvas draw for all kinds.
- Placeholder 16x16 icons (assets/PROVENANCE.md notes they are
  placeholders pending the C port) + 15 demo examples + README
  monitor-family section (547 -> 562).
- xframe-common ico test tolerates the 15 monitor icons as
  pending until the C icons land (matched by name, not index).

cargo build --workspace: clean, warning-free. xframe-common lib
8/8, xframe-widgets lib 28/28, widget_tests 24/24, demo smoke
3/3, designer palette/seam 4/4 + 4/4 pass.
2026-12-05 17:30:17 +00:00

25 lines
897 B
Rust

//! XStackBar — minimal complete XFrame example.
//!
//! Run it from the workspace root:
//! cargo run -p xframe-demo --example XStackBar
//! It opens an 800x600 window showing one XStackBar widget (press Esc
//! or `q`, or close the window, to quit). The widget is the real
//! `xframe-widgets` implementation for this registry kind, created by
//! `xframe_widgets::create("XStackBar")` inside `xframe_demo::run_widget`
//! — the same code path the `xframe-demo` binary uses.
//!
//! The demo seeds used/cached/buffers/free segments; a host app
//! replaces them with `MonitorWidget::set_segments`.
use std::process::ExitCode;
fn main() -> ExitCode {
match xframe_demo::run_widget("XStackBar", false, None, None) {
Ok(code) => ExitCode::from(code as u8),
Err(e) => {
eprintln!("XStackBar example: {}", e);
ExitCode::from(1)
}
}
}