pub(crate) mod button;
pub(crate) mod cell;
pub(crate) mod combo;
pub(crate) mod control;
pub(crate) mod edit;
pub(crate) mod imageview;
pub(crate) mod label;
pub(crate) mod layout;
pub(crate) mod listbox;
pub(crate) mod menu;
pub(crate) mod menuitem;
pub(crate) mod panel;
pub(crate) mod popup;
pub(crate) mod progress;
pub(crate) mod slider;
pub(crate) mod splitview;
pub(crate) mod tableview;
pub(crate) mod textview;
pub(crate) mod updown;
pub(crate) mod view;
pub(crate) mod webview;
pub(crate) mod window;
pub mod dialog;
pub mod event;
use crate::draw_2d::ImageInner;
pub use {
button::*, cell::*, combo::*, control::*, edit::*, imageview::*, label::*, layout::*,
listbox::*, menu::*, menuitem::*, panel::*, popup::*, progress::*, slider::*, splitview::*,
tableview::*, textview::*, updown::*, view::*, webview::*, window::*,
};
pub fn gui_image(rid: &str) -> ImageInner {
let rid = std::ffi::CString::new(rid).unwrap();
let image = unsafe { nappgui_sys::gui_image(rid.as_ptr()) } as *mut nappgui_sys::Image;
ImageInner { inner: image }
}
pub fn gui_text(rid: &str) -> String {
let rid = std::ffi::CString::new(rid).unwrap();
let text = unsafe { nappgui_sys::gui_text(rid.as_ptr()) };
let text = unsafe { std::ffi::CStr::from_ptr(text) };
text.to_string_lossy().to_string()
}
pub fn gui_file(rid: &str) -> (&[u8], usize) {
let mut size = 0u32;
let rid = std::ffi::CString::new(rid).unwrap();
let file = unsafe { nappgui_sys::gui_file(rid.as_ptr(), &mut size) };
(
unsafe { std::slice::from_raw_parts(file, size as usize) },
size as usize,
)
}
pub type NappguiResourceHandler =
unsafe extern "C" fn(locale: *const std::ffi::c_char) -> *mut nappgui_sys::ResPack;
pub fn gui_respack(handler: NappguiResourceHandler) {
unsafe {
nappgui_sys::gui_respack(Some(handler));
}
}
pub fn gui_language(language: &str) {
let language = std::ffi::CString::new(language).unwrap();
unsafe {
nappgui_sys::gui_language(language.as_ptr());
}
}