1#![allow(non_camel_case_types)]
2#![allow(clippy::not_unsafe_ptr_arg_deref)]
3
4use std::ffi::CString;
5
6use ffi::WINDOW;
7
8pub enum CURSOR_VISIBILITY {
9 CURSOR_INVISIBLE,
10}
11
12mod ffi;
13
14pub fn initscr() -> WINDOW {
15 unsafe { ffi::initscr() }
16}
17
18pub fn endwin() -> i32 {
19 unsafe { ffi::endwin() }
20}
21
22pub fn curs_set(visibility: CURSOR_VISIBILITY) -> i32 {
23 unsafe { ffi::curs_set(visibility as i32) }
24}
25
26pub fn newwin(lines: i32, cols: i32, y: i32, x: i32) -> WINDOW {
27 unsafe { ffi::newwin(lines, cols, y, x) }
28}
29
30pub fn delwin(w: WINDOW) -> i32 {
31 unsafe { ffi::delwin(w) }
32}
33
34pub fn waddch(w: WINDOW, ch: u32) -> i32 {
35 unsafe { ffi::waddch(w, ch) }
36}
37
38pub fn waddstr(w: WINDOW, s: &str) -> i32 {
39 let c_string = CString::new(s).unwrap();
40 unsafe { ffi::waddstr(w, c_string.as_ptr()) }
41}
42
43pub fn wclear(w: WINDOW) -> i32 {
44 unsafe { ffi::wclear(w) }
45}
46
47pub fn wrefresh(w: WINDOW) -> i32 {
48 unsafe { ffi::wrefresh(w) }
49}