refactor(dialog)!: use enum instead of label for buttons (#1842)

* refactor(dialog)!: use enum instead of label

* Add change file

* Fix doc comment typo

* Move ok and cancel to lib.rs
This commit is contained in:
Tony
2024-10-01 20:34:20 +08:00
committed by GitHub
parent 3b2bd3065d
commit 04459afbb6
5 changed files with 95 additions and 57 deletions
+15
View File
@@ -49,3 +49,18 @@ impl Serialize for MessageDialogKind {
}
}
}
/// Set of button that will be displayed on the dialog
#[non_exhaustive]
#[derive(Debug, Default, Clone)]
pub enum MessageDialogButtons {
#[default]
/// A single `Ok` button with OS default dialog text
Ok,
/// 2 buttons `Ok` and `Cancel` with OS default dialog texts
OkCancel,
/// A single `Ok` button with custom text
OkCustom(String),
/// 2 buttons `Ok` and `Cancel` with custom texts
OkCancelCustom(String, String),
}