win_msgbox/
yes_no.rs

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