win_msgbox/
retry_cancel.rs

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