1#[cfg_attr(target_os = "macos", path = "macos/mod.rs")]
5#[cfg_attr(target_os = "linux", path = "linux/mod.rs")]
6#[cfg_attr(target_os = "windows", path = "windows/mod.rs")]
7mod os_dialog;
8
9use raw_window_handle::WindowHandle;
10use std::io;
11use thiserror::Error;
12
13#[derive(Error, Debug)]
14pub enum BlockingDialogError {
15 #[error("The dialog is not running on the main thread")]
16 NotOnMainThread,
17 #[error("IO error: {0}")]
18 Io(#[from] io::Error),
19}
20
21#[derive(Debug, Clone, Copy)]
22pub enum BlockingDialogLevel {
23 Info,
24 Warning,
25 Error,
26}
27
28#[derive(Debug, Clone)]
29pub struct BlockingAlertDialog<'a> {
30 pub window: Option<WindowHandle<'a>>,
31 pub title: &'a str,
32 pub message: &'a str,
33 pub level: BlockingDialogLevel,
34}
35
36#[derive(Debug, Clone)]
37pub struct BlockingConfirmDialog<'a> {
38 pub window: Option<WindowHandle<'a>>,
39 pub title: &'a str,
40 pub message: &'a str,
41 pub level: BlockingDialogLevel,
42}
43
44#[derive(Debug, Clone)]
45pub struct BlockingPickFilesDialogFilter<'a> {
46 name: &'a str,
47 extensions: &'a [&'a str],
48}
49
50#[derive(Debug, Clone)]
51pub struct BlockingPickFilesDialog<'a> {
52 pub window: Option<WindowHandle<'a>>,
53 pub title: &'a str,
54 pub multiple: bool,
55 pub filter: &'a [BlockingPickFilesDialogFilter<'a>],
56}