Go to file
Samuel e4afb24484
Implement custom cursors. (#178)
2024-05-01 17:09:29 -03:00
.cargo Fix do semver-check and resolve license issue. 2024-04-14 10:44:53 -03:00
.github Update contributing. 2024-04-29 23:41:42 -03:00
.vscode Add app-process crash handler (#129) 2024-04-24 16:39:06 -03:00
crates Implement custom cursors. (#178) 2024-05-01 17:09:29 -03:00
examples Implement custom cursors. (#178) 2024-05-01 17:09:29 -03:00
tests Implement custom cursors. (#178) 2024-05-01 17:09:29 -03:00
tools Add release changes to workflow. 2024-04-26 22:51:08 -03:00
.gitattributes More EOF fixes. 2021-09-06 15:22:40 -03:00
.gitignore Fix prebuild. 2024-04-17 14:30:58 -03:00
.gitmodules Changed webrender to be linked directly from git again. 2023-07-13 15:35:44 -03:00
CHANGELOG.md Implement custom cursors. (#178) 2024-05-01 17:09:29 -03:00
CODE_OF_CONDUCT.md Added dual license and code of conduct. 2024-03-30 19:04:53 -03:00
CONTRIBUTING.md Update contributing. 2024-04-29 23:41:42 -03:00
Cargo.toml Implement deadlinks checking in do doc (#120) 2024-04-20 17:06:37 -03:00
LICENSE-APACHE Added dual license and code of conduct. 2024-03-30 19:04:53 -03:00
LICENSE-MIT Update LICENSE-MIT to match zng-ui.github.io 2024-04-08 21:30:16 -03:00
README.md Remove Windows 8 help. 2024-04-27 00:20:37 -03:00
SECURITY.md Add security policy. 2024-04-09 15:55:21 -03:00
do Refactored do to be a cargo alias. 2021-11-09 20:18:21 -03:00
do.bat Refactored do to be a cargo alias. 2021-11-09 20:18:21 -03:00
do.ps1 Refactored do to be a cargo alias. 2021-11-09 20:18:21 -03:00
rustfmt.toml Speedup `do publish --test`. 2024-04-08 15:50:06 -03:00

README.md

License-APACHE License-MIT Crates.io Documentation

zng

Zng is a cross-platform GUI framework, it provides ready made highly customizable widgets, responsive layout, live data binding, easy localization, automatic focus navigation and accessibility, async and multi-threaded tasks, robust multi-process architecture and more.

Zng is pronounced "zing", or as an initialism: ZNG (Z Nesting Graphics).

Usage

First add zng to your Cargo.toml, or call cargo add zng -F view_prebuilt:

[dependencies]
zng = { version = "0.4.0", features = ["view_prebuilt"] }

Then create your first window:

use zng::prelude::*;

fn main() {
    zng::view_process::prebuilt::init();
    APP.defaults().run_window(async {
        let size = var(layout::Size::new(800, 600));
        Window! {
            title = size.map(|s| formatx!("Button Example - {s}"));
            size;
            child_align = Align::CENTER;
            child = Button! {
                on_click = hn!(|_| {
                    println!("Button clicked!");
                });
                text::font_size = 28;
                child = Text!("Click Me!");
            }
        }
    })
}

See the documentation for more details.

Crates

The zng crate is the only dependency you need to create apps, it re-exports the primary API of the other crates in well organized and documented modules.

The other crates provide the full API that you might need to implement more advanced features, for example, a custom property that modifies the behavior of a widget might need to reference the widget's internal state, this internal API will only be available in the widget's crate.

Cargo Features

The Cargo features of each crate are documented in the README file for that crate. See ./crates/zng for the Cargo features of the main crate.

Requirements

On Windows:

  • To build with "view" and "view_software" feature:
    • Env vars CC and CXX must be set to "clang-cl".
    • You can install clang using the Visual Studio installer or by installing LLVM directly.

on Linux:

  • Packages needed to build:

    • pkg-config
    • libfontconfig1-dev
  • Packages needed to build with "http" feature:

    • libssl-dev
  • Packages needed to build with "view_prebuilt" feature:

    • curl

Examples

Clone this repository and call cargo do run <example> to run an example.

See the ./examples README file for a list of examples with description and screenshots.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.