#![allow(dead_code)]
use std::ffi::{c_char, c_int, CString};
+use crate::ui::ffi;
+
+pub struct UiObject {
+ pub ptr: *const ffi::UiObject
+}
extern "C" {
fn ui_init(appname: *const c_char, argc: c_int, argv: *const *const c_char);
--- /dev/null
+#![allow(dead_code)]
+#[allow(unused_imports)]
+
+use std::ffi::{c_char, c_int, c_void};
+use std::ffi::CString;
+use crate::ui::toolkit;
+use crate::ui::ffi::UiObject;
+
+extern "C" {
+ fn ui_window(title: *const c_char) -> *const UiObject;
+ fn ui_sidebar_window(title: *const c_char) -> *const UiObject;
+ fn ui_splitview_window(title: *const c_char, sidebar: c_int) -> *const UiObject;
+ fn ui_simple_window(title: *const c_char) -> *const UiObject;
+
+
+ fn ui_show(ui: *const UiObject);
+}
+
+impl toolkit::UiObject {
+ pub fn show(&self) {
+ unsafe {
+ ui_show(self.ptr);
+ }
+ }
+}
+
+pub fn window(title: &str) -> toolkit::UiObject {
+ unsafe {
+ let str = CString::new(title).unwrap();
+ let objptr = ui_window(str.as_ptr());
+ return toolkit::UiObject { ptr: objptr };
+ }
+}
\ No newline at end of file