示例#1
0
文件: curses.go 项目: infokiller/fzf
func NewWindow(top int, left int, width int, height int, border bool) *Window {
	win := C.newwin(C.int(height), C.int(width), C.int(top), C.int(left))
	if border {
		attr := _color(ColBorder, 0)
		C.wattron(win, attr)
		C.box(win, 0, 0)
		C.wattroff(win, attr)
	}
	return &Window{
		win:    win,
		Top:    top,
		Left:   left,
		Width:  width,
		Height: height,
	}
}
示例#2
0
文件: ncurses.go 项目: junegunn/fzf
func (r *FullscreenRenderer) NewWindow(top int, left int, width int, height int, border bool) Window {
	win := C.newwin(C.int(height), C.int(width), C.int(top), C.int(left))
	if r.theme != nil {
		C.wbkgd(win, C.chtype(C.COLOR_PAIR(C.int(ColNormal.index()))))
	}
	if border {
		pair, attr := _colorFn(ColBorder, 0)
		C.wcolor_set(win, pair, nil)
		C.wattron(win, attr)
		C.box(win, 0, 0)
		C.wattroff(win, attr)
		C.wcolor_set(win, 0, nil)
	}

	return &CursesWindow{
		impl:   win,
		top:    top,
		left:   left,
		width:  width,
		height: height,
	}
}
示例#3
0
func NewWindow(top int, left int, width int, height int, border bool) *Window {
	win := C.newwin(C.int(height), C.int(width), C.int(top), C.int(left))
	if _color {
		C.wbkgd(win, C.chtype(C.COLOR_PAIR(C.int(ColNormal))))
	}
	if border {
		pair, attr := _colorFn(ColBorder, 0)
		C.wcolor_set(win, pair, nil)
		C.wattron(win, attr)
		C.box(win, 0, 0)
		C.wattroff(win, attr)
		C.wcolor_set(win, 0, nil)
	}

	return &Window{
		impl:   (*WindowImpl)(win),
		Top:    top,
		Left:   left,
		Width:  width,
		Height: height,
	}
}
示例#4
0
func (win *Window) Box(verch, horch int) {
	C.box((*C.WINDOW)(win), C.chtype(verch), C.chtype(horch))
}
示例#5
0
// Box draws a border around the given window. For complete control over the
// characters used to draw the border use Border()
func (w *Window) Box(vch, hch Char) error {
	if C.box(w.win, C.chtype(vch), C.chtype(hch)) == C.ERR {
		return errors.New("Failed to draw box around window")
	}
	return nil
}
示例#6
0
文件: curses.go 项目: zozor/gocurse
func (w *Window) Box(verch, horch int) {
	C.box(w.win, C.chtype(verch), C.chtype(horch))
}
示例#7
0
// Set box lines.
func (window *Window) Box(v, h int) {
	C.box(window.cwin, C.chtype(v), C.chtype(h))
}
示例#8
0
/* Surrounds the window by a box, using character v for the vertical parts and character h for the horizontal parts */
func (w *Window) Box(v, h int) {
	C.box((*C.WINDOW)(w), C.chtype(v), C.chtype(h))
}
示例#9
0
func (win *Window) Box(verch, horch int) {
	in()
	defer out()
	C.box((*C.WINDOW)(win), C.chtype(verch), C.chtype(horch))
}
示例#10
0
文件: window.go 项目: zyxar/gocurse
func (win *Window) Box(verch, horch chtype) error {
	if C.box((*C.WINDOW)(win), C.chtype(verch), C.chtype(horch)) == C.ERR {
		return CursesError{"box failed"}
	}
	return nil
}