zng/examples
Samuel Guerra 012f54e470 Text API work, emoji segmentation. 2023-06-17 23:27:34 -03:00
..
res Text API work, emoji segmentation. 2023-06-17 23:27:34 -03:00
util All tests pass. 2023-02-28 23:53:56 -03:00
Cargo.toml Started implementing example of view extension for custom rendering. 2023-06-06 22:30:04 -03:00
README.md More refactor. 2023-04-12 15:42:03 -03:00
animation.rs Refactored grid to not auto-position cells by default. 2023-06-14 18:29:30 -03:00
border.rs Renamed the property attribute `impl(T)` to `widget_impl(T)`. 2023-04-17 00:46:01 -03:00
button.rs Simplified style usage, changed `Link!` into a button style. 2023-04-18 15:37:27 -03:00
calculator.rs Refactored grid to not auto-position cells by default. 2023-06-14 18:29:30 -03:00
config.rs Fixed icon align. 2023-06-12 23:30:46 -03:00
countdown.rs More refactor. 2023-04-12 18:02:22 -03:00
cursor.rs Refactored grid to not auto-position cells by default. 2023-06-14 18:29:30 -03:00
extend_view.rs Config reseting mostly done. 2023-06-10 16:09:37 -03:00
focus.rs Fixed calling update before first info build when using `take_when(true)` and `take_on_init`. 2023-05-09 01:12:22 -03:00
gradient.rs More l10n examples. 2023-05-23 12:18:17 -03:00
headless.rs More refactor. 2023-04-12 18:02:22 -03:00
icon.rs Fixed infinite loop caused by widget pending updates propagating to parent in context where this is not expected. 2023-06-14 01:03:51 -03:00
image.rs Added TODO. 2023-06-17 01:37:31 -03:00
layer.rs Support `LAYERS.insert` before the window init. 2023-04-25 20:38:05 -03:00
localize.rs More l10n TODO review. 2023-05-27 16:36:05 -03:00
markdown.rs More property refactor to organize docs. 2023-04-18 13:18:38 -03:00
respawn.rs Improved view extension API and example. 2023-06-07 21:10:05 -03:00
scroll.rs Implemented `accepts_return`. 2023-05-13 01:12:23 -03:00
shortcuts.rs Refactored `Txt` to represent text as an `Arc<str>` too. Fixed `Txt` that contains a null character. 2023-05-27 22:58:59 -03:00
text.rs Fixed WIDGET.with_handles in parallel contexts. 2023-06-16 23:25:20 -03:00
transform.rs More refactor. 2023-04-12 18:34:35 -03:00
window.rs More native dialog API changes and implemented better text editor example. 2023-06-15 23:07:44 -03:00

README.md

Examples

This directory contains small example apps.

Running

To run an example use cargo do run $name.

Adding an Example

To add an example, create a file then add it in ./Cargo.toml.

Template

This is a good example template:

In ./foo.rs:

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use zero_ui::prelude::*;

use zero_ui_view_prebuilt as zero_ui_view;

fn main() {
    examples_util::print_info();
    // zero_ui_view::run_same_process(app_main);

    zero_ui_view::init();
    app_main();
}

fn app_main() {
    App::default().run_window(async {
        Window! {
            title = "Foo Example";
            child = Text!("Bar");
        }
    })
}

Then add in ./Cargo.toml:

[[example]]
name = "foo"
path = "foo.rs"

Then run from the project root using cargo do run foo.