zero-dialog 0.1.0

Ultra-lightweight, dependency-free system dialog library.
Documentation
# ZERO DIALOG

An ultra-lightweight, dependency-free system dialog library. Adds no GUI dependencies, requires no linking, and introduces zero extra code complexity.

Designed to show system-native dialogs as a last-resort user-facing error/exception handler without adding project bloat.

\[ [English]./README.md | [中文]./README-zh.md \]

## Design Goals

- Zero Rust dependencies
- Minimal code footprint
- No forced GUI toolkit dependencies
- No link-time library requirements
- Cross-platform (Windows/Linux)

Dynamically loads system GUI components at runtime:

- Uses Win32 API controls on Windows
- Attempts GTK3 dialogs on Linux

## Usage Example

Show a modal dialog with title `Hello`, content `World`, warning icon, and an `OK` button (closes when clicked):

```rust
zero_dialog::show("Hello", "World", &Default::default());
```

Show error icon with `OK` / `Cancel` buttons and capture user choice:

```rust
let title = "Fatal Error";
let msg = "Required assets not found, click Ok to exit";
let config = DialogConfig {
    icon: IconKind::Error,
    btn: ButtonKind::OkCancel,
};
let result = zero_dialog::show(title, msg, &config);
match result {
    Ok(Response::Ok) => std::process::exit(1),
    Ok(Response::Cancel) => println!("Cancel"),
    _ => println!("None"),
}
```

Suitable for use after `panic!()` to display critical errors.

```rust
use std::panic;
use zero_dialog::show;

fn main() {
    panic::set_hook(Box::new(|_| {
        let title = "Error";
        let msg = "Something went wrong";
        let _ = show(title, msg, &Default::default());
    }));

    panic!("Normal panic");
}
```

## Styling & Icons

Dialogs inherit native system styling. On Windows:

- Defaults to legacy Windows XP visual style
- Modern styling requires manual theming (affects entire application)
- Handle system theme changes with caution

To modify control styles on Windows, do this:

```toml
# Cargo.toml
[build-dependencies]
winres = "0.1"
```

```rust
// build.rs
fn main() {
    if cfg!(target_os = "windows") {
        let mut res = winres::WindowsResource::new();
        res.set_manifest(r#"
            <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
                <dependency>
                    <dependentAssembly>
                        <assemblyIdentity
                            type="win32"
                            name="Microsoft.Windows.Common-Controls"
                            version="6.0.0.0"
                            processorArchitecture="*"
                            publicKeyToken="6595b64144ccf1df"
                            language="*"
                        />
                    </dependentAssembly>
                </dependency>
                <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
                    <security>
                        <requestedPrivileges>
                            <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
                        </requestedPrivileges>
                    </security>
                </trustInfo>
            </assembly>
        "#);
        res.compile().expect("failed to compile");
    }
}
```

## Known Limitations

- Heavy use of unsafe code
- Fails silently if OS lacks required GUI components
- Dynamic loading may introduce unexpected behavior
- No control over visual appearance