summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-09-22 16:06:20 -0400
committerGlenn Smith <glenn@vector35.com>2022-09-29 21:02:24 -0400
commit2672d9a6e8a69b95ab58788a7a3046e26f1a9377 (patch)
treec144a1125fe59c33d2d1991ac642c6433311f34f /rust/src
parentf6cceb21200acd65510940f03e90d96e2f3d77ea (diff)
[Rust API] interaction::show_message_box
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/interaction.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/rust/src/interaction.rs b/rust/src/interaction.rs
index 41289a14..9fe2a45b 100644
--- a/rust/src/interaction.rs
+++ b/rust/src/interaction.rs
@@ -123,6 +123,21 @@ pub fn get_directory_name_input(prompt: &str, default_name: &str) -> Option<Path
Some(PathBuf::from(string.as_str()))
}
+pub type MessageBoxButtonSet = BNMessageBoxButtonSet;
+pub type MessageBoxIcon = BNMessageBoxIcon;
+pub type MessageBoxButtonResult = BNMessageBoxButtonResult;
+pub fn show_message_box(
+ title: &str,
+ text: &str,
+ buttons: MessageBoxButtonSet,
+ icon: MessageBoxIcon,
+) -> MessageBoxButtonResult {
+ let title = CString::new(title).unwrap();
+ let text = CString::new(text).unwrap();
+
+ unsafe { BNShowMessageBox(title.as_ptr(), text.as_ptr(), buttons, icon) }
+}
+
struct TaskContext<F: Fn(Box<dyn Fn(usize, usize) -> Result<(), ()>>)>(F);
pub fn run_progress_dialog<F: Fn(Box<dyn Fn(usize, usize) -> Result<(), ()>>)>(