kas 0.3.0

GUI Toolkit Abstraction System
Documentation

KAS GUI

home old-home Build Status Docs Minimum rustc version

KAS, the toolKit Abstraction System, is a general-purpose GUI toolkit. Goals of the project are:

  • Fully-functional, intuitive GUIs
  • Embeddable within games or any window manager
  • Fancy/highly flexible hardware-accelerated rendering (but in theory software rendering could be supported too)
  • Easy, expressive specification within code (currently impeded by Rust language limitations which will hopefully be solved in the future)
  • Custom widgets in user code without limitations
  • Bug-free, with an API facilitating compiler correctness lints
  • High performance / low resource usage, other than optional fancy graphics

Status of the project is alpha: progress has been made towards all goals, with signficiant limitations to features and goofy graphics. Portability is somewhat limited, requiring nightly Rust and wgpu support.

Crates:

  • kas: the core of the GUI library, providing most interfaces and logic along with a selection of common widgets
  • kas-macros: a helper crate providing the procedural macros used by kas
  • kas-theme: theming support for KAS (API plus a couple of standard themes, at least for now)
  • kas-wgpu: provides windowing via winit and rendering via wgpu
  • kas-widgets: (unrealised) - providing extra widgets
  • kas-graphs: (unrealised) - plotting widgets

A user depends on kas to write their complete UI specification, and then pastes a few lines of code to initialise kas_wgpu::Toolkit, choose a theme, add window(s), and run the UI.

Examples

For details, see the Examples README.

Calculator Dynamic Clock Gallery Mandlebrot

Installation and Testing

For the most part, Cargo should take care of dependencies, but note:

Next, clone the repository and run the examples as follows:

git clone https://github.com/dhardy/kas.git
cd kas
cargo test
cd kas-wgpu
cargo test
cargo run --example gallery

Features

  • Custom parent widgets with embedded state (at in Qt)
  • Type-safe event handlers from the context of these widgets
  • Custom widgets over high- or low-level event API
  • Custom widgets over high-level draw API (TODO: low level option)
  • Column / row / grid+span layouts (TODO: flow boxes, manual positioning)
  • Width-for-height sizing
  • Custom themes (with full control of sizing and rendering)
  • Touch-screen support
  • Keyboard navigation & accelerator keys
  • Scalable (HiDPI) including fractional scaling
  • Memory and CPU efficient

Optional features

This crate has the following feature flags:

  • internal_doc: turns on some extra documentation intended for internal usage but not for end users. (This only affects documentation.)
  • nightly: enables new_uninit feature to support cloning of Box<dyn Handler> objects
  • winit: adds compatibility code for winit's event and geometry types. Compatibility with other event sources is currently incomplete (TODO).
  • stack_dst: some compatibility impls (see kas-theme's documentation)

Copyright and Licence

The file includes a list of contributors who claim copyright on this project. This list may be incomplete; new contributors may optionally add themselves to this list.

The KAS library is published under the terms of the Apache License, Version 2.0. You may obtain a copy of this licence from the file or on the following webpage: https://www.apache.org/licenses/LICENSE-2.0