use libc::{ c_char, c_int };
pub use libc::{LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME, LC_MESSAGES};
use super::ll::*;
mod wrapped {
use libc::{ c_char, c_int };
use ll::chtype;
use ll::WINDOW;
extern "C"
{
pub static curscr: WINDOW;
pub static newscr: WINDOW;
pub static stdscr: WINDOW;
pub static ttytype: *mut c_char;
pub static COLORS: c_int;
pub static COLOR_PAIRS: c_int;
pub static COLS: c_int;
pub static ESCDELAY: c_int;
pub static LINES: c_int;
pub static TABSIZE: c_int;
pub static mut acs_map: [chtype; 0];
}
}
macro_rules! wrap_extern {
($name:ident: $t:ty) => {
pub fn $name() -> $t {
unsafe { wrapped::$name }
}
}
}
wrap_extern!(curscr: WINDOW);
wrap_extern!(newscr: WINDOW);
wrap_extern!(stdscr: WINDOW);
wrap_extern!(ttytype: *mut c_char);
wrap_extern!(COLORS: c_int);
wrap_extern!(COLOR_PAIRS: c_int);
wrap_extern!(COLS: c_int);
wrap_extern!(ESCDELAY: c_int);
wrap_extern!(LINES: c_int);
wrap_extern!(TABSIZE: c_int);
pub fn acs_map() -> *const chtype {
unsafe {
&wrapped::acs_map as *const chtype
}
}
pub const ERR: i32 = -1;
pub const OK: i32 = 0;
pub const TRUE: c_bool = 1;
pub const FALSE: c_bool = 0;
pub const NCURSES_ATTR_SHIFT: u32 = 8u32;
pub const COLOR_BLACK: i16 = 0;
pub const COLOR_RED: i16 = 1;
pub const COLOR_GREEN: i16 = 2;
pub const COLOR_YELLOW: i16 = 3;
pub const COLOR_BLUE: i16 = 4;
pub const COLOR_MAGENTA: i16 = 5;
pub const COLOR_CYAN: i16 = 6;
pub const COLOR_WHITE: i16 = 7;
pub const _SUBWIN: i32 = 0x01;
pub const _ENDLINE: i32 = 0x02;
pub const _FULLWIN: i32 = 0x04;
pub const _SCROLLWIN: i32 = 0x08;
pub const _ISPAD: i32 = 0x10;
pub const _HASMOVED: i32 = 0x20;
pub const _WRAPPED: i32 = 0x40;
pub const _NOCHANGE: i32 = -1;
pub const _NEWINDEX: i32 = -1;
pub const KEY_CODE_YES: i32 = 0x100;
pub const KEY_MIN: i32 = 0x101;
pub const KEY_BREAK: i32 = 0x101;
pub const KEY_SRESET: i32 = 0x158;
pub const KEY_RESET: i32 = 0x159;
pub const KEY_DOWN: i32 = 0x102;
pub const KEY_UP: i32= 0x103;
pub const KEY_LEFT: i32= 0x104;
pub const KEY_RIGHT: i32= 0x105;
pub const KEY_HOME: i32= 0x106;
pub const KEY_BACKSPACE: i32= 0x107;
pub const KEY_F0: i32= 0x108;
pub const KEY_F1: i32= 0x109;
pub const KEY_F2: i32= 0x10a;
pub const KEY_F3: i32= 0x10b;
pub const KEY_F4: i32= 0x10c;
pub const KEY_F5: i32= 0x10d;
pub const KEY_F6: i32= 0x10e;
pub const KEY_F7: i32= 0x10f;
pub const KEY_F8: i32= 0x110;
pub const KEY_F9: i32= 0x111;
pub const KEY_F10: i32= 0x112;
pub const KEY_F11: i32= 0x113;
pub const KEY_F12: i32= 0x114;
pub const KEY_F13: i32= 0x115;
pub const KEY_F14: i32= 0x116;
pub const KEY_F15: i32= 0x117;
pub const KEY_DL: i32= 0x148;
pub const KEY_IL: i32= 0x149;
pub const KEY_DC: i32= 0x14a;
pub const KEY_IC: i32= 0x14b;
pub const KEY_EIC: i32= 0x14c;
pub const KEY_CLEAR: i32= 0x14d;
pub const KEY_EOS: i32= 0x14e;
pub const KEY_EOL: i32= 0x14f;
pub const KEY_SF: i32= 0x150;
pub const KEY_SR: i32= 0x151;
pub const KEY_NPAGE: i32= 0x152;
pub const KEY_PPAGE: i32= 0x153;
pub const KEY_STAB: i32= 0x154;
pub const KEY_CTAB: i32= 0x155;
pub const KEY_CATAB: i32= 0x156;
pub const KEY_ENTER: i32= 0x157;
pub const KEY_PRINT: i32= 0x15a;
pub const KEY_LL: i32= 0x15b;
pub const KEY_A1: i32= 0x15c;
pub const KEY_A3: i32= 0x15d;
pub const KEY_B2: i32= 0x15e;
pub const KEY_C1: i32= 0x15f;
pub const KEY_C3: i32= 0x160;
pub const KEY_BTAB: i32= 0x161;
pub const KEY_BEG: i32= 0x162;
pub const KEY_CANCEL: i32= 0x163;
pub const KEY_CLOSE: i32= 0x164;
pub const KEY_COMMAND: i32= 0x165;
pub const KEY_COPY: i32= 0x166;
pub const KEY_CREATE: i32= 0x167;
pub const KEY_END: i32= 0x168;
pub const KEY_EXIT: i32= 0x169;
pub const KEY_FIND: i32= 0x16a;
pub const KEY_HELP: i32= 0x16b;
pub const KEY_MARK: i32= 0x16c;
pub const KEY_MESSAGE: i32= 0x16d;
pub const KEY_MOVE: i32= 0x16e;
pub const KEY_NEXT: i32= 0x16f;
pub const KEY_OPEN: i32= 0x170;
pub const KEY_OPTIONS: i32= 0x171;
pub const KEY_PREVIOUS: i32= 0x172;
pub const KEY_REDO: i32= 0x173;
pub const KEY_REFERENCE: i32= 0x174;
pub const KEY_REFRESH: i32= 0x175;
pub const KEY_REPLACE: i32= 0x176;
pub const KEY_RESTART: i32= 0x177;
pub const KEY_RESUME: i32= 0x178;
pub const KEY_SAVE: i32= 0x179;
pub const KEY_SBEG: i32= 0x17a;
pub const KEY_SCANCEL: i32= 0x17b;
pub const KEY_SCOMMAND: i32= 0x17c;
pub const KEY_SCOPY: i32= 0x17d;
pub const KEY_SCREATE: i32= 0x17e;
pub const KEY_SDC : i32= 0x17f;
pub const KEY_SDL : i32= 0x180;
pub const KEY_SELECT: i32= 0x181;
pub const KEY_SEND: i32= 0x182;
pub const KEY_SEOL: i32= 0x183;
pub const KEY_SEXIT: i32= 0x184;
pub const KEY_SFIND: i32= 0x185;
pub const KEY_SHELP: i32= 0x186;
pub const KEY_SHOME: i32= 0x187;
pub const KEY_SIC : i32= 0x188;
pub const KEY_SLEFT: i32= 0x189;
pub const KEY_SMESSAGE: i32= 0x18a;
pub const KEY_SMOVE: i32= 0x18b;
pub const KEY_SNEXT: i32= 0x18c;
pub const KEY_SOPTIONS: i32= 0x18d;
pub const KEY_SPREVIOUS: i32= 0x18e;
pub const KEY_SPRINT: i32= 0x18f;
pub const KEY_SREDO: i32= 0x190;
pub const KEY_SREPLACE: i32= 0x191;
pub const KEY_SRIGHT: i32= 0x192;
pub const KEY_SRSUME: i32= 0x193;
pub const KEY_SSAVE: i32= 0x194;
pub const KEY_SSUSPEND: i32= 0x195;
pub const KEY_SUNDO: i32= 0x196;
pub const KEY_SUSPEND: i32= 0x197;
pub const KEY_UNDO: i32= 0x198;
pub const KEY_MOUSE: i32= 0x199;
pub const KEY_RESIZE: i32= 0x19a;
pub const KEY_EVENT: i32= 0x19b;
pub const KEY_MAX: i32= 0x1ff;
#[cfg(feature="mouse_v1")]
pub const NCURSES_MOUSE_VERSION: i32= 1;
#[cfg(not(feature="mouse_v1"))]
pub const NCURSES_MOUSE_VERSION: i32= 2;
#[cfg(feature = "mouse_v1")]
const MASK_SHIFT: i32 = 6;
#[cfg(not(feature = "mouse_v1"))]
const MASK_SHIFT: i32 = 5;
#[cfg(feature = "mouse_v1")]
const MODIFIER_SHIFT: i32 = 5;
#[cfg(not(feature = "mouse_v1"))]
const MODIFIER_SHIFT: i32 = 6;
macro_rules! ncurses_mouse_mask( ($b:expr, $m:expr) => ($m << (($b - 1) * MASK_SHIFT)); );
pub const NCURSES_BUTTON_RELEASED: i32= 0x001;
pub const NCURSES_BUTTON_PRESSED: i32= 0x002;
pub const NCURSES_BUTTON_CLICKED: i32= 0x004;
pub const NCURSES_DOUBLE_CLICKED: i32= 0x008;
pub const NCURSES_TRIPLE_CLICKED: i32= 0x010;
pub const NCURSES_RESERVED_EVENT: i32= 0x020;
pub const BUTTON1_RELEASED: i32= ncurses_mouse_mask!(1, NCURSES_BUTTON_RELEASED);
pub const BUTTON1_PRESSED: i32= ncurses_mouse_mask!(1, NCURSES_BUTTON_PRESSED);
pub const BUTTON1_CLICKED: i32= ncurses_mouse_mask!(1, NCURSES_BUTTON_CLICKED);
pub const BUTTON1_DOUBLE_CLICKED: i32= ncurses_mouse_mask!(1, NCURSES_DOUBLE_CLICKED);
pub const BUTTON1_TRIPLE_CLICKED: i32= ncurses_mouse_mask!(1, NCURSES_TRIPLE_CLICKED);
pub const BUTTON2_RELEASED: i32= ncurses_mouse_mask!(2, NCURSES_BUTTON_RELEASED);
pub const BUTTON2_PRESSED: i32= ncurses_mouse_mask!(2, NCURSES_BUTTON_PRESSED);
pub const BUTTON2_CLICKED: i32= ncurses_mouse_mask!(2, NCURSES_BUTTON_CLICKED);
pub const BUTTON2_DOUBLE_CLICKED: i32= ncurses_mouse_mask!(2, NCURSES_DOUBLE_CLICKED);
pub const BUTTON2_TRIPLE_CLICKED: i32= ncurses_mouse_mask!(2, NCURSES_TRIPLE_CLICKED);
pub const BUTTON3_RELEASED: i32= ncurses_mouse_mask!(3, NCURSES_BUTTON_RELEASED);
pub const BUTTON3_PRESSED: i32= ncurses_mouse_mask!(3, NCURSES_BUTTON_PRESSED);
pub const BUTTON3_CLICKED: i32= ncurses_mouse_mask!(3, NCURSES_BUTTON_CLICKED);
pub const BUTTON3_DOUBLE_CLICKED: i32= ncurses_mouse_mask!(3, NCURSES_DOUBLE_CLICKED);
pub const BUTTON3_TRIPLE_CLICKED: i32= ncurses_mouse_mask!(3, NCURSES_TRIPLE_CLICKED);
pub const BUTTON4_RELEASED: i32= ncurses_mouse_mask!(4, NCURSES_BUTTON_RELEASED);
pub const BUTTON4_PRESSED: i32= ncurses_mouse_mask!(4, NCURSES_BUTTON_PRESSED);
pub const BUTTON4_CLICKED: i32= ncurses_mouse_mask!(4, NCURSES_BUTTON_CLICKED);
pub const BUTTON4_DOUBLE_CLICKED: i32= ncurses_mouse_mask!(4, NCURSES_DOUBLE_CLICKED);
pub const BUTTON4_TRIPLE_CLICKED: i32= ncurses_mouse_mask!(4, NCURSES_TRIPLE_CLICKED);
pub const BUTTON5_RELEASED: i32= ncurses_mouse_mask!(5, NCURSES_BUTTON_RELEASED);
pub const BUTTON5_PRESSED: i32= ncurses_mouse_mask!(5, NCURSES_BUTTON_PRESSED);
pub const BUTTON5_CLICKED: i32= ncurses_mouse_mask!(5, NCURSES_BUTTON_CLICKED);
pub const BUTTON5_DOUBLE_CLICKED: i32= ncurses_mouse_mask!(5, NCURSES_DOUBLE_CLICKED);
pub const BUTTON5_TRIPLE_CLICKED: i32= ncurses_mouse_mask!(5, NCURSES_TRIPLE_CLICKED);
pub const BUTTON_CTRL: i32 = ncurses_mouse_mask!(MODIFIER_SHIFT, 0x001);
pub const BUTTON_SHIFT: i32 = ncurses_mouse_mask!(MODIFIER_SHIFT, 0x002);
pub const BUTTON_ALT: i32 = ncurses_mouse_mask!(MODIFIER_SHIFT, 0x004);
pub const REPORT_MOUSE_POSITION: i32 = ncurses_mouse_mask!(MODIFIER_SHIFT, 0x008);
pub const ALL_MOUSE_EVENTS: i32= REPORT_MOUSE_POSITION - 1;
#[derive(Debug)]
#[repr(i32)]
pub enum LcCategory {
all = LC_ALL,
collate = LC_COLLATE,
ctype = LC_CTYPE,
monetary = LC_MONETARY,
numeric = LC_NUMERIC,
time = LC_TIME,
messages = LC_MESSAGES,
}