// Keypad turns on/off the keypad characters, including those like the F1-F12 // keys and the arrow keys func (w *Window) Keypad(keypad bool) error { var err C.int if err = C.keypad(w.win, C.bool(keypad)); err == C.ERR { return errors.New("Unable to set keypad mode") } return nil }
/* Enables the reading of all keys on a keyboard (that the operating system will interpret) */ func Keypad(win *Window, translate bool) { temp := 0 if translate { temp = 1 } C.keypad((*C.WINDOW)(win), C.bool(temp)) }
func (win *Window) Keypad(b bool) error { a := bool2cint(b) if C.keypad((*C.WINDOW)(win), a) == C.ERR { return CursesError{"kaypad failed"} } return nil }
func initCurses() { C.initscr() C.cbreak() C.noecho() C.nonl() C.intrflush(C.stdscr, true) C.keypad(C.stdscr, false) }
func (w *Window) EnableKeypad(enabled bool) error { var keypadEnabledCode int = 0 if enabled { keypadEnabledCode = 1 } if C.keypad((*C.WINDOW)(w), C.int(keypadEnabledCode)) == C.ERR { return CursesError{"Keypad failed"} } return nil }
func (w *Window) Keypad(tf bool) error { var outint int if tf { outint++ } if C.keypad(w.win, C.int(outint)) != OK { return ErrorKeypad } return nil }
func (w *Window) Keypad(tf bool) os.Error { var outint int if tf == true { outint = 1 } if tf == false { outint = 0 } if C.keypad((*C.WINDOW)(w), C.int(outint)) == 0 { return CursesError{"Keypad failed"} } return nil }
func Init(theme *ColorTheme, black bool, mouse bool) { C.setlocale(C.LC_ALL, C.CString("")) tty := C.c_tty() if tty == nil { fmt.Println("Failed to open /dev/tty") os.Exit(2) } _screen = C.c_newterm(tty) if _screen == nil { fmt.Println("Invalid $TERM: " + os.Getenv("TERM")) os.Exit(2) } C.set_term(_screen) if mouse { C.mousemask(C.ALL_MOUSE_EVENTS, nil) C.mouseinterval(0) } C.noecho() C.raw() // stty dsusp undef C.nonl() C.keypad(C.stdscr, true) delay := 50 delayEnv := os.Getenv("ESCDELAY") if len(delayEnv) > 0 { num, err := strconv.Atoi(delayEnv) if err == nil && num >= 0 { delay = num } } C.set_escdelay(C.int(delay)) _color = theme != nil if _color { C.start_color() InitTheme(theme, black) initPairs(theme) C.bkgd(C.chtype(C.COLOR_PAIR(C.int(ColNormal)))) _colorFn = attrColored } else { _colorFn = attrMono } C.nodelay(C.stdscr, true) ch := C.getch() if ch != C.ERR { C.ungetch(ch) } C.nodelay(C.stdscr, false) }
func (r *FullscreenRenderer) Init() { C.setlocale(C.LC_ALL, C.CString("")) tty := C.c_tty() if tty == nil { errorExit("Failed to open /dev/tty") } _screen = C.c_newterm(tty) if _screen == nil { errorExit("Invalid $TERM: " + os.Getenv("TERM")) } C.set_term(_screen) if r.mouse { C.mousemask(C.ALL_MOUSE_EVENTS, nil) C.mouseinterval(0) } C.noecho() C.raw() // stty dsusp undef C.nonl() C.keypad(C.stdscr, true) delay := 50 delayEnv := os.Getenv("ESCDELAY") if len(delayEnv) > 0 { num, err := strconv.Atoi(delayEnv) if err == nil && num >= 0 { delay = num } } C.set_escdelay(C.int(delay)) if r.theme != nil { C.start_color() initTheme(r.theme, r.defaultTheme(), r.forceBlack) initPairs(r.theme) C.bkgd(C.chtype(C.COLOR_PAIR(C.int(ColNormal.index())))) _colorFn = attrColored } else { initTheme(r.theme, nil, r.forceBlack) _colorFn = attrMono } C.nodelay(C.stdscr, true) ch := C.getch() if ch != C.ERR { C.ungetch(ch) } C.nodelay(C.stdscr, false) }
// Enable reading of function keys. func (window *Window) Keypad(on bool) { C.keypad(window.cwin, C.bool(on)) }
// Enable reading of function keys. func (win *Window) Keypad(on bool) { C.keypad((*C.WINDOW)(win), C.bool(on)) }