win_msgbox/
yes_no_cancel.rs

1use super::Options;
2use windows_sys::Win32::UI::WindowsAndMessaging::{
3    IDNO, IDYES, MB_YESNOCANCEL, MESSAGEBOX_RESULT, MESSAGEBOX_STYLE,
4};
5
6/// The message box contains three push buttons: **Yes**, **No**, and **Cancel**.
7#[derive(Debug, Eq, PartialEq, Clone, Copy, Hash)]
8pub enum YesNoCancel {
9    /// The **Yes** button was selected.
10    Yes,
11    /// The **No** button was selected.
12    No,
13    /// The **Cancel** button was selected.
14    Cancel,
15}
16
17impl From<MESSAGEBOX_RESULT> for YesNoCancel {
18    fn from(value: MESSAGEBOX_RESULT) -> Self {
19        match value {
20            IDYES => Self::Yes,
21            IDNO => Self::No,
22            _ => Self::Cancel,
23        }
24    }
25}
26
27impl Options for YesNoCancel {
28    fn flags() -> MESSAGEBOX_STYLE {
29        MB_YESNOCANCEL
30    }
31}