A library to display file choosers and message boxes. Supports GNU/Linux, BSD Unix, macOS and Windows.
cargo add native-dialog
```rust use native_dialog::{FileDialog, MessageDialog, MessageType};
fn main() { let result = FileDialog::new() .setlocation("~/Desktop") .addfilter("PNG Image", &["png"]) .addfilter("JPEG Image", &["jpg", "jpeg"]) .showopensinglefile() .unwrap();
let message = format!("{:#?}", result);
let result = MessageDialog::new()
.set_type(MessageType::Info)
.set_title("Do you want to open these files?")
.set_text(&message)
.show_confirm()
.unwrap();
assert_eq!(result, true);
} ```
Turn on crate features or embed manifests into the .exe
to enable visual styling and dpi awareness for your program. Check out examples/windowsmanifest and examples/windowsfeatures for example.
The API of macOS has a limitation that all UI operations must be performed on the main thread.