Пример #1
0
// Since CGO currently can't handle varg C functions we'll mimic the
// ncurses addstr functions.
func (w *Window) Addstr(x, y int, str string, flags int32, v ...interface{}) {
	newstr := fmt.Sprintf(str, v...)

	w.MoveCursor(x, y)

	for i := 0; i < len(newstr); i++ {
		C.waddch(w.win, C.chtype(newstr[i])|C.chtype(flags))
	}
}
Пример #2
0
// Since CGO currently can't handle varg C functions we'll mimic the
// ncurses addstr functions.
func (win *Window) Addstr(x, y int, str string, flags int32, v ...interface{}) {
	newstr := fmt.Sprintf(str, v...)

	win.Move(x, y)

	for i := 0; i < len(newstr); i++ {
		C.waddch((*C.WINDOW)(win), C.chtype(newstr[i])|C.chtype(flags))
	}
}
Пример #3
0
// Since CGO currently can't handle varg C functions we'll mimic the
// ncurses addstr functions.
// Per Issue 635 the variadic function definition needs to end with
// 'v ... interface {}' instead of 'v ...'.
func (win *Window) Addstr(x, y int, str string, flags int32, v ...interface{}) {
	in()
	defer out()
	newstr := fmt.Sprintf(str, v)

	win.move(x, y)

	for _, ch := range newstr {
		C.waddch((*C.WINDOW)(win), C.chtype(ch)|C.chtype(flags))
	}
}
Пример #4
0
// Since CGO currently can't handle varg C functions we'll mimic the
// ncurses addstr functions.
func (win *Window) AddString(x, y int, str string, flags int32, v ...interface{}) {
	var resolvedString string
	if v != nil {
		resolvedString = fmt.Sprintf(str, v)
	} else {
		resolvedString = str
	}

	win.Move(x, y)

	for i := 0; i < len(resolvedString); i++ {
		C.waddch((*C.WINDOW)(win), C.chtype(resolvedString[i])|C.chtype(flags))
	}
}
Пример #5
0
// AddChar prints a single character to the window. The character can be
// OR'd together with attributes and colors.
func (w *Window) AddChar(ach Char) {
	C.waddch(w.win, C.chtype(ach))
}
Пример #6
0
func (window *Window) Addch(ch int) {
	C.waddch(window.cwin, C.chtype(ch))
}
Пример #7
0
func (win *Window) Addch(ch int) {
	C.waddch((*C.WINDOW)(win), C.chtype(ch))
}
Пример #8
0
// Since CGO currently can't handle varg C functions we'll mimic the
// ncurses addstr functions.
func (win *Window) RegAddstr(str string) {
	for i := 0; i < len(str); i++ {
		C.waddch((*C.WINDOW)(win), C.chtype(str[i]))
	}
}
Пример #9
0
func (win *Window) Addch(c chtype) chtype {
	return chtype(C.waddch((*C.WINDOW)(win), C.chtype(c)))
}