use cxx::let_cxx_string;
use crate::ffi;
use crate::widget::AsWidget;
pub fn information(parent: Option<&dyn AsWidget>, title: &str, text: &str) {
let parent_ptr = parent.map(|p| p.widget_ptr()).unwrap_or(std::ptr::null_mut());
let_cxx_string!(c_title = title);
let_cxx_string!(c_text = text);
unsafe { ffi::QMessageBox_information(parent_ptr, &c_title, &c_text); }
}
pub fn warning(parent: Option<&dyn AsWidget>, title: &str, text: &str) {
let parent_ptr = parent.map(|p| p.widget_ptr()).unwrap_or(std::ptr::null_mut());
let_cxx_string!(c_title = title);
let_cxx_string!(c_text = text);
unsafe { ffi::QMessageBox_warning(parent_ptr, &c_title, &c_text); }
}
pub fn critical(parent: Option<&dyn AsWidget>, title: &str, text: &str) {
let parent_ptr = parent.map(|p| p.widget_ptr()).unwrap_or(std::ptr::null_mut());
let_cxx_string!(c_title = title);
let_cxx_string!(c_text = text);
unsafe { ffi::QMessageBox_critical(parent_ptr, &c_title, &c_text); }
}
pub fn question(parent: Option<&dyn AsWidget>, title: &str, text: &str) -> bool {
let parent_ptr = parent.map(|p| p.widget_ptr()).unwrap_or(std::ptr::null_mut());
let_cxx_string!(c_title = title);
let_cxx_string!(c_text = text);
let result = unsafe { ffi::QMessageBox_question(parent_ptr, &c_title, &c_text) };
result == 0x00004000 }